summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2020-03-29 14:45:05 +0100
committerIronClawTrem <louie.nutman@gmail.com>2020-03-29 14:45:05 +0100
commit4d46255e2317a9febdf36368496fa958056883e2 (patch)
treefba0c60b70c5616e7055ac142cdd7d22687fdc90 /src/cgame
parent0092faa58e55ee8fd29e2887573bffbb8c5d7faa (diff)
Fix compiler warnings
Mostly a metric ton of unused variables
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_attachment.c2
-rw-r--r--src/cgame/cg_draw.c35
-rw-r--r--src/cgame/cg_ents.c5
-rw-r--r--src/cgame/cg_playerstate.c5
-rw-r--r--src/cgame/cg_predict.c4
-rw-r--r--src/cgame/cg_view.c9
-rw-r--r--src/cgame/cg_weapons.c5
7 files changed, 14 insertions, 51 deletions
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( &cent->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;