ref_soft: sprite: fix to compile(copypasted from ref_gl)

This commit is contained in:
Alibek Omarov 2020-03-29 17:02:06 +03:00
parent 3984a58025
commit 9045657352

View File

@ -51,7 +51,7 @@ R_SpriteLoadFrame
upload a single frame upload a single frame
==================== ====================
*/ */
static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t **ppframe, int num ) static const dframetype_t *R_SpriteLoadFrame( model_t *mod, const void *pin, mspriteframe_t **ppframe, int num )
{ {
dspriteframe_t pinframe; dspriteframe_t pinframe;
mspriteframe_t *pspriteframe; mspriteframe_t *pspriteframe;
@ -87,7 +87,7 @@ static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t
pspriteframe->gl_texturenum = gl_texturenum; pspriteframe->gl_texturenum = gl_texturenum;
*ppframe = pspriteframe; *ppframe = pspriteframe;
return ( pin + sizeof(dspriteframe_t) + pinframe.width * pinframe.height * bytes ); return ( const dframetype_t* )(( const byte* )pin + sizeof( dspriteframe_t ) + pinframe.width * pinframe.height * bytes );
} }
/* /*
@ -97,16 +97,16 @@ R_SpriteLoadGroup
upload a group frames upload a group frames
==================== ====================
*/ */
static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t **ppframe, int framenum ) static const dframetype_t *R_SpriteLoadGroup( model_t *mod, const void *pin, mspriteframe_t **ppframe, int framenum )
{ {
dspritegroup_t *pingroup; const dspritegroup_t *pingroup;
mspritegroup_t *pspritegroup; mspritegroup_t *pspritegroup;
dspriteinterval_t *pin_intervals; const dspriteinterval_t *pin_intervals;
float *poutintervals; float *poutintervals;
int i, groupsize, numframes; int i, groupsize, numframes;
void *ptemp; const void *ptemp;
pingroup = (dspritegroup_t *)pin; pingroup = (const dspritegroup_t *)pin;
numframes = pingroup->numframes; numframes = pingroup->numframes;
groupsize = sizeof( mspritegroup_t ) + (numframes - 1) * sizeof( pspritegroup->frames[0] ); groupsize = sizeof( mspritegroup_t ) + (numframes - 1) * sizeof( pspritegroup->frames[0] );
@ -114,7 +114,7 @@ static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t
pspritegroup->numframes = numframes; pspritegroup->numframes = numframes;
*ppframe = (mspriteframe_t *)pspritegroup; *ppframe = (mspriteframe_t *)pspritegroup;
pin_intervals = (dspriteinterval_t *)(pingroup + 1); pin_intervals = (const dspriteinterval_t *)(pingroup + 1);
poutintervals = Mem_Calloc( mod->mempool, numframes * sizeof( float )); poutintervals = Mem_Calloc( mod->mempool, numframes * sizeof( float ));
pspritegroup->intervals = poutintervals; pspritegroup->intervals = poutintervals;
@ -127,13 +127,13 @@ static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t
pin_intervals++; pin_intervals++;
} }
ptemp = (void *)pin_intervals; ptemp = (const void *)pin_intervals;
for( i = 0; i < numframes; i++ ) for( i = 0; i < numframes; i++ )
{ {
ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i ); ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i );
} }
return (dframetype_t *)ptemp; return (const dframetype_t *)ptemp;
} }
/* /*
@ -206,7 +206,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
for( i = 0; i < mod->numframes; i++ ) for( i = 0; i < mod->numframes; i++ )
{ {
frametype_t frametype = pframetype->type; frametype_t frametype = pframetype->type;
psprite->frames[i].type = frametype; psprite->frames[i].type = (spriteframetype_t)frametype;
switch( frametype ) switch( frametype )
{ {
@ -237,7 +237,7 @@ Loading a bitmap image as sprite with multiple frames
as pieces of input image as pieces of input image
==================== ====================
*/ */
void GAME_EXPORT Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean *loaded ) void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean *loaded )
{ {
byte *src, *dst; byte *src, *dst;
rgbdata_t *pix, temp; rgbdata_t *pix, temp;
@ -672,10 +672,8 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow->value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE)); tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow->value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE));
if(( 1.0f - tr->fraction ) * dist > 8.0f ) if(( 1.0f - tr->fraction ) * dist > 8.0f )
{
return 0.0f; return 0.0f;
} }
}
if( renderfx == kRenderFxNoDissipation ) if( renderfx == kRenderFxNoDissipation )
return 1.0f; return 1.0f;
@ -700,7 +698,6 @@ qboolean R_SpriteOccluded( cl_entity_t *e, vec3_t origin, float *pscale )
{ {
float blend; float blend;
vec3_t v; vec3_t v;
//return false;
TriWorldToScreen( origin, v ); TriWorldToScreen( origin, v );