summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-07-29 12:27:00 +0000
committerTim Angus <tim@ngus.net>2013-01-10 22:36:34 +0000
commite7c06719510940898e1f7f8215f4137202611308 (patch)
tree0aec0bf91daa568d8cb4a1c412037ca26b2f92a6 /src/client
parent76544bcec46127587d183a90e5ff817a71e1f139 (diff)
Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_cgame.c8
-rw-r--r--src/client/cl_cin.c6
-rw-r--r--src/client/cl_input.c16
-rw-r--r--src/client/cl_main.c12
-rw-r--r--src/client/cl_scrn.c21
-rw-r--r--src/client/client.h2
-rw-r--r--src/client/snd_codec_wav.c3
-rw-r--r--src/client/snd_openal.c13
8 files changed, 22 insertions, 59 deletions
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 ; a<w ; a++)
{
- i = (current-1-a+1024) & 1023;
- v = values[i].value;
- color = values[i].color;
+ i = (ARRAY_LEN(values)+current-1-(a % ARRAY_LEN(values))) % ARRAY_LEN(values);
+ v = values[i];
v = v * cl_graphscale->integer + 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;
}