From 4d46255e2317a9febdf36368496fa958056883e2 Mon Sep 17 00:00:00 2001 From: IronClawTrem Date: Sun, 29 Mar 2020 14:45:05 +0100 Subject: Fix compiler warnings Mostly a metric ton of unused variables --- src/cgame/cg_attachment.c | 2 +- src/cgame/cg_draw.c | 35 +++++++++----------------------- src/cgame/cg_ents.c | 5 +++-- src/cgame/cg_playerstate.c | 5 ----- src/cgame/cg_predict.c | 4 ---- src/cgame/cg_view.c | 9 +-------- src/cgame/cg_weapons.c | 5 ----- src/game/bg_misc.c | 2 +- src/game/bg_slidemove.c | 4 ---- src/game/g_active.c | 10 ++-------- src/game/g_admin.c | 41 +++++++++++++++---------------------- src/game/g_buildable.c | 2 -- src/game/g_cmds.c | 12 +++++------ src/game/g_combat.c | 2 -- src/game/g_local.h | 2 +- src/game/g_main.c | 11 +--------- src/game/g_maprotation.c | 4 ++-- src/game/g_session.c | 4 ++-- src/game/g_weapon.c | 50 ++++++++++------------------------------------ src/ui/ui_main.c | 3 --- src/ui/ui_shared.c | 26 ++---------------------- 21 files changed, 57 insertions(+), 181 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_attachment.c b/src/cgame/cg_attachment.c index 0d3c8ea..3224159 100644 --- a/src/cgame/cg_attachment.c +++ b/src/cgame/cg_attachment.c @@ -371,7 +371,7 @@ void CG_SetAttachmentTag( attachment_t *a, refEntity_t parent, a->parent = parent; a->model = model; - strncpy( a->tagName, tagName, MAX_STRING_CHARS ); + strncpy( a->tagName, tagName, MAX_STRING_CHARS - 1 ); a->tagValid = qtrue; } diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 1a3ecae..e5e1894 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -862,7 +862,7 @@ static void CG_DrawPlayerPoisonBarbs( rectDef_t *rect, vec4_t color, qhandle_t s vertical = qtrue; iconsize = width; } - else if( height <= width ) + else { vertical = qfalse; iconsize = height; @@ -1270,7 +1270,7 @@ static void CG_DrawLoadingString( rectDef_t *rect, float text_x, float text_y, v return; strcpy( buffer, s ); - tw = CG_Text_Width( s, scale, 0 ); + CG_Text_Width( s, scale, 0 ); th = scale * 40.0f; pos = i = 0; @@ -1795,17 +1795,14 @@ CG_DrawTimerMins */ static void CG_DrawTimerMins( rectDef_t *rect, vec4_t color ) { - int mins, seconds; + int mins; int msec; if( !cg_drawTimer.integer ) return; msec = cg.time - cgs.levelStartTime; - - seconds = msec / 1000; - mins = seconds / 60; - seconds -= mins * 60; + mins = msec / 1000 / 60; trap_R_SetColor( color ); CG_DrawField( rect->x, rect->y, 3, rect->w / 3, rect->h, mins ); @@ -1820,17 +1817,14 @@ CG_DrawTimerSecs */ static void CG_DrawTimerSecs( rectDef_t *rect, vec4_t color ) { - int mins, seconds; + int seconds; int msec; if( !cg_drawTimer.integer ) return; msec = cg.time - cgs.levelStartTime; - - seconds = msec / 1000; - mins = seconds / 60; - seconds -= mins * 60; + seconds = msec / 1000 % 60; trap_R_SetColor( color ); CG_DrawFieldPadded( rect->x, rect->y, 2, rect->w / 2, rect->h, seconds ); @@ -1907,12 +1901,11 @@ static void CG_DrawClock( rectDef_t *rect, float text_x, float text_y, char *s; int i, tx, w, totalWidth, strLength; qtime_t qt; - int t; if( !cg_drawClock.integer ) return; - t = trap_RealTime( &qt ); + trap_RealTime( &qt ); if( cg_drawClock.integer == 2 ) { @@ -2910,10 +2903,6 @@ CG_DrawLighting */ static void CG_DrawLighting( void ) { - centity_t *cent; - - cent = &cg_entities[ cg.snap->ps.clientNum ]; - //fade to black if stamina is low if( ( cg.snap->ps.stats[ STAT_STAMINA ] < -800 ) && ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ) @@ -3113,7 +3102,6 @@ static void CG_DrawTeamVote( void ) static qboolean CG_DrawScoreboard( void ) { static qboolean firstTime = qtrue; - float fade, *fadeColor; if( menuScoreboard ) menuScoreboard->window.flags &= ~WINDOW_FORCED; @@ -3125,13 +3113,8 @@ static qboolean CG_DrawScoreboard( void ) return qfalse; } - if( cg.showScores || - cg.predictedPlayerState.pm_type == PM_INTERMISSION ) - { - fade = 1.0; - fadeColor = colorWhite; - } - else + if( !cg.showScores && + cg.predictedPlayerState.pm_type != PM_INTERMISSION ) { cg.deferredPlayerLoading = 0; cg.killerName[ 0 ] = 0; diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 61b1acf..25321e6 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -844,7 +844,7 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int { centity_t *cent; vec3_t oldOrigin, origin, deltaOrigin; - vec3_t oldAngles, angles, deltaAngles; + vec3_t oldAngles, angles; if( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) { @@ -867,7 +867,6 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int BG_EvaluateTrajectory( ¢->currentState.apos, toTime, angles ); VectorSubtract( origin, oldOrigin, deltaOrigin ); - VectorSubtract( angles, oldAngles, deltaAngles ); VectorAdd( in, deltaOrigin, out ); @@ -957,8 +956,10 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) { if( cg_projectileNudge.integer == 1 ) + { if( cg_unlagged.integer && !cg.demoPlayback ) timeshift = cg.ping; + } else if ( cg_projectileNudge.integer == 2 ) timeshift = cg.ping; else diff --git a/src/cgame/cg_playerstate.c b/src/cgame/cg_playerstate.c index e1bcb09..7749f59 100644 --- a/src/cgame/cg_playerstate.c +++ b/src/cgame/cg_playerstate.c @@ -245,8 +245,6 @@ CG_CheckLocalSounds */ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { - int reward; - // don't play the sounds if the player just changed teams if( ps->persistant[ PERS_TEAM ] != ops->persistant[ PERS_TEAM ] ) return; @@ -262,9 +260,6 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) // if we are going into the intermission, don't start any voices if( cg.intermissionStarted ) return; - - // reward sounds - reward = qfalse; } diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index 03442ed..c8e8a33 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -551,7 +551,6 @@ void CG_PredictPlayerState( void ) { int cmdNum, current, i; playerState_t oldPlayerState; - qboolean moved; usercmd_t oldestCmd; usercmd_t latestCmd; int stateIndex = 0, predictCmd = 0; @@ -738,7 +737,6 @@ void CG_PredictPlayerState( void ) } // run cmds - moved = qfalse; for( cmdNum = current - CMD_BACKUP + 1; cmdNum <= current; cmdNum++ ) { @@ -857,8 +855,6 @@ void CG_PredictPlayerState( void ) stateIndex = ( stateIndex + 1 ) % NUM_SAVED_STATES; } - moved = qtrue; - // add push trigger movement effects CG_TouchTriggerPrediction( ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 6201a91..33a9c97 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -409,7 +409,7 @@ static void CG_OffsetFirstPersonView( void ) vec3_t predictedVelocity; int timeDelta; float bob2; - vec3_t normal, baseOrigin; + vec3_t normal; playerState_t *ps = &cg.predictedPlayerState; if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) @@ -429,8 +429,6 @@ static void CG_OffsetFirstPersonView( void ) origin = cg.refdef.vieworg; angles = cg.refdefViewAngles; - VectorCopy( origin, baseOrigin ); - // if dead, fix the angle and don't add any kick if( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 ) { @@ -562,7 +560,6 @@ static void CG_OffsetFirstPersonView( void ) usercmd_t cmd; int cmdNum; float fFraction, rFraction, uFraction; - float fFraction2, rFraction2, uFraction2; cmdNum = trap_GetCurrentCmdNumber(); trap_GetUserCmd( cmdNum, &cmd ); @@ -580,10 +577,6 @@ static void CG_OffsetFirstPersonView( void ) if( uFraction > 1.0f ) uFraction = 1.0f; - fFraction2 = -sin( fFraction * M_PI / 2 ); - rFraction2 = -sin( rFraction * M_PI / 2 ); - uFraction2 = -sin( uFraction * M_PI / 2 ); - if( cmd.forwardmove > 0 ) VectorMA( origin, STRUGGLE_DIST * fFraction, forward, origin ); else if( cmd.forwardmove < 0 ) diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 2f437f0..d919b61 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1188,14 +1188,9 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) int length; int selectWindow; qboolean vertical; - centity_t *cent; - playerState_t *ps; int colinfo[ 64 ]; - cent = &cg_entities[ cg.snap->ps.clientNum ]; - ps = &cg.snap->ps; - // don't display if dead if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) return; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index fd50509..cb41601 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4964,7 +4964,7 @@ Check if a weapon has full ammo */ qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips ) { - int maxAmmo, maxClips; + int maxAmmo = 0, maxClips = 0; BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); diff --git a/src/game/bg_slidemove.c b/src/game/bg_slidemove.c index aa32a6a..646475e 100644 --- a/src/game/bg_slidemove.c +++ b/src/game/bg_slidemove.c @@ -290,7 +290,6 @@ PM_StepSlideMove qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive ) { vec3_t start_o, start_v; - vec3_t down_o, down_v; trace_t trace; vec3_t normal; vec3_t step_v, step_vNormal; @@ -339,9 +338,6 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive ) return stepped; } - VectorCopy( pm->ps->origin, down_o ); - VectorCopy( pm->ps->velocity, down_v ); - VectorCopy( start_o, up ); VectorMA( up, STEPSIZE, normal, up ); diff --git a/src/game/g_active.c b/src/game/g_active.c index a6f246c..1dd27f4 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -574,8 +574,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) usercmd_t *ucmd; int aForward, aRight; qboolean walking = qfalse, stopped = qfalse, - crouched = qfalse, jumping = qfalse, - strafing = qfalse; + crouched = qfalse; ucmd = &ent->client->pers.cmd; @@ -601,12 +600,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) else if( aForward <= 64 && aRight <= 64 ) walking = qtrue; - if( aRight > 0 ) - strafing = qtrue; - - if( ucmd->upmove > 0 ) - jumping = qtrue; - else if( ent->client->ps.pm_flags & PMF_DUCKED ) + if( ent->client->ps.pm_flags & PMF_DUCKED ) crouched = qtrue; while ( client->time100 >= 100 ) diff --git a/src/game/g_admin.c b/src/game/g_admin.c index de9f7fe..9ae3faf 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -704,7 +704,6 @@ void admin_writeconfig( void ) fileHandle_t f; int len, i; int t, expiretime; - char levels[ MAX_STRING_CHARS ] = {""}; if( !g_admin.string[ 0 ] ) { @@ -793,7 +792,6 @@ void admin_writeconfig( void ) } for( i = 0; i < MAX_ADMIN_COMMANDS && g_admin_commands[ i ]; i++ ) { - levels[ 0 ] = '\0'; trap_FS_Write( "[command]\n", 10, f ); trap_FS_Write( "command = ", 10, f ); admin_writeconfig_string( g_admin_commands[ i ]->command, f ); @@ -1187,7 +1185,7 @@ static int admin_listadmins( gentity_t *ent, int start, char *search, int minlev { G_DecolorString( g_admin_levels[ j ]->name, lname ); Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", - ( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) + (int)( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) - strlen( lname ) ) ); Com_sprintf( lname, sizeof( lname ), lname_fmt, g_admin_levels[ j ]->name ); @@ -1251,7 +1249,7 @@ static int admin_listadmins( gentity_t *ent, int start, char *search, int minlev { G_DecolorString( g_admin_levels[ j ]->name, lname ); Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", - ( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) + (int)( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) - strlen( lname ) ) ); Com_sprintf( lname, sizeof( lname ), lname_fmt, g_admin_levels[ j ]->name ); @@ -1995,9 +1993,8 @@ qboolean G_admin_readconfig( gentity_t *ent, int skiparg ) qboolean G_admin_time( gentity_t *ent, int skiparg ) { qtime_t qt; - int t; - t = trap_RealTime( &qt ); + trap_RealTime( &qt ); ADMP( va( "^3!time: ^7local time is %02i:%02i:%02i\n", qt.tm_hour, qt.tm_min, qt.tm_sec ) ); @@ -3909,7 +3906,7 @@ qboolean G_admin_adminlog( gentity_t *ent, int skiparg ) t = results[ i ]->time / 1000; G_DecolorString( results[ i ]->name, n1 ); Com_sprintf( fmt_name, sizeof( fmt_name ), "%%%ds", - ( name_length + strlen( results[ i ]->name ) - strlen( n1 ) ) ); + (int)( name_length + strlen( results[ i ]->name ) - strlen( n1 ) ) ); Com_sprintf( n1, sizeof( n1 ), fmt_name, results[ i ]->name ); Com_sprintf( levelbuf, sizeof( levelbuf ), "%2d", results[ i ]->level ); ADMBP( va( "%s%3d %3d:%02d %2s ^7%s^7 %s!%s ^7%s^7\n", @@ -4329,7 +4326,6 @@ qboolean G_admin_mute( gentity_t *ent, int skiparg ) qboolean G_admin_cp( gentity_t *ent, int skiparg ) { int minargc; - char *s; minargc = 2 + skiparg; @@ -4339,7 +4335,6 @@ qboolean G_admin_cp( gentity_t *ent, int skiparg ) return qfalse; } - s = G_SayConcatArgs( 1 + skiparg ); G_CP(ent); return qtrue; } @@ -5396,12 +5391,12 @@ qboolean G_admin_showbans( gentity_t *ent, int skiparg ) G_DecolorString( g_admin_bans[ i ]->name, n1 ); Com_sprintf( name_fmt, sizeof( name_fmt ), "%%%is", - ( max_name + strlen( g_admin_bans[ i ]->name ) - strlen( n1 ) ) ); + (int)( max_name + strlen( g_admin_bans[ i ]->name ) - strlen( n1 ) ) ); Com_sprintf( n1, sizeof( n1 ), name_fmt, g_admin_bans[ i ]->name ); G_DecolorString( g_admin_bans[ i ]->banner, n2 ); Com_sprintf( banner_fmt, sizeof( banner_fmt ), "%%%is", - ( max_banner + strlen( g_admin_bans[ i ]->banner ) - strlen( n2 ) ) ); + (int)( max_banner + strlen( g_admin_bans[ i ]->banner ) - strlen( n2 ) ) ); Com_sprintf( n2, sizeof( n2 ), banner_fmt, g_admin_bans[ i ]->banner ); bannerslevel = g_admin_bans[ i ]->bannerlevel; @@ -5983,7 +5978,7 @@ qboolean G_admin_register(gentity_t *ent, int skiparg ){ return qfalse; } - trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;",ent - g_entities, level) ); + trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;",(int)(ent - g_entities), level) ); AP( va( "print \"^3!register: ^7%s^7 is now a protected nickname.\n\"", ent->client->pers.netname) ); @@ -7077,7 +7072,7 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg ) Com_sprintf( argbuf, sizeof argbuf, "%s%s%s%s%s%s%s!", ( repeat > 1 ) ? "x" : "", ( repeat > 1 ) ? va( "%d ", repeat ) : "", ( ID ) ? "#" : "", ( ID ) ? va( "%d ", ptr->ID ) : "", - ( builder ) ? "-" : "", ( builder ) ? va( "%d ", builder - g_entities ) : "", + ( builder ) ? "-" : "", ( builder ) ? va( "%d ", (int)( builder - g_entities ) ) : "", ( team == PTE_ALIENS ) ? "a " : ( team == PTE_HUMANS ) ? "h " : "" ); ADMP( va( "^3!revert: ^7revert aborted: reverting this %s would conflict with " "another buildable, use ^3!revert %s ^7to override\n", action, argbuf ) ); @@ -7132,7 +7127,7 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg ) Com_sprintf( argbuf, sizeof argbuf, "%s%s%s%s%s%s%s!", ( repeat > 1 ) ? "x" : "", ( repeat > 1 ) ? va( "%d ", repeat ) : "", ( ID ) ? "#" : "", ( ID ) ? va( "%d ", ptr->ID ) : "", - ( builder ) ? "-" : "", ( builder ) ? va( "%d ", builder - g_entities ) : "", + ( builder ) ? "-" : "", ( builder ) ? va( "%d ", (int)( builder - g_entities ) ) : "", ( team == PTE_ALIENS ) ? "a " : ( team == PTE_HUMANS ) ? "h " : "" ); ADMP( va( "^3!revert: ^7revert aborted: reverting this %s would " "conflict with another buildable, use ^3!revert %s ^7to override\n", @@ -7476,7 +7471,7 @@ qboolean G_admin_L0(gentity_t *ent, int skiparg ){ qboolean G_admin_L1(gentity_t *ent, int skiparg ){ int pids[ MAX_CLIENTS ]; - char name[ MAX_NAME_LENGTH ], *reason, err[ MAX_STRING_CHARS ]; + char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ]; int minargc; minargc = 2 + skiparg; @@ -7487,7 +7482,6 @@ qboolean G_admin_L1(gentity_t *ent, int skiparg ){ return qfalse; } G_SayArgv( 1 + skiparg, name, sizeof( name ) ); - reason = G_SayConcatArgs( 2 + skiparg ); if( G_ClientNumbersFromString( name, pids ) != 1 ) { G_MatchOnePlayer( pids, err, sizeof( err ) ); @@ -7535,12 +7529,9 @@ qboolean G_admin_invisible( gentity_t *ent, int skiparg ) qboolean G_admin_decon( gentity_t *ent, int skiparg ) { - int i = 0, j = 0, repeat = 24, pids[ MAX_CLIENTS ], len, matchlen = 0; - pTeam_t team = PTE_NONE; - qboolean force = qfalse, reached = qfalse; - gentity_t *builder = NULL, *targ; - buildHistory_t *ptr, *tmp, *mark, *prev; - vec3_t dist; + int repeat = 24, pids[ MAX_CLIENTS ], len, matchlen = 0; + gentity_t *builder = NULL; + buildHistory_t *ptr, *tmp, *prev; char arg[ 64 ], err[ MAX_STRING_CHARS ], *name, *bname, *action, *article, *reason; len = G_CountBuildLog( ); @@ -7578,7 +7569,7 @@ qboolean G_admin_decon( gentity_t *ent, int skiparg ) return qfalse; } - for( i = 0, ptr = prev = level.buildHistory; repeat > 0; repeat--, j = 0 ) + for( ptr = prev = level.buildHistory; repeat > 0; repeat-- ) { if( !ptr ) break; @@ -7678,7 +7669,7 @@ qboolean G_admin_decon( gentity_t *ent, int skiparg ) admin_writeconfig(); trap_SendServerCommand( pids[ 0 ], - va( "disconnect \"You have been kicked.\n%s^7\nreason:\n%s\n%s\"", + va( "disconnect \"You have been kicked.\n%s^7\nreason:\n%s\"", ( ent ) ? va( "admin:\n%s", G_admin_adminPrintName( ent ) ) : "admin\nconsole", ( *reason ) ? reason : "^1Decon" ) ); @@ -8526,7 +8517,7 @@ qboolean G_admin_switch( gentity_t *ent, int skiparg ) qboolean G_admin_drug( gentity_t *ent, int skiparg ) { - int pids[ MAX_CLIENTS ], found; + int pids[ MAX_CLIENTS ]; char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ]; int minargc; gentity_t *vic; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 30b9d20..c685606 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -3370,7 +3370,6 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance qboolean invert; int contents; playerState_t *ps = &ent->client->ps; - int buildPoints; gentity_t *tmp; itemBuildError_t tempReason; @@ -3398,7 +3397,6 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance reason = IBE_NORMAL; contents = trap_PointContents( entity_origin, -1 ); - buildPoints = BG_FindBuildPointsForBuildable( buildable ); //check if we are near a nobuild marker, if so, can't build here... for( i = 0; i < MAX_GENTITIES; i++ ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 764623b..a9e7daa 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2374,9 +2374,10 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) Q_CleanStr( name ); if( G_admin_permission( &g_entities[ clientNum ], ADMF_IMMUNITY ) ) { - char reasonprint[ MAX_STRING_CHARS ] = ""; - if( reason[ 0 ] != '\0' ) - Com_sprintf(reasonprint, sizeof(reasonprint), "With reason: %s", reason); + char reasonprint[ MAX_STRING_CHARS ] = {0}; + + if( reason[ 0 ] != '\0' ) + Com_sprintf(reasonprint, sizeof(reasonprint), "With reason: %s", reason); Com_sprintf( message, sizeof( message ), "%s^7 attempted /callteamvote %s %s on immune admin %s^7 %s^7", ent->client->pers.netname, arg1, arg2, g_entities[ clientNum ].client->pers.netname, reasonprint ); @@ -5043,8 +5044,7 @@ static void Cmd_Ignore_f( gentity_t *ent ) return; } - if( g_floodMinTime.integer ) - if ( G_Flood_Limited( ent ) ) + if( g_floodMinTime.integer && G_Flood_Limited( ent ) ) { trap_SendServerCommand( ent-g_entities, "print \"Your chat is flood-limited; wait before chatting again\n\"" ); return; @@ -5607,7 +5607,7 @@ void G_PrivateMessage( gentity_t *ent ) matches, color, msg, - ent ? ent-g_entities : -1 ) ); + ent ? (int)(ent-g_entities) : -1 ) ); trap_SendServerCommand( pids[ i ], va( "cp \"^%cprivate message from ^7%s^7\"", color, diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 85880ef..aef76d1 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1156,7 +1156,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, { gclient_t *client; int take; - int save; int asave = 0; int knockback = 0; float damagemodifier=0.0; @@ -1353,7 +1352,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } take = damage; - save = 0; // add to the damage inflicted on a player this frame // the total will be turned into screen blends and view angle kicks diff --git a/src/game/g_local.h b/src/game/g_local.h index b5e6e8c..ded4d63 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1304,7 +1304,7 @@ connectionRecord_t *G_FindConnectionForCode( int code ); extern level_locals_t level; extern gentity_t g_entities[ MAX_GENTITIES ]; -#define FOFS(x) ((int)&(((gentity_t *)0)->x)) +#define FOFS(x) ((intptr_t)&(((gentity_t *)0)->x)) extern vmCvar_t g_dedicated; extern vmCvar_t g_cheats; diff --git a/src/game/g_main.c b/src/game/g_main.c index bffbdf7..9bf9b38 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -774,15 +774,13 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { char serverinfo[ MAX_INFO_STRING ]; qtime_t qt; - int t; - trap_GetServerinfo( serverinfo, sizeof( serverinfo ) ); G_LogPrintf( "------------------------------------------------------------\n" ); G_LogPrintf( "InitGame: %s\n", serverinfo ); - t = trap_RealTime( &qt ); + trap_RealTime( &qt ); G_LogPrintf("RealTime: %04i/%02i/%02i %02i:%02i:%02i\n", qt.tm_year+1900, qt.tm_mon+1, qt.tm_mday, qt.tm_hour, qt.tm_min, qt.tm_sec ); @@ -2873,7 +2871,6 @@ void G_RunFrame( int levelTime ) int i; gentity_t *ent; int msec; - int start, end; // if we are waiting for the level to restart, do nothing if( level.restarted ) @@ -2910,7 +2907,6 @@ void G_RunFrame( int levelTime ) // // go through all allocated objects // - start = trap_Milliseconds( ); ent = &g_entities[ 0 ]; for( i = 0; i < level.num_entities; i++, ent++ ) @@ -2989,9 +2985,6 @@ void G_RunFrame( int levelTime ) G_RunThink( ent ); } - end = trap_Milliseconds(); - - start = trap_Milliseconds(); // perform final fixups on the players ent = &g_entities[ 0 ]; @@ -3005,8 +2998,6 @@ void G_RunFrame( int levelTime ) // save position information for all active clients G_UnlaggedStore( ); - end = trap_Milliseconds(); - //TA: G_CountSpawns( ); G_CalculateBuildPoints( ); diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index a846c79..64822a2 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -1101,10 +1101,10 @@ static int G_GetMapVoteWinner( int *winvotes, int *totalvotes, int *resultorder qboolean G_IntermissionMapVoteWinner( void ) { - int winner, winvotes, totalvotes; + int winvotes, totalvotes; int nonvotes; - winner = G_GetMapVoteWinner( &winvotes, &totalvotes, NULL ); + G_GetMapVoteWinner( &winvotes, &totalvotes, NULL ); if( winvotes * 2 > level.numConnectedClients ) return qtrue; nonvotes = level.numConnectedClients - totalvotes; diff --git a/src/game/g_session.c b/src/game/g_session.c index ef78e8a..5fdf5b8 100644 --- a/src/game/g_session.c +++ b/src/game/g_session.c @@ -59,7 +59,7 @@ void G_WriteClientSessionData( gclient_t *client ) BG_ClientListString( &client->sess.ignoreList ) ); - var = va( "session%i", client - level.clients ); + var = va( "session%i", (int)(client - level.clients) ); trap_Cvar_Set( var, s ); } @@ -83,7 +83,7 @@ void G_ReadSessionData( gclient_t *client ) int restartTeam; int invisible; - var = va( "session%i", client - level.clients ); + var = va( "session%i", (int)(client - level.clients) ); trap_Cvar_VariableStringBuffer( var, s, sizeof(s) ); // FIXME: should be using BG_ClientListParse() for ignoreList, but diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 00e8eab..e50594a 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -451,11 +451,7 @@ LOCKBLOB void lockBlobLauncherFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_lockblob( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_lockblob( ent, muzzle, forward ); } /* @@ -468,11 +464,7 @@ HIVE void hiveFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_hive( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_hive( ent, muzzle, forward ); } /* @@ -485,11 +477,7 @@ BLASTER PISTOL void blasterFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_blaster( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_blaster( ent, muzzle, forward ); } /* @@ -502,11 +490,7 @@ PULSE RIFLE void pulseRifleFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_pulseRifle( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_pulseRifle( ent, muzzle, forward ); } /* @@ -519,9 +503,7 @@ FLAME THROWER void flamerFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_flamer( ent, muzzle, forward ); + fire_flamer( ent, muzzle, forward ); } /* @@ -534,9 +516,7 @@ GRENADE void throwGrenade( gentity_t *ent ) { - gentity_t *m; - - m = launch_grenade( ent, muzzle, forward ); + launch_grenade( ent, muzzle, forward ); } /* @@ -666,17 +646,15 @@ LCChargeFire */ void LCChargeFire( gentity_t *ent, qboolean secondary ) { - gentity_t *m; - if( secondary ) { - m = fire_luciferCannon( ent, muzzle, forward, LCANNON_SECONDARY_DAMAGE, + fire_luciferCannon( ent, muzzle, forward, LCANNON_SECONDARY_DAMAGE, LCANNON_SECONDARY_RADIUS ); ent->client->ps.weaponTime = LCANNON_REPEAT; } else { - m = fire_luciferCannon( ent, muzzle, forward, ent->client->ps.stats[ STAT_MISC ], LCANNON_RADIUS ); + fire_luciferCannon( ent, muzzle, forward, ent->client->ps.stats[ STAT_MISC ], LCANNON_RADIUS ); ent->client->ps.weaponTime = LCANNON_CHARGEREPEAT; } @@ -856,11 +834,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu ) void slowBlobFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_slowBlob( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_slowBlob( ent, muzzle, forward ); } @@ -1421,11 +1395,7 @@ qboolean CheckPounceAttack( gentity_t *ent ) void bounceBallFire( gentity_t *ent ) { - gentity_t *m; - - m = fire_bounceBall( ent, muzzle, forward ); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics + fire_bounceBall( ent, muzzle, forward ); } diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index e2396a9..d74dd9d 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -5523,7 +5523,6 @@ UI_Init */ void _UI_Init( qboolean inGameLoad ) { const char *menuSet; - int start; BG_InitClassOverrides( ); BG_InitAllowedGameElements( ); @@ -5609,8 +5608,6 @@ void _UI_Init( qboolean inGameLoad ) { AssetCache(); - start = trap_Milliseconds(); - uiInfo.teamCount = 0; uiInfo.characterCount = 0; uiInfo.aliasCount = 0; diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 5640e0e..c5991b7 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1549,12 +1549,8 @@ int Item_Slider_OverSlider(itemDef_t *item, float x, float y) { int Item_ListBox_OverLB(itemDef_t *item, float x, float y) { rectDef_t r; - listBoxDef_t *listPtr; int thumbstart; - int count; - count = DC->feederCount(item->special); - listPtr = (listBoxDef_t*)item->typeData; if (item->window.flags & WINDOW_HORIZONTAL) { // check if on left arrow r.x = item->window.rect.x; @@ -3644,11 +3640,9 @@ void BindingFromName(const char *cvar) { void Item_Slider_Paint(itemDef_t *item) { vec4_t newColor; - float x, y, value; + float x, y; menuDef_t *parent = (menuDef_t*)item->parent; - value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0; - if (item->window.flags & WINDOW_HASFOCUS) { /* lowLight[0] = 0.8 * parent->focusColor[0]; lowLight[1] = 0.8 * parent->focusColor[1]; @@ -3677,7 +3671,7 @@ void Item_Slider_Paint(itemDef_t *item) { } void Item_Bind_Paint(itemDef_t *item) { - vec4_t newColor, lowLight; + vec4_t newColor; float value; int maxChars = 0; menuDef_t *parent = (menuDef_t*)item->parent; @@ -3689,19 +3683,6 @@ void Item_Bind_Paint(itemDef_t *item) { value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0; if (item->window.flags & WINDOW_HASFOCUS) { - if (g_bindItem == item) { - lowLight[0] = 0.8f * 1.0f; - lowLight[1] = 0.8f * 0.0f; - lowLight[2] = 0.8f * 0.0f; - lowLight[3] = 0.8f * 1.0f; - } else { - lowLight[0] = 0.8f * parent->focusColor[0]; - lowLight[1] = 0.8f * parent->focusColor[1]; - lowLight[2] = 0.8f * parent->focusColor[2]; - lowLight[3] = 0.8f * parent->focusColor[3]; - } - /*LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ - //TA: memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); @@ -4099,12 +4080,9 @@ void Item_ListBox_Paint(itemDef_t *item) { void Item_OwnerDraw_Paint(itemDef_t *item) { - menuDef_t *parent; - if (item == NULL) { return; } - parent = (menuDef_t*)item->parent; if (DC->ownerDrawItem) { vec4_t color, lowLight; -- cgit