From e7c06719510940898e1f7f8215f4137202611308 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Fri, 29 Jul 2011 12:27:00 +0000 Subject: Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings --- src/client/cl_cgame.c | 8 -------- src/client/cl_cin.c | 6 ------ src/client/cl_input.c | 16 +++------------- src/client/cl_main.c | 12 +++--------- src/client/cl_scrn.c | 21 ++++++--------------- src/client/client.h | 2 +- src/client/snd_codec_wav.c | 3 +-- src/client/snd_openal.c | 13 ++++++++----- 8 files changed, 22 insertions(+), 59 deletions(-) (limited to 'src/client') diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index 0425cbd6..7e1248a5 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -877,7 +877,6 @@ or bursted delayed packets. #define RESET_TIME 500 void CL_AdjustTimeDelta( void ) { - int resetTime; int newDelta; int deltaDelta; @@ -888,13 +887,6 @@ void CL_AdjustTimeDelta( void ) { return; } - // if the current time is WAY off, just correct to the current value - if ( com_sv_running->integer ) { - resetTime = 100; - } else { - resetTime = RESET_TIME; - } - newDelta = cl.snap.serverTime - cls.realtime; deltaDelta = abs( newDelta - cl.serverTimeDelta ); diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index 0628342a..8f6e82a2 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -938,10 +938,6 @@ static void setupQuad( long xOff, long yOff ) cin.oldysize = cinTable[currentHandle].ysize; cin.oldxsize = cinTable[currentHandle].xsize; - numQuadCels = (cinTable[currentHandle].CIN_WIDTH*cinTable[currentHandle].CIN_HEIGHT) / (16); - numQuadCels += numQuadCels/4 + numQuadCels/16; - numQuadCels += 64; // for overflow - numQuadCels = (cinTable[currentHandle].xsize*cinTable[currentHandle].ysize) / (16); numQuadCels += numQuadCels/4; numQuadCels += 64; // for overflow @@ -1611,7 +1607,6 @@ void CIN_DrawCinematic (int handle) { void CL_PlayCinematic_f(void) { char *arg, *s; - qboolean holdatend; int bits = CIN_system; Com_DPrintf("CL_PlayCinematic_f\n"); @@ -1622,7 +1617,6 @@ void CL_PlayCinematic_f(void) { arg = Cmd_Argv( 1 ); s = Cmd_Argv(2); - holdatend = qfalse; if ((s && s[0] == '1') || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) { bits |= CIN_hold; } diff --git a/src/client/cl_input.c b/src/client/cl_input.c index bae37cfe..e25c840d 100644 --- a/src/client/cl_input.c +++ b/src/client/cl_input.c @@ -280,10 +280,6 @@ void IN_CenterView (void) { //========================================================================== -cvar_t *cl_upspeed; -cvar_t *cl_forwardspeed; -cvar_t *cl_sidespeed; - cvar_t *cl_yawspeed; cvar_t *cl_pitchspeed; @@ -400,13 +396,9 @@ CL_JoystickMove ================= */ void CL_JoystickMove( usercmd_t *cmd ) { - int movespeed; float anglespeed; - if ( in_speed.active ^ cl_run->integer ) { - movespeed = 2; - } else { - movespeed = 1; + if ( !(in_speed.active ^ cl_run->integer) ) { cmd->buttons |= BUTTON_WALKING; } @@ -618,10 +610,10 @@ usercmd_t CL_CreateCmd( void ) { // draw debug graphs of turning for mouse testing if ( cl_debugMove->integer ) { if ( cl_debugMove->integer == 1 ) { - SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 ); + SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]) ); } if ( cl_debugMove->integer == 2 ) { - SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 ); + SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]) ); } } @@ -637,7 +629,6 @@ Create a new usercmd_t structure for this frame ================= */ void CL_CreateNewCommands( void ) { - usercmd_t *cmd; int cmdNum; // no need to create usercmds until we have a gamestate @@ -659,7 +650,6 @@ void CL_CreateNewCommands( void ) { cl.cmdNumber++; cmdNum = cl.cmdNumber & CMD_MASK; cl.cmds[cmdNum] = CL_CreateCmd (); - cmd = &cl.cmds[cmdNum]; } /* diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 80756007..b9742649 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -492,9 +492,7 @@ void CL_CaptureVoip(void) // try to get more audio data from the sound card... if (initialFrame) { - float gain = cl_voipGainDuringCapture->value; - if (gain < 0.0f) gain = 0.0f; else if (gain >= 1.0f) gain = 1.0f; - S_MasterGain(cl_voipGainDuringCapture->value); + S_MasterGain(Com_Clamp(0.0f, 1.0f, cl_voipGainDuringCapture->value)); S_StartCapture(); CL_VoipNewGeneration(); CL_VoipParseTargets(); @@ -634,9 +632,8 @@ CL_ChangeReliableCommand ====================== */ void CL_ChangeReliableCommand( void ) { - int r, index, l; + int index, l; - r = clc.reliableSequence - (random() * 5); index = clc.reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 ); l = strlen(clc.reliableCommands[ index ]); if ( l >= MAX_STRING_CHARS - 1 ) { @@ -3128,7 +3125,7 @@ void CL_Frame ( int msec ) { cls.realtime += cls.frametime; if ( cl_timegraph->integer ) { - SCR_DebugGraph ( cls.realFrametime * 0.25, 0 ); + SCR_DebugGraph ( cls.realFrametime * 0.25 ); } // see if we need to update any userinfo @@ -3910,10 +3907,8 @@ CL_GetServerStatus =================== */ serverStatus_t *CL_GetServerStatus( netadr_t from ) { - serverStatus_t *serverStatus; int i, oldest, oldestTime; - serverStatus = NULL; for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { if ( NET_CompareAdr( from, cl_serverStatusList[i].address ) ) { return &cl_serverStatusList[i]; @@ -4438,7 +4433,6 @@ qboolean CL_UpdateVisiblePings_f(int source) { if (slots < MAX_PINGREQUESTS) { serverInfo_t *server = NULL; - max = (source == AS_GLOBAL) ? MAX_GLOBAL_SERVERS : MAX_OTHER_SERVERS; switch (source) { case AS_LOCAL : server = &cls.localServers[0]; diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c index afafea25..1a7a34b4 100644 --- a/src/client/cl_scrn.c +++ b/src/client/cl_scrn.c @@ -376,25 +376,18 @@ DEBUG GRAPH =============================================================================== */ -typedef struct -{ - float value; - int color; -} graphsamp_t; - static int current; -static graphsamp_t values[1024]; +static float values[1024]; /* ============== SCR_DebugGraph ============== */ -void SCR_DebugGraph (float value, int color) +void SCR_DebugGraph (float value) { - values[current&1023].value = value; - values[current&1023].color = color; - current++; + values[current] = value; + current = (current + 1) % ARRAY_LEN(values); } /* @@ -406,7 +399,6 @@ void SCR_DrawDebugGraph (void) { int a, x, y, w, i, h; float v; - int color; // // draw the graph @@ -421,9 +413,8 @@ void SCR_DrawDebugGraph (void) for (a=0 ; ainteger + cl_graphshift->integer; if (v < 0) diff --git a/src/client/client.h b/src/client/client.h index 65ff9084..570a3dab 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -568,7 +568,7 @@ void CL_SaveConsoleHistory( void ); void SCR_Init (void); void SCR_UpdateScreen (void); -void SCR_DebugGraph (float value, int color); +void SCR_DebugGraph (float value); int SCR_GetBigStringWidth( const char *str ); // returns in virtual 640x480 coordinates diff --git a/src/client/snd_codec_wav.c b/src/client/snd_codec_wav.c index 140bc10d..8647e0da 100644 --- a/src/client/snd_codec_wav.c +++ b/src/client/snd_codec_wav.c @@ -132,7 +132,6 @@ S_ReadRIFFHeader static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info) { char dump[16]; - int wav_format; int bits; int fmtlen = 0; @@ -147,7 +146,7 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info) } // Save the parameters - wav_format = FGetLittleShort(file); + FGetLittleShort(file); // wav_format info->channels = FGetLittleShort(file); info->rate = FGetLittleLong(file); FGetLittleLong(file); diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 660525dd..28a7d2ee 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -246,8 +246,6 @@ S_AL_BufferUnload */ static void S_AL_BufferUnload(sfxHandle_t sfx) { - ALenum error; - if(knownSfx[sfx].filename[0] == '\0') return; @@ -257,7 +255,7 @@ static void S_AL_BufferUnload(sfxHandle_t sfx) // Delete it S_AL_ClearError( qfalse ); qalDeleteBuffers(1, &knownSfx[sfx].buffer); - if((error = qalGetError()) != AL_NO_ERROR) + if(qalGetError() != AL_NO_ERROR) Com_Printf( S_COLOR_RED "ERROR: Can't delete sound buffer for %s\n", knownSfx[sfx].filename); @@ -692,7 +690,6 @@ qboolean S_AL_SrcInit( void ) { int i; int limit; - ALenum error; // Clear the sources data structure memset(srcList, 0, sizeof(srcList)); @@ -711,7 +708,7 @@ qboolean S_AL_SrcInit( void ) for(i = 0; i < limit; i++) { qalGenSources(1, &srcList[i].alSource); - if((error = qalGetError()) != AL_NO_ERROR) + if(qalGetError() != AL_NO_ERROR) break; srcCount++; } @@ -2459,20 +2456,26 @@ qboolean S_AL_Init( soundInterface_t *si ) { char devicenames[16384] = ""; const char *devicelist; +#ifdef _WIN32 const char *defaultdevice; +#endif int curlen; // get all available devices + the default device name. if(enumeration_all_ext) { devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); +#ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); +#endif } else { // We don't have ALC_ENUMERATE_ALL_EXT but normal enumeration. devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER); +#ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); +#endif enumeration_ext = qtrue; } -- cgit