Browse Source

engine: client: fix various useless checks, unused variables & defines, double assignments and mistypings

pull/2/head
Alibek Omarov 3 years ago
parent
commit
52d1383f14
  1. 2
      engine/client/cl_custom.c
  2. 2
      engine/client/cl_efrag.c
  3. 4
      engine/client/cl_game.c
  4. 7
      engine/client/cl_main.c
  5. 15
      engine/client/cl_parse.c
  6. 1
      engine/client/cl_pmove.c
  7. 3
      engine/client/cl_tent.c
  8. 33
      engine/client/console.c
  9. 1
      engine/client/in_touch.c
  10. 2
      engine/client/keys.c
  11. 10
      engine/client/s_dsp.c
  12. 1
      engine/client/s_main.c

2
engine/client/cl_custom.c

@ -106,7 +106,7 @@ void CL_RemoveFromResourceList( resource_t *pResource ) @@ -106,7 +106,7 @@ void CL_RemoveFromResourceList( resource_t *pResource )
if( pResource->pPrev == NULL || pResource->pNext == NULL )
Host_Error( "mislinked resource in CL_RemoveFromResourceList\n" );
if ( pResource->pNext == pResource || pResource->pPrev == pResource )
if( pResource->pNext == pResource || pResource->pPrev == pResource )
Host_Error( "attempt to free last entry in list.\n" );
pResource->pPrev->pNext = pResource->pNext;

2
engine/client/cl_efrag.c

@ -188,8 +188,6 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount ) @@ -188,8 +188,6 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
case mod_brush:
case mod_studio:
case mod_sprite:
pent = pefrag->entity;
if( pent->visframe != framecount )
{
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))

4
engine/client/cl_game.c

@ -2299,9 +2299,9 @@ static void GAME_EXPORT pfnKillEvents( int entnum, const char *eventname ) @@ -2299,9 +2299,9 @@ static void GAME_EXPORT pfnKillEvents( int entnum, const char *eventname )
int i;
event_state_t *es;
event_info_t *ei;
int eventIndex = CL_EventIndex( eventname );
word eventIndex = CL_EventIndex( eventname );
if( eventIndex < 0 || eventIndex >= MAX_EVENTS )
if( eventIndex >= MAX_EVENTS )
return;
if( entnum < 0 || entnum > clgame.maxEntities )

7
engine/client/cl_main.c

@ -2345,11 +2345,10 @@ Replace the displayed name for some resources @@ -2345,11 +2345,10 @@ Replace the displayed name for some resources
*/
const char *CL_CleanFileName( const char *filename )
{
const char *pfilename = filename;
if( COM_CheckString( filename ) && filename[0] == '!' )
pfilename = "customization";
return pfilename;
return "customization";
return filename;
}

15
engine/client/cl_parse.c

@ -484,6 +484,8 @@ void CL_BatchResourceRequest( qboolean initialize ) @@ -484,6 +484,8 @@ void CL_BatchResourceRequest( qboolean initialize )
switch( p->type )
{
case t_sound:
case t_model:
case t_eventscript:
if( !CL_CheckFile( &msg, p ))
break;
CL_MoveToOnHandList( p );
@ -491,11 +493,6 @@ void CL_BatchResourceRequest( qboolean initialize ) @@ -491,11 +493,6 @@ void CL_BatchResourceRequest( qboolean initialize )
case t_skin:
CL_MoveToOnHandList( p );
break;
case t_model:
if( !CL_CheckFile( &msg, p ))
break;
CL_MoveToOnHandList( p );
break;
case t_decal:
if( !HPAK_GetDataPointer( CUSTOM_RES_PATH, p, NULL, NULL ))
{
@ -520,11 +517,6 @@ void CL_BatchResourceRequest( qboolean initialize ) @@ -520,11 +517,6 @@ void CL_BatchResourceRequest( qboolean initialize )
break;
CL_MoveToOnHandList( p );
break;
case t_eventscript:
if( !CL_CheckFile( &msg, p ))
break;
CL_MoveToOnHandList( p );
break;
case t_world:
ASSERT( 0 );
break;
@ -2389,14 +2381,11 @@ CL_ParseBaseline @@ -2389,14 +2381,11 @@ CL_ParseBaseline
void CL_LegacyParseBaseline( sizebuf_t *msg )
{
int i, newnum;
entity_state_t nullstate;
qboolean player;
cl_entity_t *ent;
Delta_InitClient (); // finalize client delta's
memset( &nullstate, 0, sizeof( nullstate ));
newnum = MSG_ReadWord( msg );
player = CL_IsPlayerIndex( newnum );

1
engine/client/cl_pmove.c

@ -992,7 +992,6 @@ void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, q @@ -992,7 +992,6 @@ void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, q
pmove->flFallVelocity = ps->flFallVelocity;
pmove->flSwimTime = cd->flSwimTime;
VectorCopy( cd->punchangle, pmove->punchangle );
pmove->flSwimTime = cd->flSwimTime;
pmove->flNextPrimaryAttack = 0.0f; // not used by PM_ code
pmove->effects = ps->effects;
pmove->flags = cd->flags;

3
engine/client/cl_tent.c

@ -1482,7 +1482,6 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse ) @@ -1482,7 +1482,6 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
pTemp->entity.baseline.angles[2] = COM_RandomFloat( -100.0f, 100.0f );
pTemp->entity.curstate.framerate = COM_RandomFloat( 0.1f, 0.4f );
pTemp->flags = FTENT_ROTATE|FTENT_FADEOUT;
pTemp->entity.curstate.framerate = 10;
vel = dest[2] / 8.0f;
if( vel < 64.0f ) vel = 64.0f;
@ -2920,7 +2919,7 @@ void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos @@ -2920,7 +2919,7 @@ void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos
{
if( FBitSet( pCust->resource.ucFlags, RES_CUSTOM ) && pCust->resource.type == t_decal && pCust->bTranslated )
{
if( !pCust->nUserData1 && pCust->pInfo != NULL )
if( !pCust->nUserData1 )
{
const char *decalname = va( "player%dlogo%d", playernum, customIndex );
pCust->nUserData1 = GL_LoadTextureInternal( decalname, pCust->pInfo, TF_DECAL );

33
engine/client/console.c

@ -1069,7 +1069,7 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb @@ -1069,7 +1069,7 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb
Con_UtfProcessChar( 0 );
// draw the colored text
*(uint *)color = *(uint *)setColor;
memcpy( color, setColor, sizeof( color ));
s = string;
while( *s )
@ -2174,6 +2174,9 @@ void Con_DrawSolidConsole( int lines ) @@ -2174,6 +2174,9 @@ void Con_DrawSolidConsole( int lines )
int i, x, y;
float fraction;
int start;
int stringLen, width = 0, charH;
string curbuild;
byte color[4];
if( lines <= 0 ) return;
@ -2187,28 +2190,20 @@ void Con_DrawSolidConsole( int lines ) @@ -2187,28 +2190,20 @@ void Con_DrawSolidConsole( int lines )
if( !con.curFont || !host.allow_console )
return; // nothing to draw
if( host.allow_console )
{
// draw current version
int stringLen, width = 0, charH;
string curbuild;
byte color[4];
memcpy( color, g_color_table[7], sizeof( color ));
// draw current version
memcpy( color, g_color_table[7], sizeof( color ));
Q_snprintf( curbuild, MAX_STRING, "%s %i/%s (%s-%s build %i)", XASH_ENGINE_NAME, PROTOCOL_VERSION, XASH_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
Q_snprintf( curbuild, MAX_STRING, "%s %i/%s (%s-%s build %i)", XASH_ENGINE_NAME, PROTOCOL_VERSION, XASH_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
Con_DrawStringLen( curbuild, &stringLen, &charH );
start = refState.width - stringLen;
stringLen = Con_StringLength( curbuild );
Con_DrawStringLen( curbuild, &stringLen, &charH );
start = refState.width - stringLen;
stringLen = Con_StringLength( curbuild );
fraction = lines / (float)refState.height;
color[3] = Q_min( fraction * 2.0f, 1.0f ) * 255; // fadeout version number
fraction = lines / (float)refState.height;
color[3] = Q_min( fraction * 2.0f, 1.0f ) * 255; // fadeout version number
for( i = 0; i < stringLen; i++ )
width += Con_DrawCharacter( start + width, 0, curbuild[i], color );
}
for( i = 0; i < stringLen; i++ )
width += Con_DrawCharacter( start + width, 0, curbuild[i], color );
// draw the text
if( CON_LINES_COUNT > 0 )

1
engine/client/in_touch.c

@ -786,7 +786,6 @@ static touch_button_t *Touch_AddButton( touchbuttonlist_t *list, @@ -786,7 +786,6 @@ static touch_button_t *Touch_AddButton( touchbuttonlist_t *list,
button->flags = privileged ? 0 : TOUCH_FL_UNPRIVILEGED | TOUCH_FL_CLIENT;
MakeRGBA( button->color, color[0], color[1], color[2], color[3] );
button->command[0] = 0;
button->flags = 0;
button->fade = 1;
Touch_SetCommand( button, command );

2
engine/client/keys.c

@ -1044,7 +1044,7 @@ static qboolean OSK_KeyEvent( int key, int down ) @@ -1044,7 +1044,7 @@ static qboolean OSK_KeyEvent( int key, int down )
else
osk.curlayout++;
osk.shift = osk.curbutton.val == OSK_SHIFT;
osk.shift = true;
osk.curbutton.val = osk_keylayout[osk.curlayout][osk.curbutton.y][osk.curbutton.x];
break;
case OSK_BACKSPACE:

10
engine/client/s_dsp.c

@ -33,7 +33,6 @@ GNU General Public License for more details. @@ -33,7 +33,6 @@ GNU General Public License for more details.
#define MAXDLY (STEREODLY + 1)
#define MAXLP 10
#define MAXPRESETS 29
typedef struct sx_preset_s
{
@ -79,7 +78,7 @@ typedef struct dly_s @@ -79,7 +78,7 @@ typedef struct dly_s
int *lpdelayline;
} dly_t;
const sx_preset_t rgsxpre[MAXPRESETS] =
const sx_preset_t rgsxpre[] =
{
// -------reverb-------- -------delay--------
// lp mod size refl rvblp delay feedback dlylp left
@ -116,7 +115,7 @@ const sx_preset_t rgsxpre[MAXPRESETS] = @@ -116,7 +115,7 @@ const sx_preset_t rgsxpre[MAXPRESETS] =
// 0x0045dca8 enginegl.exe
// SHA256: 42383d32cd712e59ee2c1bd78b7ba48814e680e7026c4223e730111f34a60d66
const sx_preset_t rgsxpre_hlalpha052[MAXPRESETS] =
const sx_preset_t rgsxpre_hlalpha052[] =
{
// -------reverb-------- -------delay--------
// lp mod size refl rvblp delay feedback dlylp left
@ -882,7 +881,7 @@ void CheckNewDspPresets( void ) @@ -882,7 +881,7 @@ void CheckNewDspPresets( void )
else idsp_room = room_type->value;
// don't pass invalid presets
idsp_room = bound( 0, idsp_room, MAXPRESETS - 1 );
idsp_room = bound( 0, idsp_room, MAX_ROOM_TYPES );
if( FBitSet( hisound->flags, FCVAR_CHANGED ))
{
@ -893,9 +892,6 @@ void CheckNewDspPresets( void ) @@ -893,9 +892,6 @@ void CheckNewDspPresets( void )
if( idsp_room == room_typeprev && idsp_room == 0 )
return;
if( idsp_room > MAX_ROOM_TYPES )
return;
if( idsp_room != room_typeprev )
{
const sx_preset_t *cur;

1
engine/client/s_main.c

@ -1155,7 +1155,6 @@ void S_RawSamples( uint samples, uint rate, word width, word channels, const byt @@ -1155,7 +1155,6 @@ void S_RawSamples( uint samples, uint rate, word width, word channels, const byt
int snd_vol = 128;
if( entnum < 0 ) snd_vol = 256; // bg track or movie track
if( snd_vol < 0 ) snd_vol = 0; // fixup negative values
S_RawEntSamples( entnum, samples, rate, width, channels, data, snd_vol );
}

Loading…
Cancel
Save