diff --git a/cmake/compilers/msvc.cmake b/cmake/compilers/msvc.cmake index 00320049..6f3a2d75 100644 --- a/cmake/compilers/msvc.cmake +++ b/cmake/compilers/msvc.cmake @@ -29,6 +29,15 @@ add_compile_options("$<$:/W4>") # There are way too many of these to realistically deal with them add_compile_options("$<$:/wd4267>") +# C4206: nonstandard extension used: translation unit is empty +add_compile_options("$<$:/wd4206>") + +# C4324: 'struct': structure was padded due to alignment specifier +add_compile_options("$<$:/wd4324>") + +# C4200: nonstandard extension used: zero-sized array in struct/union +add_compile_options("$<$:/wd4200>") + # MSVC doesn't understand __inline__, which libjpeg uses add_compile_definitions(__inline__=inline) diff --git a/cmake/tools/CMakeLists.txt b/cmake/tools/CMakeLists.txt index d4251039..a3a58886 100644 --- a/cmake/tools/CMakeLists.txt +++ b/cmake/tools/CMakeLists.txt @@ -65,13 +65,18 @@ set(LBURG_SOURCES ) add_executable(q3asm ${Q3ASM_SOURCES}) -target_compile_options(q3asm PRIVATE -fno-strict-aliasing) set_output_dirs(q3asm) add_executable(q3lcc ${Q3LCC_SOURCES}) -target_compile_options(q3asm PRIVATE -fno-strict-aliasing) set_output_dirs(q3lcc) add_dependencies(q3lcc q3rcc q3cpp) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang$") + add_compile_options(-fno-strict-aliasing -Wno-unused-result + -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast) +elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + add_compile_options(/wd4311 /wd4312) +endif() + add_executable(lburg ${LBURG_SOURCES}) set_output_dirs(lburg) set(DAGCHECK_C ${CMAKE_BINARY_DIR}/dagcheck.c) diff --git a/code/botlib/be_ai_char.c b/code/botlib/be_ai_char.c index b839cd6b..2bf668e7 100644 --- a/code/botlib/be_ai_char.c +++ b/code/botlib/be_ai_char.c @@ -247,7 +247,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) return NULL; } //end if //if it's the correct skill - if (skill < 0 || token.intvalue == skill) + if (skill < 0 || (int)token.intvalue == skill) { foundcharacter = qtrue; ch->skill = token.intvalue; diff --git a/code/botlib/l_script.c b/code/botlib/l_script.c index c2c59d09..dfa3a002 100644 --- a/code/botlib/l_script.c +++ b/code/botlib/l_script.c @@ -356,7 +356,7 @@ int PS_ReadWhiteSpace(script_t *script) //============================================================================ int PS_ReadEscapeCharacter(script_t *script, char *ch) { - int c, val, i; + int c, val; //step over the leading '\\' script->script_p++; @@ -377,7 +377,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch) case 'x': { script->script_p++; - for (i = 0, val = 0; ; i++, script->script_p++) + for (val = 0; ; script->script_p++) { c = *script->script_p; if (c >= '0' && c <= '9') c = c - '0'; @@ -398,7 +398,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch) default: //NOTE: decimal ASCII code, NOT octal { if (*script->script_p < '0' || *script->script_p > '9') ScriptError(script, "unknown escape char"); - for (i = 0, val = 0; ; i++, script->script_p++) + for (val = 0; ; script->script_p++) { c = *script->script_p; if (c >= '0' && c <= '9') c = c - '0'; diff --git a/code/cgame/cg_newdraw.c b/code/cgame/cg_newdraw.c index ecb230f8..4eca2fdf 100644 --- a/code/cgame/cg_newdraw.c +++ b/code/cgame/cg_newdraw.c @@ -99,8 +99,10 @@ void CG_CheckOrderPending(void) { } if (cg_currentSelectedPlayer.integer == numSortedTeamPlayers) { - // to everyone - trap_SendConsoleCommand(va("cmd vsay_team %s\n", p2)); + if (p2) { + // to everyone + trap_SendConsoleCommand(va("cmd vsay_team %s\n", p2)); + } } else { // for the player self if (sortedTeamPlayers[cg_currentSelectedPlayer.integer] == cg.snap->ps.clientNum && p1) { diff --git a/code/cgame/cg_particles.c b/code/cgame/cg_particles.c index 2c70281f..6bccb70a 100644 --- a/code/cgame/cg_particles.c +++ b/code/cgame/cg_particles.c @@ -574,12 +574,12 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) { vec3_t rr, ru; vec3_t rotate_ang; - float alpha; + float pAlpha; - alpha = p->alpha; + pAlpha = p->alpha; if ( cgs.glconfig.hardwareType == GLHW_RAGEPRO ) - alpha = 1; + pAlpha = 1; if (p->roll) { @@ -601,7 +601,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) verts[0].modulate[0] = 111; verts[0].modulate[1] = 19; verts[0].modulate[2] = 9; - verts[0].modulate[3] = 255 * alpha; + verts[0].modulate[3] = 255 * pAlpha; VectorMA (org, -p->height, ru, point); VectorMA (point, p->width, rr, point); @@ -611,7 +611,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) verts[1].modulate[0] = 111; verts[1].modulate[1] = 19; verts[1].modulate[2] = 9; - verts[1].modulate[3] = 255 * alpha; + verts[1].modulate[3] = 255 * pAlpha; VectorMA (org, p->height, ru, point); VectorMA (point, p->width, rr, point); @@ -621,7 +621,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) verts[2].modulate[0] = 111; verts[2].modulate[1] = 19; verts[2].modulate[2] = 9; - verts[2].modulate[3] = 255 * alpha; + verts[2].modulate[3] = 255 * pAlpha; VectorMA (org, p->height, ru, point); VectorMA (point, -p->width, rr, point); @@ -631,7 +631,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) verts[3].modulate[0] = 111; verts[3].modulate[1] = 19; verts[3].modulate[2] = 9; - verts[3].modulate[3] = 255 * alpha; + verts[3].modulate[3] = 255 * pAlpha; } else if (p->type == P_FLAT_SCALEUP) diff --git a/code/client/cl_avi.c b/code/client/cl_avi.c index 00cf7b1d..ef5456c1 100644 --- a/code/client/cl_avi.c +++ b/code/client/cl_avi.c @@ -79,9 +79,9 @@ static int bufIndex; SafeFS_Write =============== */ -static ID_INLINE void SafeFS_Write( const void *buffer, int len, fileHandle_t f ) +static ID_INLINE void SafeFS_Write( const void *buf, int len, fileHandle_t f ) { - if( FS_Write( buffer, len, f ) < len ) + if( FS_Write( buf, len, f ) < len ) Com_Error( ERR_DROP, "Failed to write avi file" ); } diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c index cdc3ab3e..67fb988b 100644 --- a/code/client/cl_cin.c +++ b/code/client/cl_cin.c @@ -934,7 +934,9 @@ static void setupQuad( long xOff, long yOff ) long numQuadCels, i,x,y; byte *temp; - if (xOff == cin.oldXOff && yOff == cin.oldYOff && cinTable[currentHandle].ysize == cin.oldysize && cinTable[currentHandle].xsize == cin.oldxsize) { + if (xOff == cin.oldXOff && yOff == cin.oldYOff && + (long)cinTable[currentHandle].ysize == cin.oldysize && + (long)cinTable[currentHandle].xsize == cin.oldxsize) { return; } diff --git a/code/client/cl_http_curl.c b/code/client/cl_http_curl.c index 1ed34833..ae490c50 100644 --- a/code/client/cl_http_curl.c +++ b/code/client/cl_http_curl.c @@ -103,7 +103,7 @@ static void *GPA(char *str) CL_HTTP_Init ================= */ -qboolean CL_HTTP_Init() +qboolean CL_HTTP_Init(void) { if(cURLLib) return qtrue; @@ -158,7 +158,7 @@ qboolean CL_HTTP_Init() CL_HTTP_Available ================= */ -qboolean CL_HTTP_Available() +qboolean CL_HTTP_Available(void) { return cURLLib != NULL; } diff --git a/code/client/cl_http_windows.c b/code/client/cl_http_windows.c index d098f9e6..9a6b6f75 100644 --- a/code/client/cl_http_windows.c +++ b/code/client/cl_http_windows.c @@ -104,7 +104,7 @@ void CL_HTTP_BeginDownload(const char *remoteURL) BOOL success; hUrl = InternetOpenUrlA(hInternet, remoteURL, - va("Referer: ioQ3://%s\r\n", NET_AdrToString(clc.serverAddress)), -1, + va("Referer: ioQ3://%s\r\n", NET_AdrToString(clc.serverAddress)), (DWORD)-1, INTERNET_FLAG_HYPERLINK | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_COOKIES | @@ -149,7 +149,7 @@ qboolean CL_HTTP_PerformDownload(void) clc.downloadCount += bytesRead; Cvar_SetValue("cl_downloadCount", clc.downloadCount); - int bytesWritten = FS_Write(readBuffer, bytesRead, clc.download); + DWORD bytesWritten = (DWORD)FS_Write(readBuffer, bytesRead, clc.download); DropIf(bytesWritten != bytesRead, "bytesWritten != bytesRead"); return qfalse; diff --git a/code/client/libmumblelink.c b/code/client/libmumblelink.c index 4b01b82d..99ef0295 100644 --- a/code/client/libmumblelink.c +++ b/code/client/libmumblelink.c @@ -168,7 +168,7 @@ void mumble_set_description(const char* description) mbstowcs(lm->description, description, len); } -void mumble_unlink() +void mumble_unlink(void) { if(!lm) return; diff --git a/code/client/snd_codec.c b/code/client/snd_codec.c index b1923277..d22fdf32 100644 --- a/code/client/snd_codec.c +++ b/code/client/snd_codec.c @@ -120,7 +120,7 @@ static void *S_CodecGetSound(const char *filename, snd_info_t *info) S_CodecInit ================= */ -void S_CodecInit() +void S_CodecInit(void) { codecs = NULL; @@ -141,7 +141,7 @@ void S_CodecInit() S_CodecShutdown ================= */ -void S_CodecShutdown() +void S_CodecShutdown(void) { codecs = NULL; } diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index ba4ac961..689f4e8f 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -951,7 +951,7 @@ If raw data has been loaded in little endien binary form, this must be done. If raw data was calculated, as with ADPCM, this should not be called. ================= */ -void S_ByteSwapRawSamples( int samples, int width, int s_channels, const byte *data ) { +void S_ByteSwapRawSamples( int samples, int width, int numChannels, const byte *data ) { int i; if ( width != 2 ) { @@ -961,7 +961,7 @@ void S_ByteSwapRawSamples( int samples, int width, int s_channels, const byte *d return; } - if ( s_channels == 2 ) { + if ( numChannels == 2 ) { samples <<= 1; } for ( i = 0 ; i < samples ; i++ ) { @@ -976,7 +976,7 @@ S_Base_RawSamples Music streaming ============ */ -void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_channels, const byte *data, float volume, int entityNum) +void S_Base_RawSamples( int stream, int samples, int rate, int width, int numChannels, const byte *data, float volume, int entityNum) { int i; int src, dst; @@ -1018,7 +1018,7 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan scale = (float)rate / dma.speed; //Com_Printf ("%i < %i < %i\n", s_soundtime, s_paintedtime, s_rawend[stream]); - if (s_channels == 2 && width == 2) + if (numChannels == 2 && width == 2) { if (scale == 1.0) { // optimized case @@ -1044,7 +1044,7 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan } } } - else if (s_channels == 1 && width == 2) + else if (numChannels == 1 && width == 2) { for (i=0 ; ; i++) { @@ -1057,7 +1057,7 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan rawsamples[dst].right = ((short *)data)[src] * intVolumeRight; } } - else if (s_channels == 2 && width == 1) + else if (numChannels == 2 && width == 1) { intVolumeLeft *= 256; intVolumeRight *= 256; @@ -1073,7 +1073,7 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan rawsamples[dst].right = ((char *)data)[src*2+1] * intVolumeRight; } } - else if (s_channels == 1 && width == 1) + else if (numChannels == 1 && width == 1) { intVolumeLeft *= 256; intVolumeRight *= 256; diff --git a/code/client/snd_main.c b/code/client/snd_main.c index f9e6941f..456cbb9d 100644 --- a/code/client/snd_main.c +++ b/code/client/snd_main.c @@ -41,35 +41,35 @@ static soundInterface_t si; S_ValidateInterface ================= */ -static qboolean S_ValidSoundInterface( soundInterface_t *si ) +static qboolean S_ValidSoundInterface( soundInterface_t *pSi ) { - if( !si->Shutdown ) return qfalse; - if( !si->StartSound ) return qfalse; - if( !si->StartLocalSound ) return qfalse; - if( !si->StartBackgroundTrack ) return qfalse; - if( !si->StopBackgroundTrack ) return qfalse; - if( !si->RawSamples ) return qfalse; - if( !si->StopAllSounds ) return qfalse; - if( !si->ClearLoopingSounds ) return qfalse; - if( !si->AddLoopingSound ) return qfalse; - if( !si->AddRealLoopingSound ) return qfalse; - if( !si->StopLoopingSound ) return qfalse; - if( !si->Respatialize ) return qfalse; - if( !si->UpdateEntityPosition ) return qfalse; - if( !si->Update ) return qfalse; - if( !si->DisableSounds ) return qfalse; - if( !si->BeginRegistration ) return qfalse; - if( !si->RegisterSound ) return qfalse; - if( !si->ClearSoundBuffer ) return qfalse; - if( !si->SoundInfo ) return qfalse; - if( !si->SoundList ) return qfalse; + if( !pSi->Shutdown ) return qfalse; + if( !pSi->StartSound ) return qfalse; + if( !pSi->StartLocalSound ) return qfalse; + if( !pSi->StartBackgroundTrack ) return qfalse; + if( !pSi->StopBackgroundTrack ) return qfalse; + if( !pSi->RawSamples ) return qfalse; + if( !pSi->StopAllSounds ) return qfalse; + if( !pSi->ClearLoopingSounds ) return qfalse; + if( !pSi->AddLoopingSound ) return qfalse; + if( !pSi->AddRealLoopingSound ) return qfalse; + if( !pSi->StopLoopingSound ) return qfalse; + if( !pSi->Respatialize ) return qfalse; + if( !pSi->UpdateEntityPosition ) return qfalse; + if( !pSi->Update ) return qfalse; + if( !pSi->DisableSounds ) return qfalse; + if( !pSi->BeginRegistration ) return qfalse; + if( !pSi->RegisterSound ) return qfalse; + if( !pSi->ClearSoundBuffer ) return qfalse; + if( !pSi->SoundInfo ) return qfalse; + if( !pSi->SoundList ) return qfalse; #ifdef USE_VOIP - if( !si->StartCapture ) return qfalse; - if( !si->AvailableCaptureSamples ) return qfalse; - if( !si->Capture ) return qfalse; - if( !si->StopCapture ) return qfalse; - if( !si->MasterGain ) return qfalse; + if( !pSi->StartCapture ) return qfalse; + if( !pSi->AvailableCaptureSamples ) return qfalse; + if( !pSi->Capture ) return qfalse; + if( !pSi->StopCapture ) return qfalse; + if( !pSi->MasterGain ) return qfalse; #endif return qtrue; diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 8184b074..eb0a69e5 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -649,7 +649,7 @@ Adapt the gain if necessary to get a quicker fadeout when the source is too far static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin) { - float distance; + float distance = 0.0f; if(!chksrc->local) distance = Distance(origin, lastListenerOrigin); diff --git a/code/game/g_combat.c b/code/game/g_combat.c index dd52bf56..c23af765 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -618,9 +618,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int GibEntity( self, killer ); } else { // normal death - static int i; + static int lastDeath; - switch ( i ) { + switch ( lastDeath ) { case 0: anim = BOTH_DEATH1; break; @@ -644,13 +644,13 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->client->ps.torsoAnim = ( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; - G_AddEvent( self, EV_DEATH1 + i, killer ); + G_AddEvent( self, EV_DEATH1 + lastDeath, killer ); // the body can still be gibbed self->die = body_die; // globally cycle through the different death animations - i = ( i + 1 ) % 3; + lastDeath = ( lastDeath + 1 ) % 3; #ifdef MISSIONPACK if (self->s.eFlags & EF_KAMIKAZE) { diff --git a/code/game/g_items.c b/code/game/g_items.c index ed15a16f..6cb31aa4 100644 --- a/code/game/g_items.c +++ b/code/game/g_items.c @@ -690,8 +690,8 @@ void FinishSpawningItem( gentity_t *ent ) { G_SetOrigin( ent, tr.endpos ); } - // team slaves and targeted items aren't present at start - if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) { + // team members and targeted items aren't present at start + if ( ( ent->flags & FL_TEAMMEMBER ) || ent->targetname ) { ent->s.eFlags |= EF_NODRAW; ent->r.contents = 0; return; diff --git a/code/game/g_local.h b/code/game/g_local.h index ebac56c6..d6511922 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -45,7 +45,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // gentity->flags #define FL_GODMODE 0x00000010 #define FL_NOTARGET 0x00000020 -#define FL_TEAMSLAVE 0x00000400 // not the first on the team +#define FL_TEAMMEMBER 0x00000400 // not the first on the team #define FL_NO_KNOCKBACK 0x00000800 #define FL_DROPPED_ITEM 0x00001000 #define FL_NO_BOTS 0x00002000 // spawn point not for bot use diff --git a/code/game/g_main.c b/code/game/g_main.c index 4398113e..ed5d4ead 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -266,7 +266,7 @@ G_FindTeams Chain together all entities with a matching team field. Entity teams are used for item groups and multi-entity mover groups. -All but the first will have the FL_TEAMSLAVE flag set and teammaster field set +All but the first will have the FL_TEAMMEMBER flag set and teammaster field set All but the last will have the teamchain field set to the next one ================ */ @@ -282,7 +282,7 @@ void G_FindTeams( void ) { continue; if (!e->team) continue; - if (e->flags & FL_TEAMSLAVE) + if (e->flags & FL_TEAMMEMBER) continue; e->teammaster = e; c++; @@ -293,7 +293,7 @@ void G_FindTeams( void ) { continue; if (!e2->team) continue; - if (e2->flags & FL_TEAMSLAVE) + if (e2->flags & FL_TEAMMEMBER) continue; if (!strcmp(e->team, e2->team)) { @@ -301,7 +301,7 @@ void G_FindTeams( void ) { e2->teamchain = e->teamchain; e->teamchain = e2; e2->teammaster = e; - e2->flags |= FL_TEAMSLAVE; + e2->flags |= FL_TEAMMEMBER; // make sure that targets only point at the master if ( e2->targetname ) { @@ -540,7 +540,7 @@ void G_ShutdownGame( int restart ) { //=================================================================== -void QDECL Com_Error ( int level, const char *error, ... ) { +void QDECL Com_Error ( int logLevel, const char *error, ... ) { va_list argptr; char text[1024]; diff --git a/code/game/g_mover.c b/code/game/g_mover.c index ad9b6c3c..78a8d29a 100644 --- a/code/game/g_mover.c +++ b/code/game/g_mover.c @@ -424,7 +424,7 @@ void G_MoverTeam( gentity_t *ent ) { obstacle = NULL; - // make sure all team slaves can move before committing + // make sure all team members can move before committing // any moves or calling any think functions // if the move is blocked, all moved objects will be backed out pushed_p = pushed; @@ -478,7 +478,7 @@ G_RunMover void G_RunMover( gentity_t *ent ) { // if not a team captain, don't do anything, because // the captain will handle everything - if ( ent->flags & FL_TEAMSLAVE ) { + if ( ent->flags & FL_TEAMMEMBER ) { return; } @@ -550,10 +550,10 @@ in the same amount of time ================ */ void MatchTeam( gentity_t *teamLeader, int moverState, int time ) { - gentity_t *slave; + gentity_t *member; - for ( slave = teamLeader ; slave ; slave = slave->teamchain ) { - SetMoverState( slave, moverState, time ); + for ( member = teamLeader ; member ; member = member->teamchain ) { + SetMoverState( member, moverState, time ); } } @@ -634,7 +634,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) { int partial; // only the master should be used - if ( ent->flags & FL_TEAMSLAVE ) { + if ( ent->flags & FL_TEAMMEMBER ) { Use_BinaryMover( ent->teammaster, other, activator ); return; } @@ -885,7 +885,7 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) { return; } - // set all of the slaves as shootable + // set all of the members as shootable for ( other = ent ; other ; other = other->teamchain ) { other->takedamage = qtrue; } @@ -997,7 +997,7 @@ void SP_func_door (gentity_t *ent) { ent->nextthink = level.time + FRAMETIME; - if ( ! (ent->flags & FL_TEAMSLAVE ) ) { + if ( ! (ent->flags & FL_TEAMMEMBER ) ) { int health; G_SpawnInt( "health", "0", &health ); diff --git a/code/game/g_weapon.c b/code/game/g_weapon.c index 752cb1e2..d78afb0f 100644 --- a/code/game/g_weapon.c +++ b/code/game/g_weapon.c @@ -322,22 +322,22 @@ void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent ) { int i; float r, u; vec3_t end; - vec3_t forward, right, up; + vec3_t localForward, localRight, localUp; qboolean hitClient = qfalse; // derive the right and up vectors from the forward vector, because // the client won't have any other information - VectorNormalize2( origin2, forward ); - PerpendicularVector( right, forward ); - CrossProduct( forward, right, up ); + VectorNormalize2( origin2, localForward ); + PerpendicularVector( localRight, localForward ); + CrossProduct( localForward, localRight, localUp ); // generate the "random" spread pattern for ( i = 0 ; i < DEFAULT_SHOTGUN_COUNT ; i++ ) { r = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16; u = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16; - VectorMA( origin, 8192 * 16, forward, end); - VectorMA (end, r, right, end); - VectorMA (end, u, up, end); + VectorMA( origin, 8192 * 16, localForward, end); + VectorMA (end, r, localRight, end); + VectorMA (end, u, localUp, end); if( ShotgunPellet( origin, end, ent ) && !hitClient ) { hitClient = qtrue; ent->client->accuracy_hits++; @@ -769,10 +769,10 @@ CalcMuzzlePoint set muzzle location relative to pivoting eye =============== */ -void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) { +void CalcMuzzlePoint ( gentity_t *ent, vec3_t localForward, vec3_t localRight, vec3_t localUp, vec3_t muzzlePoint ) { VectorCopy( ent->s.pos.trBase, muzzlePoint ); muzzlePoint[2] += ent->client->ps.viewheight; - VectorMA( muzzlePoint, 14, forward, muzzlePoint ); + VectorMA( muzzlePoint, 14, localForward, muzzlePoint ); // snap to integer coordinates for more efficient network bandwidth usage SnapVector( muzzlePoint ); } @@ -784,10 +784,10 @@ CalcMuzzlePointOrigin set muzzle location relative to pivoting eye =============== */ -void CalcMuzzlePointOrigin ( gentity_t *ent, vec3_t origin, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) { +void CalcMuzzlePointOrigin ( gentity_t *ent, vec3_t origin, vec3_t localForward, vec3_t localRight, vec3_t localUp, vec3_t muzzlePoint ) { VectorCopy( ent->s.pos.trBase, muzzlePoint ); muzzlePoint[2] += ent->client->ps.viewheight; - VectorMA( muzzlePoint, 14, forward, muzzlePoint ); + VectorMA( muzzlePoint, 14, localForward, muzzlePoint ); // snap to integer coordinates for more efficient network bandwidth usage SnapVector( muzzlePoint ); } diff --git a/code/q3_ui/ui_controls2.c b/code/q3_ui/ui_controls2.c index f5806a19..d511a081 100644 --- a/code/q3_ui/ui_controls2.c +++ b/code/q3_ui/ui_controls2.c @@ -354,11 +354,10 @@ Controls_InitCvars */ static void Controls_InitCvars( void ) { - int i; configcvar_t* cvarptr; cvarptr = g_configcvars; - for (i=0; ;i++,cvarptr++) + for (;;cvarptr++) { if (!cvarptr->name) break; @@ -383,10 +382,9 @@ Controls_GetCvarDefault static float Controls_GetCvarDefault( char* name ) { configcvar_t* cvarptr; - int i; cvarptr = g_configcvars; - for (i=0; ;i++,cvarptr++) + for (;;cvarptr++) { if (!cvarptr->name) return (0); @@ -406,10 +404,9 @@ Controls_GetCvarValue static float Controls_GetCvarValue( char* name ) { configcvar_t* cvarptr; - int i; cvarptr = g_configcvars; - for (i=0; ;i++,cvarptr++) + for (;;cvarptr++) { if (!cvarptr->name) return (0); @@ -788,7 +785,6 @@ Controls_GetConfig */ static void Controls_GetConfig( void ) { - int i; int twokeys[2]; bind_t* bindptr; @@ -796,7 +792,7 @@ static void Controls_GetConfig( void ) bindptr = g_bindings; // iterate each command, get its numeric binding - for (i=0; ;i++,bindptr++) + for (;;bindptr++) { if (!bindptr->label) break; @@ -824,14 +820,13 @@ Controls_SetConfig */ static void Controls_SetConfig( void ) { - int i; bind_t* bindptr; // set the bindings from the local store bindptr = g_bindings; // iterate each command, get its numeric binding - for (i=0; ;i++,bindptr++) + for (;;bindptr++) { if (!bindptr->label) break; @@ -867,14 +862,13 @@ Controls_SetDefaults */ static void Controls_SetDefaults( void ) { - int i; bind_t* bindptr; // set the bindings from the local store bindptr = g_bindings; // iterate each command, set its default binding - for (i=0; ;i++,bindptr++) + for (;;bindptr++) { if (!bindptr->label) break; @@ -901,7 +895,6 @@ Controls_MenuKey static sfxHandle_t Controls_MenuKey( int key ) { int id; - int i; qboolean found; bind_t* bindptr; found = qfalse; @@ -949,7 +942,7 @@ static sfxHandle_t Controls_MenuKey( int key ) { // remove from any other bind bindptr = g_bindings; - for (i=0; ;i++,bindptr++) + for (;;bindptr++) { if (!bindptr->label) break; @@ -968,7 +961,7 @@ static sfxHandle_t Controls_MenuKey( int key ) // assign key to local store id = ((menucommon_s*)(s_controls.menu.items[s_controls.menu.cursor]))->id; bindptr = g_bindings; - for (i=0; ;i++,bindptr++) + for (;;bindptr++) { if (!bindptr->label) break; diff --git a/code/qcommon/cm_patch.c b/code/qcommon/cm_patch.c index 002d9428..df892e98 100644 --- a/code/qcommon/cm_patch.c +++ b/code/qcommon/cm_patch.c @@ -1260,7 +1260,7 @@ void CM_TracePointThroughPatchCollide( traceWork_t *tw, const struct patchCollid qboolean frontFacing[MAX_PATCH_PLANES]; float intersection[MAX_PATCH_PLANES]; float intersect; - const patchPlane_t *planes; + const patchPlane_t *pcPlanes; const facet_t *facet; int i, j, k; float offset; @@ -1276,11 +1276,11 @@ void CM_TracePointThroughPatchCollide( traceWork_t *tw, const struct patchCollid #endif // determine the trace's relationship to all planes - planes = pc->planes; - for ( i = 0 ; i < pc->numPlanes ; i++, planes++ ) { - offset = DotProduct( tw->offsets[ planes->signbits ], planes->plane ); - d1 = DotProduct( tw->start, planes->plane ) - planes->plane[3] + offset; - d2 = DotProduct( tw->end, planes->plane ) - planes->plane[3] + offset; + pcPlanes = pc->planes; + for ( i = 0 ; i < pc->numPlanes ; i++, pcPlanes++ ) { + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], pcPlanes->plane ); + d1 = DotProduct( tw->start, pcPlanes->plane ) - pcPlanes->plane[3] + offset; + d2 = DotProduct( tw->end, pcPlanes->plane ) - pcPlanes->plane[3] + offset; if ( d1 <= 0 ) { frontFacing[i] = qfalse; } else { @@ -1333,20 +1333,20 @@ void CM_TracePointThroughPatchCollide( traceWork_t *tw, const struct patchCollid debugFacet = facet; } #endif //BSPC - planes = &pc->planes[facet->surfacePlane]; + pcPlanes = &pc->planes[facet->surfacePlane]; // calculate intersection with a slight pushoff - offset = DotProduct( tw->offsets[ planes->signbits ], planes->plane ); - d1 = DotProduct( tw->start, planes->plane ) - planes->plane[3] + offset; - d2 = DotProduct( tw->end, planes->plane ) - planes->plane[3] + offset; + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], pcPlanes->plane ); + d1 = DotProduct( tw->start, pcPlanes->plane ) - pcPlanes->plane[3] + offset; + d2 = DotProduct( tw->end, pcPlanes->plane ) - pcPlanes->plane[3] + offset; tw->trace.fraction = ( d1 - SURFACE_CLIP_EPSILON ) / ( d1 - d2 ); if ( tw->trace.fraction < 0 ) { tw->trace.fraction = 0; } - VectorCopy( planes->plane, tw->trace.plane.normal ); - tw->trace.plane.dist = planes->plane[3]; + VectorCopy( pcPlanes->plane, tw->trace.plane.normal ); + tw->trace.plane.dist = pcPlanes->plane[3]; } } } @@ -1405,7 +1405,7 @@ CM_TraceThroughPatchCollide void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) { int i, j, hit, hitnum; float offset, enterFrac, leaveFrac, t; - patchPlane_t *planes; + patchPlane_t *pcPlanes; facet_t *facet; float plane[4] = {0, 0, 0, 0}, bestplane[4] = {0, 0, 0, 0}; vec3_t startp, endp; @@ -1429,9 +1429,9 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s * leaveFrac = 1.0; hitnum = -1; // - planes = &pc->planes[ facet->surfacePlane ]; - VectorCopy(planes->plane, plane); - plane[3] = planes->plane[3]; + pcPlanes = &pc->planes[ facet->surfacePlane ]; + VectorCopy(pcPlanes->plane, plane); + plane[3] = pcPlanes->plane[3]; if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius plane[3] += tw->sphere.radius; @@ -1448,7 +1448,7 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s * } } else { - offset = DotProduct( tw->offsets[ planes->signbits ], plane); + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], plane); plane[3] -= offset; VectorCopy( tw->start, startp ); VectorCopy( tw->end, endp ); @@ -1462,14 +1462,14 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s * } for ( j = 0; j < facet->numBorders; j++ ) { - planes = &pc->planes[ facet->borderPlanes[j] ]; + pcPlanes = &pc->planes[ facet->borderPlanes[j] ]; if (facet->borderInward[j]) { - VectorNegate(planes->plane, plane); - plane[3] = -planes->plane[3]; + VectorNegate(pcPlanes->plane, plane); + plane[3] = -pcPlanes->plane[3]; } else { - VectorCopy(planes->plane, plane); - plane[3] = planes->plane[3]; + VectorCopy(pcPlanes->plane, plane); + plane[3] = pcPlanes->plane[3]; } if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius @@ -1488,7 +1488,7 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s * } else { // NOTE: this works even though the plane might be flipped because the bbox is centered - offset = DotProduct( tw->offsets[ planes->signbits ], plane); + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], plane); plane[3] += fabs(offset); VectorCopy( tw->start, startp ); VectorCopy( tw->end, endp ); @@ -1546,7 +1546,7 @@ CM_PositionTestInPatchCollide qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) { int i, j; float offset, t; - patchPlane_t *planes; + patchPlane_t *pcPlanes; facet_t *facet; float plane[4]; vec3_t startp; @@ -1557,9 +1557,9 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli // facet = pc->facets; for ( i = 0 ; i < pc->numFacets ; i++, facet++ ) { - planes = &pc->planes[ facet->surfacePlane ]; - VectorCopy(planes->plane, plane); - plane[3] = planes->plane[3]; + pcPlanes = &pc->planes[ facet->surfacePlane ]; + VectorCopy(pcPlanes->plane, plane); + plane[3] = pcPlanes->plane[3]; if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius plane[3] += tw->sphere.radius; @@ -1574,7 +1574,7 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli } } else { - offset = DotProduct( tw->offsets[ planes->signbits ], plane); + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], plane); plane[3] -= offset; VectorCopy( tw->start, startp ); } @@ -1584,14 +1584,14 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli } for ( j = 0; j < facet->numBorders; j++ ) { - planes = &pc->planes[ facet->borderPlanes[j] ]; + pcPlanes = &pc->planes[ facet->borderPlanes[j] ]; if (facet->borderInward[j]) { - VectorNegate(planes->plane, plane); - plane[3] = -planes->plane[3]; + VectorNegate(pcPlanes->plane, plane); + plane[3] = -pcPlanes->plane[3]; } else { - VectorCopy(planes->plane, plane); - plane[3] = planes->plane[3]; + VectorCopy(pcPlanes->plane, plane); + plane[3] = pcPlanes->plane[3]; } if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius @@ -1608,7 +1608,7 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli } else { // NOTE: this works even though the plane might be flipped because the bbox is centered - offset = DotProduct( tw->offsets[ planes->signbits ], plane); + offset = DotProduct( tw->offsets[ pcPlanes->signbits ], plane); plane[3] += fabs(offset); VectorCopy( tw->start, startp ); } diff --git a/code/qcommon/common.c b/code/qcommon/common.c index d8f4e46d..313bc5a2 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -1410,6 +1410,8 @@ void Com_TouchMemory( void ) { end = Sys_Milliseconds(); + (void)sum; // Suppress warning + Com_Printf( "Com_TouchMemory: %i msec\n", end - start ); } @@ -1523,6 +1525,8 @@ void Hunk_SmallLog( void) { #ifdef HUNK_DEBUG Com_sprintf(buf, sizeof(buf), "size = %8d: %s, line: %d (%s)\r\n", locsize, block->file, block->line, block->label); FS_Write(buf, strlen(buf), logfile); +#else + (void)locsize; // Suppress warning #endif size += block->size; numBlocks++; @@ -2574,7 +2578,7 @@ static void Com_DetectAltivec(void) static qboolean altivec = qfalse; static qboolean detected = qfalse; if (!detected) { - altivec = ( Sys_GetProcessorFeatures( ) & CF_ALTIVEC ); + altivec = !!( Sys_GetProcessorFeatures( ) & CF_ALTIVEC ); detected = qtrue; } diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 6491d314..c423ae64 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -217,12 +217,12 @@ typedef struct fileInPack_s { } fileInPack_t; typedef struct { - char pakPathname[MAX_OSPATH]; // c:\quake3\baseq3 + char pakPathname[MAX_OSPATH]; // c:\quake3\baseq3 char pakFilename[MAX_OSPATH]; // c:\quake3\baseq3\pak0.pk3 char pakBasename[MAX_OSPATH]; // pak0 char pakGamename[MAX_OSPATH]; // baseq3 unzFile handle; // handle to zip file - int checksum; // regular checksum + unsigned int checksum; // regular checksum int pure_checksum; // checksum for pure int numfiles; // number of files in pk3 int referenced; // referenced file flags @@ -262,7 +262,7 @@ static int fs_loadCount; // total files read static int fs_loadStack; // total files in memory static int fs_packFiles = 0; // total number of files in packs -static const cvar_t *fs_pathVars[16]; +static cvar_t *fs_pathVars[16]; static int fs_checksumFeed; @@ -293,15 +293,15 @@ static fileHandleData_t fsh[MAX_FILE_HANDLES]; static qboolean fs_reordered; // never load anything from pk3 files that are not present at the server when pure -static int fs_numServerPaks = 0; -static int fs_serverPaks[MAX_SEARCH_PATHS]; // checksums -static char *fs_serverPakNames[MAX_SEARCH_PATHS]; // pk3 names +static int fs_numServerPaks = 0; +static unsigned int fs_serverPaks[MAX_SEARCH_PATHS]; // checksums +static char *fs_serverPakNames[MAX_SEARCH_PATHS]; // pk3 names // only used for autodownload, to make sure the client has at least // all the pk3 files that are referenced at the server side -static int fs_numServerReferencedPaks; -static int fs_serverReferencedPaks[MAX_SEARCH_PATHS]; // checksums -static char *fs_serverReferencedPakNames[MAX_SEARCH_PATHS]; // pk3 names +static int fs_numServerReferencedPaks; +static unsigned int fs_serverReferencedPaks[MAX_SEARCH_PATHS]; // checksums +static char *fs_serverReferencedPakNames[MAX_SEARCH_PATHS]; // pk3 names // last valid game folder used char lastValidBase[MAX_OSPATH]; @@ -1569,8 +1569,6 @@ FS_Seek ================= */ int FS_Seek( fileHandle_t f, long offset, int origin ) { - int _origin; - if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, "Filesystem call made without initialization" ); return -1; @@ -1638,6 +1636,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) { } else { FILE *file; file = FS_FileForHandle(f); + int _origin = SEEK_SET; switch( origin ) { case FS_SEEK_CUR: _origin = SEEK_CUR; @@ -2064,7 +2063,8 @@ Compares whether the given pak file matches a referenced checksum qboolean FS_CompareZipChecksum(const char *zipfile) { pack_t *thepak; - int index, checksum; + int index; + unsigned int checksum; thepak = FS_LoadZipFile(zipfile, ""); diff --git a/code/qcommon/net_chan.c b/code/qcommon/net_chan.c index 9e7d9b87..e1a27fdc 100644 --- a/code/qcommon/net_chan.c +++ b/code/qcommon/net_chan.c @@ -56,7 +56,7 @@ to the new value before sending out any replies. cvar_t *showpackets; cvar_t *showdrop; -cvar_t *qport; +cvar_t *net_qport; static char *netsrcString[2] = { "client", @@ -73,7 +73,7 @@ void Netchan_Init( int port ) { port &= 0xffff; showpackets = Cvar_Get ("showpackets", "0", CVAR_TEMP ); showdrop = Cvar_Get ("showdrop", "0", CVAR_TEMP ); - qport = Cvar_Get ("net_qport", va("%i", port), CVAR_INIT ); + net_qport = Cvar_Get ("net_qport", va("%i", port), CVAR_INIT ); } /* @@ -120,7 +120,7 @@ void Netchan_TransmitNextFragment( netchan_t *chan ) { // send the qport if we are a client if ( chan->sock == NS_CLIENT ) { - MSG_WriteShort( &send, qport->integer ); + MSG_WriteShort( &send, net_qport->integer ); } #ifdef LEGACY_PROTOCOL @@ -202,7 +202,7 @@ void Netchan_Transmit( netchan_t *chan, int length, const byte *data ) { // send the qport if we are a client if(chan->sock == NS_CLIENT) - MSG_WriteShort(&send, qport->integer); + MSG_WriteShort(&send, net_qport->integer); #ifdef LEGACY_PROTOCOL if(!chan->compat) diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index 621f1ba2..294e4c03 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -1053,7 +1053,7 @@ void NET_JoinMulticast6(void) } } -void NET_LeaveMulticast6() +void NET_LeaveMulticast6(void) { if(multicast6_socket != INVALID_SOCKET) { diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index cc39c361..5af3c3b5 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -162,21 +162,7 @@ typedef int intptr_t; #include #include #include - -#ifdef _MSC_VER - #include - - typedef __int64 int64_t; - typedef __int32 int32_t; - typedef __int16 int16_t; - typedef __int8 int8_t; - typedef unsigned __int64 uint64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int8 uint8_t; -#else - #include -#endif +#include #ifdef _WIN32 // vsnprintf is ISO/IEC 9899:1999 diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c index 9a15c99f..9de7e15f 100644 --- a/code/qcommon/vm.c +++ b/code/qcommon/vm.c @@ -576,7 +576,7 @@ it will attempt to load as a system dll vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *), vmInterpret_t interpret ) { vm_t *vm; - vmHeader_t *header; + vmHeader_t *header = NULL; int i, remaining, retval; char filename[MAX_OSPATH]; void *startSearch = NULL; diff --git a/code/renderercommon/tr_image_bmp.c b/code/renderercommon/tr_image_bmp.c index 594b308d..4cc5fb2c 100644 --- a/code/renderercommon/tr_image_bmp.c +++ b/code/renderercommon/tr_image_bmp.c @@ -54,7 +54,7 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) byte *b; void *v; } buffer; - int length; + unsigned length; BMPHeader_t bmpHeader; byte *bmpRGBA; @@ -164,7 +164,7 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) numPixels = columns * rows; if(columns <= 0 || !rows || numPixels > 0x1FFFFFFF // 4*1FFFFFFF == 0x7FFFFFFC < 0x7FFFFFFF - || ((numPixels * 4) / columns) / 4 != rows) + || (((int)numPixels * 4) / columns) / 4 != rows) { ri.Error (ERR_DROP, "LoadBMP: %s has an invalid image size", name); } diff --git a/code/renderercommon/tr_image_png.c b/code/renderercommon/tr_image_png.c index 797f3cff..f956c5f0 100644 --- a/code/renderercommon/tr_image_png.c +++ b/code/renderercommon/tr_image_png.c @@ -532,7 +532,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) if(!(BF && Buffer)) { - return(-1); + return((uint32_t)-1); } /* @@ -553,7 +553,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) if(!FindChunk(BF, PNG_ChunkType_IDAT)) { - return(-1); + return((uint32_t)-1); } /* @@ -576,7 +576,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) BufferedFileRewind(BF, BytesToRewind); - return(-1); + return((uint32_t)-1); } /* @@ -613,7 +613,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { BufferedFileRewind(BF, BytesToRewind); - return(-1); + return((uint32_t)-1); } BytesToRewind += Length + PNG_ChunkCRC_Size; @@ -626,7 +626,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) CompressedData = ri.Malloc(CompressedDataLength); if(!CompressedData) { - return(-1); + return((uint32_t)-1); } CompressedDataPtr = CompressedData; @@ -646,7 +646,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { ri.Free(CompressedData); - return(-1); + return((uint32_t)-1); } /* @@ -680,14 +680,14 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { ri.Free(CompressedData); - return(-1); + return((uint32_t)-1); } if(!BufferedFileSkip(BF, PNG_ChunkCRC_Size)) { ri.Free(CompressedData); - return(-1); + return((uint32_t)-1); } memcpy(CompressedDataPtr, OrigCompressedData, Length); @@ -718,7 +718,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { ri.Free(CompressedData); - return(-1); + return((uint32_t)-1); } /* @@ -730,7 +730,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { ri.Free(CompressedData); - return(-1); + return((uint32_t)-1); } /* @@ -761,7 +761,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer) { ri.Free(DecompressedData); - return(-1); + return((uint32_t)-1); } /* @@ -2364,7 +2364,7 @@ void R_LoadPNG(const char *name, byte **pic, int *width, int *height) * Rewind to the start of the file. */ - if(!BufferedFileRewind(ThePNG, -1)) + if(!BufferedFileRewind(ThePNG, (unsigned)-1)) { CloseBufferedFile(ThePNG); diff --git a/code/renderercommon/tr_image_tga.c b/code/renderercommon/tr_image_tga.c index bcfd0467..619e7d22 100644 --- a/code/renderercommon/tr_image_tga.c +++ b/code/renderercommon/tr_image_tga.c @@ -42,7 +42,7 @@ void R_LoadTGA ( const char *name, byte **pic, int *width, int *height) { unsigned columns, rows, numPixels; byte *pixbuf; - int row, column; + unsigned row, column; byte *buf_p; byte *end; union { @@ -190,7 +190,8 @@ void R_LoadTGA ( const char *name, byte **pic, int *width, int *height) } } else if (targa_header.image_type==10) { // Runlength encoded RGB images - unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j; + unsigned char red = 0, green = 0, blue = 0, alphabyte = 0; + unsigned char packetHeader, packetSize, j; for(row=rows-1; row>=0; row--) { pixbuf = targa_rgba + row*columns*4; diff --git a/code/renderergl1/tr_backend.c b/code/renderergl1/tr_backend.c index 56cf37d1..ed06d147 100644 --- a/code/renderergl1/tr_backend.c +++ b/code/renderergl1/tr_backend.c @@ -531,12 +531,12 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { backEnd.pc.c_surfaces += numDrawSurfs; for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) { - if ( drawSurf->sort == oldSort ) { + if ( drawSurf->sort == (unsigned)oldSort ) { // fast path, same as previous sort rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface ); continue; } - oldSort = drawSurf->sort; + oldSort = (int)drawSurf->sort; R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlighted ); // @@ -670,7 +670,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { } if (r_drawSun->integer) { - RB_DrawSun(0.1, tr.sunShader); + RB_DrawSun(0.1f, tr.sunShader); } // darken down any stencil shadows diff --git a/code/renderergl1/tr_bsp.c b/code/renderergl1/tr_bsp.c index 5de7ff90..243c5dd0 100644 --- a/code/renderergl1/tr_bsp.c +++ b/code/renderergl1/tr_bsp.c @@ -138,7 +138,6 @@ static void R_LoadLightmaps( lump_t *l ) { byte image[LIGHTMAP_SIZE*LIGHTMAP_SIZE*4]; int i, j; float maxIntensity = 0; - double sumIntensity = 0; len = l->filelen; if ( !len ) { @@ -193,8 +192,6 @@ static void R_LoadLightmaps( lump_t *l ) { image[j*4+1] = out[1] * 255; image[j*4+2] = out[2] * 255; image[j*4+3] = 255; - - sumIntensity += intensity; } } else { for ( j = 0 ; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ ) { diff --git a/code/renderergl1/tr_cmds.c b/code/renderergl1/tr_cmds.c index 89bb88a3..cb1ab5f4 100644 --- a/code/renderergl1/tr_cmds.c +++ b/code/renderergl1/tr_cmds.c @@ -193,9 +193,9 @@ void RE_SetColor( const float *rgba ) { } cmd->commandId = RC_SET_COLOR; if ( !rgba ) { - static float colorWhite[4] = { 1, 1, 1, 1 }; + static float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - rgba = colorWhite; + rgba = white; } cmd->color[0] = rgba[0]; diff --git a/code/renderergl1/tr_curve.c b/code/renderergl1/tr_curve.c index c5c9d98d..e65bdfa9 100644 --- a/code/renderergl1/tr_curve.c +++ b/code/renderergl1/tr_curve.c @@ -113,7 +113,6 @@ static void MakeMeshNormals( int width, int height, drawVert_t ctrl[MAX_GRID_SIZ int i, j, k, dist; vec3_t normal; vec3_t sum; - int count = 0; vec3_t base; vec3_t delta; int x, y; @@ -153,7 +152,6 @@ static int neighbors[8][2] = { for ( i = 0 ; i < width ; i++ ) { for ( j = 0 ; j < height ; j++ ) { - count = 0; dv = &ctrl[j][i]; VectorCopy( dv->xyz, base ); for ( k = 0 ; k < 8 ; k++ ) { @@ -202,7 +200,6 @@ static int neighbors[8][2] = { continue; } VectorAdd( normal, sum, sum ); - count++; } //if ( count == 0 ) { // printf("bad normal\n"); @@ -391,7 +388,7 @@ srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, for ( i = 0 ; i < height ; i++ ) { vec3_t midxyz; vec3_t midxyz2; - vec3_t dir; + vec3_t dirVector; vec3_t projected; float d; @@ -406,11 +403,11 @@ srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, // texture warping, but it gives a lot less polygons than // dist-from-midpoint VectorSubtract( midxyz, ctrl[i][j].xyz, midxyz ); - VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dir ); - VectorNormalize( dir ); + VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dirVector ); + VectorNormalize( dirVector ); - d = DotProduct( midxyz, dir ); - VectorScale( dir, d, projected ); + d = DotProduct( midxyz, dirVector ); + VectorScale( dirVector, d, projected ); VectorSubtract( midxyz, projected, midxyz2); len = VectorLengthSquared( midxyz2 ); // we will do the sqrt later if ( len > maxLen ) { diff --git a/code/renderergl1/tr_main.c b/code/renderergl1/tr_main.c index 09559a2e..473b1831 100644 --- a/code/renderergl1/tr_main.c +++ b/code/renderergl1/tr_main.c @@ -855,7 +855,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 int dlighted; vec4_t clip, eye; int i; - unsigned int pointOr = 0; unsigned int pointAnd = (unsigned int)~0; R_RotateForViewer(); @@ -885,7 +884,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 } } pointAnd &= pointFlags; - pointOr |= pointFlags; } // trivially reject diff --git a/code/renderergl1/tr_shade.c b/code/renderergl1/tr_shade.c index 7ea78d13..9d1fdc8b 100644 --- a/code/renderergl1/tr_shade.c +++ b/code/renderergl1/tr_shade.c @@ -58,7 +58,7 @@ static int c_vertexes; // for seeing how long our average strips are static int c_begins; static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void ( APIENTRY *element )(GLint) ) { int i; - int last[3] = { -1, -1, -1 }; + glIndex_t last[3]; qboolean even; c_begins++; diff --git a/code/renderergl1/tr_shade_calc.c b/code/renderergl1/tr_shade_calc.c index 455424ed..d087c4d5 100644 --- a/code/renderergl1/tr_shade_calc.c +++ b/code/renderergl1/tr_shade_calc.c @@ -417,7 +417,7 @@ Autosprite2Deform Autosprite2 will pivot a rectangular quad along the center of its long axis ===================== */ -int edgeVerts[6][2] = { +glIndex_t edgeVerts[6][2] = { { 0, 1 }, { 0, 2 }, { 0, 3 }, diff --git a/code/renderergl1/tr_shader.c b/code/renderergl1/tr_shader.c index 2384a118..109a0ed5 100644 --- a/code/renderergl1/tr_shader.c +++ b/code/renderergl1/tr_shader.c @@ -1953,7 +1953,7 @@ static void FixRenderCommandList( int newShader ) { { int i; drawSurf_t *drawSurf; - shader_t *shader; + shader_t *pShader; int fogNum; int entityNum; int dlightMap; @@ -1961,7 +1961,7 @@ static void FixRenderCommandList( int newShader ) { const drawSurfsCommand_t *ds_cmd = (const drawSurfsCommand_t *)curCmd; for( i = 0, drawSurf = ds_cmd->drawSurfs; i < ds_cmd->numDrawSurfs; i++, drawSurf++ ) { - R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlightMap ); + R_DecomposeSort( drawSurf->sort, &entityNum, &pShader, &fogNum, &dlightMap ); sortedIndex = (( drawSurf->sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1)); if( sortedIndex >= newShader ) { sortedIndex++; @@ -2879,56 +2879,56 @@ A second parameter will cause it to print in sorted order void R_ShaderList_f (void) { int i; int count; - shader_t *shader; + shader_t *pShader; ri.Printf (PRINT_ALL, "-----------------------\n"); count = 0; for ( i = 0 ; i < tr.numShaders ; i++ ) { if ( ri.Cmd_Argc() > 1 ) { - shader = tr.sortedShaders[i]; + pShader = tr.sortedShaders[i]; } else { - shader = tr.shaders[i]; + pShader = tr.shaders[i]; } - ri.Printf( PRINT_ALL, "%i ", shader->numUnfoggedPasses ); + ri.Printf( PRINT_ALL, "%i ", pShader->numUnfoggedPasses ); - if (shader->lightmapIndex >= 0 ) { + if (pShader->lightmapIndex >= 0 ) { ri.Printf (PRINT_ALL, "L "); } else { ri.Printf (PRINT_ALL, " "); } - if ( shader->multitextureEnv == GL_ADD ) { + if ( pShader->multitextureEnv == GL_ADD ) { ri.Printf( PRINT_ALL, "MT(a) " ); - } else if ( shader->multitextureEnv == GL_MODULATE ) { + } else if ( pShader->multitextureEnv == GL_MODULATE ) { ri.Printf( PRINT_ALL, "MT(m) " ); - } else if ( shader->multitextureEnv == GL_DECAL ) { + } else if ( pShader->multitextureEnv == GL_DECAL ) { ri.Printf( PRINT_ALL, "MT(d) " ); } else { ri.Printf( PRINT_ALL, " " ); } - if ( shader->explicitlyDefined ) { + if ( pShader->explicitlyDefined ) { ri.Printf( PRINT_ALL, "E " ); } else { ri.Printf( PRINT_ALL, " " ); } - if ( shader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) { + if ( pShader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) { ri.Printf( PRINT_ALL, "gen " ); - } else if ( shader->optimalStageIteratorFunc == RB_StageIteratorSky ) { + } else if ( pShader->optimalStageIteratorFunc == RB_StageIteratorSky ) { ri.Printf( PRINT_ALL, "sky " ); - } else if ( shader->optimalStageIteratorFunc == RB_StageIteratorLightmappedMultitexture ) { + } else if ( pShader->optimalStageIteratorFunc == RB_StageIteratorLightmappedMultitexture ) { ri.Printf( PRINT_ALL, "lmmt" ); - } else if ( shader->optimalStageIteratorFunc == RB_StageIteratorVertexLitTexture ) { + } else if ( pShader->optimalStageIteratorFunc == RB_StageIteratorVertexLitTexture ) { ri.Printf( PRINT_ALL, "vlt " ); } else { ri.Printf( PRINT_ALL, " " ); } - if ( shader->defaultShader ) { - ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", shader->name); + if ( pShader->defaultShader ) { + ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", pShader->name); } else { - ri.Printf (PRINT_ALL, ": %s\n", shader->name); + ri.Printf (PRINT_ALL, ": %s\n", pShader->name); } count++; } diff --git a/code/renderergl1/tr_shadows.c b/code/renderergl1/tr_shadows.c index 13fbfdf7..29c5c69b 100644 --- a/code/renderergl1/tr_shadows.c +++ b/code/renderergl1/tr_shadows.c @@ -46,7 +46,7 @@ static int numEdgeDefs[SHADER_MAX_VERTEXES]; static int facing[SHADER_MAX_INDEXES/3]; static vec3_t shadowXyz[SHADER_MAX_VERTEXES]; -void R_AddEdgeDef( int i1, int i2, int facing ) { +void R_AddEdgeDef( int i1, int i2, int localFacing ) { int c; c = numEdgeDefs[ i1 ]; @@ -54,7 +54,7 @@ void R_AddEdgeDef( int i1, int i2, int facing ) { return; // overflow } edgeDefs[ i1 ][ c ].i2 = i2; - edgeDefs[ i1 ][ c ].facing = facing; + edgeDefs[ i1 ][ c ].facing = localFacing; numEdgeDefs[ i1 ]++; } @@ -94,15 +94,12 @@ void R_RenderShadowEdges( void ) { int c, c2; int j, k; int i2; - int c_edges, c_rejected; int hit[2]; // an edge is NOT a silhouette edge if its face doesn't face the light, // or if it has a reverse paired edge that also faces the light. // A well behaved polyhedron would have exactly two faces for each edge, // but lots of models have dangling edges or overfanned edges - c_edges = 0; - c_rejected = 0; for ( i = 0 ; i < tess.numVertexes ; i++ ) { c = numEdgeDefs[ i ]; @@ -131,9 +128,6 @@ void R_RenderShadowEdges( void ) { qglVertex3fv( tess.xyz[ i2 ] ); qglVertex3fv( shadowXyz[ i2 ] ); qglEnd(); - c_edges++; - } else { - c_rejected++; } } } diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index 71548779..dcb379f2 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -454,7 +454,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { backEnd.pc.c_surfaces += numDrawSurfs; for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) { - if ( drawSurf->sort == oldSort && drawSurf->cubemapIndex == oldCubemapIndex) { + if ( drawSurf->sort == (unsigned)oldSort && drawSurf->cubemapIndex == oldCubemapIndex) { if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL)) continue; @@ -462,7 +462,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface ); continue; } - oldSort = drawSurf->sort; + oldSort = (int)drawSurf->sort; R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlighted, &pshadowed ); cubemapIndex = drawSurf->cubemapIndex; @@ -1147,7 +1147,7 @@ const void *RB_DrawSurfs( const void *data ) { if (r_drawSun->integer) { - RB_DrawSun(0.1, tr.sunShader); + RB_DrawSun(0.1f, tr.sunShader); } if (glRefConfig.framebufferObject && r_drawSunRays->integer) @@ -1164,7 +1164,7 @@ const void *RB_DrawSurfs( const void *data ) { qglBeginQuery(glRefConfig.occlusionQueryTarget, tr.sunFlareQuery[tr.sunFlareQueryIndex]); } - RB_DrawSun(0.3, tr.sunFlareShader); + RB_DrawSun(0.3f, tr.sunFlareShader); if (glRefConfig.occlusionQuery) { @@ -1622,44 +1622,44 @@ const void *RB_PostProcess(const void *data) if (0 && r_sunlightMode->integer) { - ivec4_t dstBox; - VectorSet4(dstBox, 0, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 128, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 256, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 384, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); + ivec4_t dstBox2; + VectorSet4(dstBox2, 0, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 128, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 256, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 384, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); } if (0 && r_shadows->integer == 4) { - ivec4_t dstBox; - VectorSet4(dstBox, 512 + 0, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 512 + 128, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 512 + 256, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 512 + 384, glConfig.vidHeight - 128, 128, 128); - FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); + ivec4_t dstBox2; + VectorSet4(dstBox2, 512 + 0, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 512 + 128, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 512 + 256, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 512 + 384, glConfig.vidHeight - 128, 128, 128); + FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); } if (0) { - ivec4_t dstBox; - VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256); - FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); - VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256); - FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); + ivec4_t dstBox2; + VectorSet4(dstBox2, 256, glConfig.vidHeight - 256, 256, 256); + FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); + VectorSet4(dstBox2, 512, glConfig.vidHeight - 256, 256, 256); + FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); } if (0) { - ivec4_t dstBox; - VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256); - FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0); + ivec4_t dstBox2; + VectorSet4(dstBox2, 256, glConfig.vidHeight - 256, 256, 256); + FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, dstFbo, dstBox2, NULL, NULL, 0); } #if 0 diff --git a/code/renderergl2/tr_bsp.c b/code/renderergl2/tr_bsp.c index 57a4efc3..19841ce3 100644 --- a/code/renderergl2/tr_bsp.c +++ b/code/renderergl2/tr_bsp.c @@ -208,7 +208,6 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) { int i, j, numLightmaps, textureInternalFormat = 0; int numLightmapsPerPage = 16; float maxIntensity = 0; - double sumIntensity = 0; len = l->filelen; if ( !len ) { @@ -442,8 +441,6 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) { image[j*4+1] = out[1] * 255; image[j*4+2] = out[2] * 255; image[j*4+3] = 255; - - sumIntensity += intensity; } else { @@ -2795,7 +2792,7 @@ void RE_LoadWorldMap( const char *name ) { world_t *w; uint8_t *primaryLightGrid, *data; int lightGridSize; - int i; + int j; w = &s_worldData; @@ -2805,7 +2802,7 @@ void RE_LoadWorldMap( const char *name ) { memset(primaryLightGrid, 0, lightGridSize * sizeof(*primaryLightGrid)); data = w->lightGridData; - for (i = 0; i < lightGridSize; i++, data += 8) + for (j = 0; j < lightGridSize; j++, data += 8) { int lat, lng; vec3_t gridLightDir, gridLightCol; @@ -2835,39 +2832,39 @@ void RE_LoadWorldMap( const char *name ) { // FIXME: magic number for determining if light direction is close enough to sunlight if (DotProduct(gridLightDir, tr.sunDirection) > 0.75f) { - primaryLightGrid[i] = 1; + primaryLightGrid[j] = 1; } else { - primaryLightGrid[i] = 255; + primaryLightGrid[j] = 255; } } if (0) { - int i; - byte *buffer = ri.Malloc(w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18); + int k; + byte *buf = ri.Malloc(w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18); byte *out; uint8_t *in; char fileName[MAX_QPATH]; - Com_Memset (buffer, 0, 18); - buffer[2] = 2; // uncompressed type - buffer[12] = w->lightGridBounds[0] & 255; - buffer[13] = w->lightGridBounds[0] >> 8; - buffer[14] = w->lightGridBounds[1] & 255; - buffer[15] = w->lightGridBounds[1] >> 8; - buffer[16] = 24; // pixel size + Com_Memset (buf, 0, 18); + buf[2] = 2; // uncompressed type + buf[12] = w->lightGridBounds[0] & 255; + buf[13] = w->lightGridBounds[0] >> 8; + buf[14] = w->lightGridBounds[1] & 255; + buf[15] = w->lightGridBounds[1] >> 8; + buf[16] = 24; // pixel size in = primaryLightGrid; - for (i = 0; i < w->lightGridBounds[2]; i++) + for (k = 0; k < w->lightGridBounds[2]; k++) { - int j; + int l; - sprintf(fileName, "primarylg%d.tga", i); + sprintf(fileName, "primarylg%d.tga", l); - out = buffer + 18; - for (j = 0; j < w->lightGridBounds[0] * w->lightGridBounds[1]; j++) + out = buf + 18; + for (l = 0; l < w->lightGridBounds[0] * w->lightGridBounds[1]; l++) { if (*in == 1) { @@ -2890,15 +2887,15 @@ void RE_LoadWorldMap( const char *name ) { in++; } - ri.FS_WriteFile(fileName, buffer, w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18); + ri.FS_WriteFile(fileName, buf, w->lightGridBounds[0] * w->lightGridBounds[1] * 3 + 18); } - ri.Free(buffer); + ri.Free(buf); } - for (i = 0; i < w->numWorldSurfaces; i++) + for (j = 0; j < w->numWorldSurfaces; j++) { - msurface_t *surf = w->surfaces + i; + msurface_t *surf = w->surfaces + j; cullinfo_t *ci = &surf->cullinfo; if(ci->type & CULLINFO_PLANE) diff --git a/code/renderergl2/tr_cmds.c b/code/renderergl2/tr_cmds.c index 2025c41d..305404c2 100644 --- a/code/renderergl2/tr_cmds.c +++ b/code/renderergl2/tr_cmds.c @@ -239,9 +239,9 @@ void RE_SetColor( const float *rgba ) { } cmd->commandId = RC_SET_COLOR; if ( !rgba ) { - static float colorWhite[4] = { 1, 1, 1, 1 }; + static float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - rgba = colorWhite; + rgba = white; } cmd->color[0] = rgba[0]; diff --git a/code/renderergl2/tr_curve.c b/code/renderergl2/tr_curve.c index 54910d04..866710a2 100644 --- a/code/renderergl2/tr_curve.c +++ b/code/renderergl2/tr_curve.c @@ -113,7 +113,6 @@ static void MakeMeshNormals( int width, int height, srfVert_t ctrl[MAX_GRID_SIZE int i, j, k, dist; vec3_t normal; vec3_t sum; - int count = 0; vec3_t base; vec3_t delta; int x, y; @@ -153,7 +152,6 @@ static int neighbors[8][2] = { for ( i = 0 ; i < width ; i++ ) { for ( j = 0 ; j < height ; j++ ) { - count = 0; dv = &ctrl[j][i]; VectorCopy( dv->xyz, base ); for ( k = 0 ; k < 8 ; k++ ) { @@ -202,7 +200,6 @@ static int neighbors[8][2] = { continue; } VectorAdd( normal, sum, sum ); - count++; } //if ( count == 0 ) { // printf("bad normal\n"); @@ -482,7 +479,7 @@ void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height, for ( i = 0 ; i < height ; i++ ) { vec3_t midxyz; vec3_t midxyz2; - vec3_t dir; + vec3_t dirVector; vec3_t projected; float d; @@ -497,11 +494,11 @@ void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height, // texture warping, but it gives a lot less polygons than // dist-from-midpoint VectorSubtract( midxyz, ctrl[i][j].xyz, midxyz ); - VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dir ); - VectorNormalize( dir ); + VectorSubtract( ctrl[i][j+2].xyz, ctrl[i][j].xyz, dirVector ); + VectorNormalize( dirVector ); - d = DotProduct( midxyz, dir ); - VectorScale( dir, d, projected ); + d = DotProduct( midxyz, dirVector ); + VectorScale( dirVector, d, projected ); VectorSubtract( midxyz, projected, midxyz2); len = VectorLengthSquared( midxyz2 ); // we will do the sqrt later if ( len > maxLen ) { diff --git a/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index 0e829d51..be0b178e 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -1582,9 +1582,9 @@ static qboolean RawImage_ScaleToPower2( byte **data, int *inout_width, int *inou int height = *inout_height; int scaled_width; int scaled_height; - qboolean picmip = flags & IMGFLAG_PICMIP; - qboolean mipmap = flags & IMGFLAG_MIPMAP; - qboolean clampToEdge = flags & IMGFLAG_CLAMPTOEDGE; + qboolean picmip = !!(flags & IMGFLAG_PICMIP); + qboolean mipmap = !!(flags & IMGFLAG_MIPMAP); + qboolean clampToEdge = !!(flags & IMGFLAG_CLAMPTOEDGE); qboolean scaled; // @@ -1744,7 +1744,7 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm { int samples = 3; GLenum internalFormat = GL_RGB; - qboolean forceNoCompression = (flags & IMGFLAG_NO_COMPRESSION); + qboolean forceNoCompression = !!(flags & IMGFLAG_NO_COMPRESSION); qboolean normalmap = (type == IMGTYPE_NORMAL || type == IMGTYPE_NORMALHEIGHT); if (picFormat != GL_RGBA8) diff --git a/code/renderergl2/tr_main.c b/code/renderergl2/tr_main.c index 02f7d489..886a661b 100644 --- a/code/renderergl2/tr_main.c +++ b/code/renderergl2/tr_main.c @@ -72,7 +72,7 @@ qboolean R_CompareVert(srfVert_t * v1, srfVert_t * v2, qboolean checkST) ============= R_CalcTexDirs -Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html +Lengyel, Eric. �Computing Tangent Space Basis Vectors for an Arbitrary Mesh�. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html ============= */ void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2, @@ -104,7 +104,7 @@ void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2, ============= R_CalcTangentSpace -Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html +Lengyel, Eric. �Computing Tangent Space Basis Vectors for an Arbitrary Mesh�. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html ============= */ vec_t R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, const vec3_t normal, const vec3_t sdir, const vec3_t tdir) @@ -1206,7 +1206,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 int pshadowed; vec4_t clip, eye; int i; - unsigned int pointOr = 0; unsigned int pointAnd = (unsigned int)~0; R_RotateForViewer(); @@ -1236,7 +1235,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 } } pointAnd &= pointFlags; - pointOr |= pointFlags; } // trivially reject diff --git a/code/renderergl2/tr_model_iqm.c b/code/renderergl2/tr_model_iqm.c index cc12faf4..60f02d55 100644 --- a/code/renderergl2/tr_model_iqm.c +++ b/code/renderergl2/tr_model_iqm.c @@ -974,7 +974,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na for (i = 0; i < iqmData->num_surfaces; i++, vaoSurf++, surf++) { uint32_t offset_xyz, offset_st, offset_normal, offset_tangent; - uint32_t offset_blendindexes, offset_blendweights, stride; + uint32_t offset_blendindexes = 0, offset_blendweights = 0, stride; uint32_t dataSize, dataOfs; uint8_t *data; glIndex_t indexes[SHADER_MAX_INDEXES]; diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index b08a9328..14b59512 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -2686,7 +2686,7 @@ static void FixRenderCommandList( int newShader ) { { int i; drawSurf_t *drawSurf; - shader_t *shader; + shader_t *pShader; int fogNum; int entityNum; int dlightMap; @@ -2695,7 +2695,7 @@ static void FixRenderCommandList( int newShader ) { const drawSurfsCommand_t *ds_cmd = (const drawSurfsCommand_t *)curCmd; for( i = 0, drawSurf = ds_cmd->drawSurfs; i < ds_cmd->numDrawSurfs; i++, drawSurf++ ) { - R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlightMap, &pshadowMap ); + R_DecomposeSort( drawSurf->sort, &entityNum, &pShader, &fogNum, &dlightMap, &pshadowMap ); sortedIndex = (( drawSurf->sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1)); if( sortedIndex >= newShader ) { sortedIndex++; @@ -3730,43 +3730,43 @@ A second parameter will cause it to print in sorted order void R_ShaderList_f (void) { int i; int count; - shader_t *shader; + shader_t *pShader; ri.Printf (PRINT_ALL, "-----------------------\n"); count = 0; for ( i = 0 ; i < tr.numShaders ; i++ ) { if ( ri.Cmd_Argc() > 1 ) { - shader = tr.sortedShaders[i]; + pShader = tr.sortedShaders[i]; } else { - shader = tr.shaders[i]; + pShader = tr.shaders[i]; } - ri.Printf( PRINT_ALL, "%i ", shader->numUnfoggedPasses ); + ri.Printf( PRINT_ALL, "%i ", pShader->numUnfoggedPasses ); - if (shader->lightmapIndex >= 0 ) { + if (pShader->lightmapIndex >= 0 ) { ri.Printf (PRINT_ALL, "L "); } else { ri.Printf (PRINT_ALL, " "); } - if ( shader->explicitlyDefined ) { + if ( pShader->explicitlyDefined ) { ri.Printf( PRINT_ALL, "E " ); } else { ri.Printf( PRINT_ALL, " " ); } - if ( shader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) { + if ( pShader->optimalStageIteratorFunc == RB_StageIteratorGeneric ) { ri.Printf( PRINT_ALL, "gen " ); - } else if ( shader->optimalStageIteratorFunc == RB_StageIteratorSky ) { + } else if ( pShader->optimalStageIteratorFunc == RB_StageIteratorSky ) { ri.Printf( PRINT_ALL, "sky " ); } else { ri.Printf( PRINT_ALL, " " ); } - if ( shader->defaultShader ) { - ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", shader->name); + if ( pShader->defaultShader ) { + ri.Printf (PRINT_ALL, ": %s (DEFAULTED)\n", pShader->name); } else { - ri.Printf (PRINT_ALL, ": %s\n", shader->name); + ri.Printf (PRINT_ALL, ": %s\n", pShader->name); } count++; } diff --git a/code/sdl/sdl_gamma.c b/code/sdl/sdl_gamma.c index f4b5c812..1fe4c4b1 100644 --- a/code/sdl/sdl_gamma.c +++ b/code/sdl/sdl_gamma.c @@ -52,29 +52,18 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned } #ifdef _WIN32 -#include - - // Win2K and newer put this odd restriction on gamma ramps... + // Windows puts this odd restriction on gamma ramps... + ri.Printf( PRINT_DEVELOPER, "performing gamma clamp.\n" ); + for( j = 0 ; j < 3 ; j++ ) { - OSVERSIONINFO vinfo; - - vinfo.dwOSVersionInfoSize = sizeof( vinfo ); - GetVersionEx( &vinfo ); - if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) + for( i = 0 ; i < 128 ; i++ ) { - ri.Printf( PRINT_DEVELOPER, "performing gamma clamp.\n" ); - for( j = 0 ; j < 3 ; j++ ) - { - for( i = 0 ; i < 128 ; i++ ) - { - if( table[ j ] [ i] > ( ( 128 + i ) << 8 ) ) - table[ j ][ i ] = ( 128 + i ) << 8; - } - - if( table[ j ] [127 ] > 254 << 8 ) - table[ j ][ 127 ] = 254 << 8; - } + if( table[ j ][ i ] > ( ( 128 + i ) << 8 ) ) + table[ j ][ i ] = ( 128 + i ) << 8; } + + if( table[ j ][ 127 ] > 254 << 8 ) + table[ j ][ 127 ] = 254 << 8; } #endif diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 74e1ec50..39930261 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -697,21 +697,21 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder, qbool if( fullscreen ) { - SDL_DisplayMode mode; + SDL_DisplayMode desiredMode; switch( testColorBits ) { - case 16: mode.format = SDL_PIXELFORMAT_RGB565; break; - case 24: mode.format = SDL_PIXELFORMAT_RGB24; break; + case 16: desiredMode.format = SDL_PIXELFORMAT_RGB565; break; + case 24: desiredMode.format = SDL_PIXELFORMAT_RGB24; break; default: ri.Printf( PRINT_DEVELOPER, "testColorBits is %d, can't fullscreen\n", testColorBits ); continue; } - mode.w = glConfig.vidWidth; - mode.h = glConfig.vidHeight; - mode.refresh_rate = glConfig.displayFrequency = ri.Cvar_VariableIntegerValue( "r_displayRefresh" ); - mode.driverdata = NULL; + desiredMode.w = glConfig.vidWidth; + desiredMode.h = glConfig.vidHeight; + desiredMode.refresh_rate = glConfig.displayFrequency = ri.Cvar_VariableIntegerValue( "r_displayRefresh" ); + desiredMode.driverdata = NULL; - if( SDL_SetWindowDisplayMode( SDL_window, &mode ) < 0 ) + if( SDL_SetWindowDisplayMode( SDL_window, &desiredMode ) < 0 ) { ri.Printf( PRINT_DEVELOPER, "SDL_SetWindowDisplayMode failed: %s\n", SDL_GetError( ) ); continue; diff --git a/code/server/sv_main.c b/code/server/sv_main.c index b56b13b1..88435bff 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -1027,7 +1027,7 @@ SV_FrameMsec Return time in millseconds until processing of the next server frame. ================== */ -int SV_FrameMsec() +int SV_FrameMsec(void) { if(sv_fps) { @@ -1223,7 +1223,7 @@ Return the time in msec until we expect to be called next ==================== */ -int SV_SendQueuedPackets() +int SV_SendQueuedPackets(void) { int numBlocks; int dlStart, deltaT, delayT; diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index 59230c56..3f70b1fd 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -898,7 +898,7 @@ qboolean Sys_PIDIsRunning( int pid ) // Search for the pid for( i = 0; i < numProcesses; i++ ) { - if( processes[ i ] == pid ) + if( (int)processes[ i ] == pid ) return qtrue; } diff --git a/code/tools/asm/cmdlib.c b/code/tools/asm/cmdlib.c index f9274611..ab0ea24e 100644 --- a/code/tools/asm/cmdlib.c +++ b/code/tools/asm/cmdlib.c @@ -559,7 +559,7 @@ int Q_stricmp (const char *s1, const char *s2) } -char *strupr (char *start) +char *Q_strupr (char *start) { char *in; in = start; @@ -571,7 +571,7 @@ char *strupr (char *start) return start; } -char *strlower (char *start) +char *Q_strlower (char *start) { char *in; in = start; diff --git a/code/tools/asm/cmdlib.h b/code/tools/asm/cmdlib.h index 3233abd6..c4bc0f3f 100644 --- a/code/tools/asm/cmdlib.h +++ b/code/tools/asm/cmdlib.h @@ -67,8 +67,8 @@ typedef unsigned char byte; extern int myargc; extern char **myargv; -char *strupr (char *in); -char *strlower (char *in); +char *Q_strupr (char *in); +char *Q_strlower (char *in); int Q_strncasecmp( const char *s1, const char *s2, int n ); int Q_stricmp( const char *s1, const char *s2 ); void Q_getwd( char *out ); diff --git a/code/tools/asm/q3asm.c b/code/tools/asm/q3asm.c index bf6efd66..b9f95532 100644 --- a/code/tools/asm/q3asm.c +++ b/code/tools/asm/q3asm.c @@ -592,7 +592,7 @@ Symbols can only be evaluated on pass 1 */ static int LookupSymbol( char *sym ) { symbol_t *s; - char expanded[MAX_LINE_LENGTH]; + char expanded[MAX_LINE_LENGTH * 2]; int hash; hashchain_t *hc; diff --git a/code/tools/lcc/etc/lcc.c b/code/tools/lcc/etc/lcc.c index b608887f..8dd0f30b 100644 --- a/code/tools/lcc/etc/lcc.c +++ b/code/tools/lcc/etc/lcc.c @@ -53,10 +53,6 @@ extern char *stringf(const char *, ...); extern int suffix(char *, char *[], int); extern char *tempname(char *); -#ifndef __sun -extern int getpid(void); -#endif - extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[]; extern int option(char *); diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 4480d50d..16919376 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -3159,11 +3159,11 @@ static void UI_Update(const char *name) { } static void UI_RunMenuScript(char **args) { - const char *name, *name2; + const char *command; char buff[1024]; - if (String_Parse(args, &name)) { - if (Q_stricmp(name, "StartServer") == 0) { + if (String_Parse(args, &command)) { + if (Q_stricmp(command, "StartServer") == 0) { int i, clients, oldclients; float skill; trap_Cvar_Set("cg_thirdPerson", "0"); @@ -3218,7 +3218,7 @@ static void UI_RunMenuScript(char **args) { trap_Cmd_ExecuteText( EXEC_APPEND, buff ); } } - } else if (Q_stricmp(name, "updateSPMenu") == 0) { + } else if (Q_stricmp(command, "updateSPMenu") == 0) { UI_SetCapFragLimits(qtrue); UI_MapCountByGameType(qtrue); ui_mapIndex.integer = UI_GetIndexFromSelection(ui_currentMap.integer); @@ -3226,7 +3226,7 @@ static void UI_RunMenuScript(char **args) { Menu_SetFeederSelection(NULL, FEEDER_MAPS, ui_mapIndex.integer, "skirmish"); UI_GameType_HandleKey(0, NULL, K_MOUSE1, qfalse); UI_GameType_HandleKey(0, NULL, K_MOUSE2, qfalse); - } else if (Q_stricmp(name, "resetDefaults") == 0) { + } else if (Q_stricmp(command, "resetDefaults") == 0) { trap_Cmd_ExecuteText( EXEC_APPEND, "exec default.cfg\n"); trap_Cmd_ExecuteText( EXEC_APPEND, "cvar_restart\n"); Controls_SetDefaults(); @@ -3234,7 +3234,7 @@ static void UI_RunMenuScript(char **args) { trap_Cvar_Set("com_introPlayed", "1" ); #endif trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); - } else if (Q_stricmp(name, "getCDKey") == 0) { + } else if (Q_stricmp(command, "getCDKey") == 0) { char out[17]; trap_GetCDKey(buff, 17); trap_Cvar_Set("cdkey1", ""); @@ -3252,7 +3252,7 @@ static void UI_RunMenuScript(char **args) { trap_Cvar_Set("cdkey4", out); } - } else if (Q_stricmp(name, "verifyCDKey") == 0) { + } else if (Q_stricmp(command, "verifyCDKey") == 0) { buff[0] = '\0'; Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey1")); Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey2")); @@ -3265,55 +3265,55 @@ static void UI_RunMenuScript(char **args) { } else { trap_Cvar_Set("ui_cdkeyvalid", "CD Key does not appear to be valid."); } - } else if (Q_stricmp(name, "loadArenas") == 0) { + } else if (Q_stricmp(command, "loadArenas") == 0) { UI_LoadArenasIntoMapList(); UI_MapCountByGameType(qfalse); Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "createserver"); - } else if (Q_stricmp(name, "saveControls") == 0) { + } else if (Q_stricmp(command, "saveControls") == 0) { Controls_SetConfig(qtrue); - } else if (Q_stricmp(name, "loadControls") == 0) { + } else if (Q_stricmp(command, "loadControls") == 0) { Controls_GetConfig(); - } else if (Q_stricmp(name, "clearError") == 0) { + } else if (Q_stricmp(command, "clearError") == 0) { trap_Cvar_Set("com_errorMessage", ""); - } else if (Q_stricmp(name, "loadGameInfo") == 0) { + } else if (Q_stricmp(command, "loadGameInfo") == 0) { #ifdef PRE_RELEASE_TADEMO UI_ParseGameInfo("demogameinfo.txt"); #else UI_ParseGameInfo("gameinfo.txt"); #endif UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum); - } else if (Q_stricmp(name, "resetScores") == 0) { + } else if (Q_stricmp(command, "resetScores") == 0) { UI_ClearScores(); - } else if (Q_stricmp(name, "RefreshServers") == 0) { + } else if (Q_stricmp(command, "RefreshServers") == 0) { UI_StartServerRefresh(qtrue, qtrue); UI_BuildServerDisplayList(qtrue); - } else if (Q_stricmp(name, "RefreshFilter") == 0) { + } else if (Q_stricmp(command, "RefreshFilter") == 0) { UI_StartServerRefresh(qfalse, qtrue); UI_BuildServerDisplayList(qtrue); - } else if (Q_stricmp(name, "RunSPDemo") == 0) { + } else if (Q_stricmp(command, "RunSPDemo") == 0) { if (uiInfo.demoAvailable) { trap_Cmd_ExecuteText( EXEC_APPEND, va("demo %s_%i\n", uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum)); } - } else if (Q_stricmp(name, "LoadDemos") == 0) { + } else if (Q_stricmp(command, "LoadDemos") == 0) { UI_LoadDemos(); - } else if (Q_stricmp(name, "LoadMovies") == 0) { + } else if (Q_stricmp(command, "LoadMovies") == 0) { UI_LoadMovies(); - } else if (Q_stricmp(name, "LoadMods") == 0) { + } else if (Q_stricmp(command, "LoadMods") == 0) { UI_LoadMods(); - } else if (Q_stricmp(name, "playMovie") == 0) { + } else if (Q_stricmp(command, "playMovie") == 0) { if (uiInfo.previewMovie >= 0) { trap_CIN_StopCinematic(uiInfo.previewMovie); } trap_Cmd_ExecuteText( EXEC_APPEND, va("cinematic %s.roq 2\n", uiInfo.movieList[uiInfo.movieIndex])); - } else if (Q_stricmp(name, "RunMod") == 0) { + } else if (Q_stricmp(command, "RunMod") == 0) { trap_Cvar_Set( "fs_game", uiInfo.modList[uiInfo.modIndex].modName); trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" ); - } else if (Q_stricmp(name, "RunDemo") == 0) { + } else if (Q_stricmp(command, "RunDemo") == 0) { trap_Cmd_ExecuteText( EXEC_APPEND, va("demo %s\n", uiInfo.demoList[uiInfo.demoIndex])); - } else if (Q_stricmp(name, "Quake3") == 0) { + } else if (Q_stricmp(command, "Quake3") == 0) { trap_Cvar_Set( "fs_game", ""); trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" ); - } else if (Q_stricmp(name, "closeJoin") == 0) { + } else if (Q_stricmp(command, "closeJoin") == 0) { if (uiInfo.serverStatus.refreshActive) { UI_StopServerRefresh(); uiInfo.serverStatus.nextDisplayRefresh = 0; @@ -3324,29 +3324,29 @@ static void UI_RunMenuScript(char **args) { Menus_CloseByName("joinserver"); Menus_OpenByName("main"); } - } else if (Q_stricmp(name, "StopRefresh") == 0) { + } else if (Q_stricmp(command, "StopRefresh") == 0) { UI_StopServerRefresh(); uiInfo.serverStatus.nextDisplayRefresh = 0; uiInfo.nextServerStatusRefresh = 0; uiInfo.nextFindPlayerRefresh = 0; - } else if (Q_stricmp(name, "UpdateFilter") == 0) { + } else if (Q_stricmp(command, "UpdateFilter") == 0) { // UpdateFilter is called when server broser menu is opened and when a favorite server is deleted. UI_StartServerRefresh(qtrue, qfalse); UI_BuildServerDisplayList(qtrue); UI_FeederSelection(FEEDER_SERVERS, 0); - } else if (Q_stricmp(name, "ServerStatus") == 0) { + } else if (Q_stricmp(command, "ServerStatus") == 0) { trap_LAN_GetServerAddressString(UI_SourceForLAN(), uiInfo.serverStatus.displayServers[uiInfo.serverStatus.currentServer], uiInfo.serverStatusAddress, sizeof(uiInfo.serverStatusAddress)); UI_BuildServerStatus(qtrue); - } else if (Q_stricmp(name, "FoundPlayerServerStatus") == 0) { + } else if (Q_stricmp(command, "FoundPlayerServerStatus") == 0) { Q_strncpyz(uiInfo.serverStatusAddress, uiInfo.foundPlayerServerAddresses[uiInfo.currentFoundPlayerServer], sizeof(uiInfo.serverStatusAddress)); UI_BuildServerStatus(qtrue); Menu_SetFeederSelection(NULL, FEEDER_FINDPLAYER, 0, NULL); - } else if (Q_stricmp(name, "FindPlayer") == 0) { + } else if (Q_stricmp(command, "FindPlayer") == 0) { UI_BuildFindPlayerList(qtrue); // clear the displayed server status info uiInfo.serverStatusInfo.numLines = 0; Menu_SetFeederSelection(NULL, FEEDER_FINDPLAYER, 0, NULL); - } else if (Q_stricmp(name, "JoinServer") == 0) { + } else if (Q_stricmp(command, "JoinServer") == 0) { trap_Cvar_Set("cg_thirdPerson", "0"); trap_Cvar_Set("cg_cameraOrbit", "0"); trap_Cvar_Set("ui_singlePlayerActive", "0"); @@ -3354,25 +3354,25 @@ static void UI_RunMenuScript(char **args) { trap_LAN_GetServerAddressString(UI_SourceForLAN(), uiInfo.serverStatus.displayServers[uiInfo.serverStatus.currentServer], buff, 1024); trap_Cmd_ExecuteText( EXEC_APPEND, va( "connect %s\n", buff ) ); } - } else if (Q_stricmp(name, "FoundPlayerJoinServer") == 0) { + } else if (Q_stricmp(command, "FoundPlayerJoinServer") == 0) { trap_Cvar_Set("ui_singlePlayerActive", "0"); if (uiInfo.currentFoundPlayerServer >= 0 && uiInfo.currentFoundPlayerServer < uiInfo.numFoundPlayerServers) { trap_Cmd_ExecuteText( EXEC_APPEND, va( "connect %s\n", uiInfo.foundPlayerServerAddresses[uiInfo.currentFoundPlayerServer] ) ); } - } else if (Q_stricmp(name, "Quit") == 0) { + } else if (Q_stricmp(command, "Quit") == 0) { trap_Cvar_Set("ui_singlePlayerActive", "0"); trap_Cmd_ExecuteText( EXEC_NOW, "quit"); - } else if (Q_stricmp(name, "Controls") == 0) { + } else if (Q_stricmp(command, "Controls") == 0) { trap_Cvar_Set( "cl_paused", "1" ); trap_Key_SetCatcher( KEYCATCH_UI ); Menus_CloseAll(); Menus_ActivateByName("setup_menu2"); - } else if (Q_stricmp(name, "Leave") == 0) { + } else if (Q_stricmp(command, "Leave") == 0) { trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" ); trap_Key_SetCatcher( KEYCATCH_UI ); Menus_CloseAll(); Menus_ActivateByName("main"); - } else if (Q_stricmp(name, "ServerSort") == 0) { + } else if (Q_stricmp(command, "ServerSort") == 0) { int sortColumn; if (Int_Parse(args, &sortColumn)) { // if same column we're already sorting on then flip the direction @@ -3382,38 +3382,38 @@ static void UI_RunMenuScript(char **args) { // make sure we sort again UI_ServersSort(sortColumn, qtrue); } - } else if (Q_stricmp(name, "nextSkirmish") == 0) { + } else if (Q_stricmp(command, "nextSkirmish") == 0) { UI_StartSkirmish(qtrue); - } else if (Q_stricmp(name, "SkirmishStart") == 0) { + } else if (Q_stricmp(command, "SkirmishStart") == 0) { UI_StartSkirmish(qfalse); - } else if (Q_stricmp(name, "closeingame") == 0) { + } else if (Q_stricmp(command, "closeingame") == 0) { trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI ); trap_Key_ClearStates(); trap_Cvar_Set( "cl_paused", "0" ); Menus_CloseAll(); - } else if (Q_stricmp(name, "voteMap") == 0) { + } else if (Q_stricmp(command, "voteMap") == 0) { if (ui_currentNetMap.integer >=0 && ui_currentNetMap.integer < uiInfo.mapCount) { trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote map %s\n",uiInfo.mapList[ui_currentNetMap.integer].mapLoadName) ); } - } else if (Q_stricmp(name, "voteKick") == 0) { + } else if (Q_stricmp(command, "voteKick") == 0) { if (uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount) { trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote kick %s\n",uiInfo.playerNames[uiInfo.playerIndex]) ); } - } else if (Q_stricmp(name, "voteGame") == 0) { + } else if (Q_stricmp(command, "voteGame") == 0) { if (ui_netGameType.integer >= 0 && ui_netGameType.integer < uiInfo.numGameTypes) { trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote g_gametype %i\n",uiInfo.gameTypes[ui_netGameType.integer].gtEnum) ); } - } else if (Q_stricmp(name, "voteLeader") == 0) { + } else if (Q_stricmp(command, "voteLeader") == 0) { if (uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount) { trap_Cmd_ExecuteText( EXEC_APPEND, va("callteamvote leader %s\n",uiInfo.teamNames[uiInfo.teamIndex]) ); } - } else if (Q_stricmp(name, "addBot") == 0) { + } else if (Q_stricmp(command, "addBot") == 0) { if (trap_Cvar_VariableValue("g_gametype") >= GT_TEAM) { trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", uiInfo.characterList[uiInfo.botIndex].name, uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); } else { trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", UI_GetBotNameByNumber(uiInfo.botIndex), uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); } - } else if (Q_stricmp(name, "addFavorite") == 0) { + } else if (Q_stricmp(command, "addFavorite") == 0) { if (ui_netSource.integer != UIAS_FAVORITES) { char name[MAX_NAME_LENGTH]; char addr[MAX_ADDRESSLENGTH]; @@ -3439,7 +3439,7 @@ static void UI_RunMenuScript(char **args) { } } } - } else if (Q_stricmp(name, "deleteFavorite") == 0) { + } else if (Q_stricmp(command, "deleteFavorite") == 0) { if (ui_netSource.integer == UIAS_FAVORITES) { char addr[MAX_ADDRESSLENGTH]; trap_LAN_GetServerInfo(AS_FAVORITES, uiInfo.serverStatus.displayServers[uiInfo.serverStatus.currentServer], buff, MAX_STRING_CHARS); @@ -3449,7 +3449,7 @@ static void UI_RunMenuScript(char **args) { trap_LAN_RemoveServer(AS_FAVORITES, addr); } } - } else if (Q_stricmp(name, "createFavorite") == 0) { + } else if (Q_stricmp(command, "createFavorite") == 0) { char name[MAX_NAME_LENGTH]; char addr[MAX_ADDRESSLENGTH]; int res; @@ -3472,7 +3472,7 @@ static void UI_RunMenuScript(char **args) { Com_Printf("Added favorite server %s\n", addr); } } - } else if (Q_stricmp(name, "orders") == 0) { + } else if (Q_stricmp(command, "orders") == 0) { const char *orders; if (String_Parse(args, &orders)) { int selectedPlayer = trap_Cvar_VariableValue("cg_selectedPlayer"); @@ -3496,7 +3496,7 @@ static void UI_RunMenuScript(char **args) { trap_Cvar_Set( "cl_paused", "0" ); Menus_CloseAll(); } - } else if (Q_stricmp(name, "voiceOrdersTeam") == 0) { + } else if (Q_stricmp(command, "voiceOrdersTeam") == 0) { const char *orders; if (String_Parse(args, &orders)) { int selectedPlayer = trap_Cvar_VariableValue("cg_selectedPlayer"); @@ -3509,7 +3509,7 @@ static void UI_RunMenuScript(char **args) { trap_Cvar_Set( "cl_paused", "0" ); Menus_CloseAll(); } - } else if (Q_stricmp(name, "voiceOrders") == 0) { + } else if (Q_stricmp(command, "voiceOrders") == 0) { const char *orders; if (String_Parse(args, &orders)) { int selectedPlayer = trap_Cvar_VariableValue("cg_selectedPlayer"); @@ -3523,19 +3523,20 @@ static void UI_RunMenuScript(char **args) { trap_Cvar_Set( "cl_paused", "0" ); Menus_CloseAll(); } - } else if (Q_stricmp(name, "glCustom") == 0) { + } else if (Q_stricmp(command, "glCustom") == 0) { trap_Cvar_Set("ui_glCustom", "4"); - } else if (Q_stricmp(name, "update") == 0) { - if (String_Parse(args, &name2)) { - UI_Update(name2); + } else if (Q_stricmp(command, "update") == 0) { + const char *name; + if (String_Parse(args, &name)) { + UI_Update(name); } - } else if (Q_stricmp(name, "setPbClStatus") == 0) { + } else if (Q_stricmp(command, "setPbClStatus") == 0) { int stat; if ( Int_Parse( args, &stat ) ) trap_SetPbClStatus( stat ); } else { - Com_Printf("unknown UI script %s\n", name); + Com_Printf("unknown UI script %s\n", command); } } } @@ -3740,7 +3741,6 @@ static void UI_BuildServerDisplayList(int force) { int i, count, clients, maxClients, ping, game, len, visible; char info[MAX_STRING_CHARS]; // qboolean startRefresh = qtrue; TTimo: unused - static int numinvisible; int lanSource; if (!(force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh)) { @@ -3766,7 +3766,6 @@ static void UI_BuildServerDisplayList(int force) { lanSource = UI_SourceForLAN(); if (force) { - numinvisible = 0; // clear number of displayed servers uiInfo.serverStatus.numDisplayServers = 0; uiInfo.serverStatus.numPlayersOnServers = 0; @@ -3850,7 +3849,6 @@ static void UI_BuildServerDisplayList(int force) { if (ping > 0) { trap_LAN_MarkServerVisible(lanSource, i, qfalse); uiInfo.serverStatus.numPlayersOnServers += clients; - numinvisible++; } } } @@ -4048,7 +4046,7 @@ UI_BuildFindPlayerList ================== */ static void UI_BuildFindPlayerList(qboolean force) { - static int numFound, numTimeOuts; + static int numFound; int i, j, resend; serverStatusInfo_t info; char name[MAX_NAME_LENGTH+2]; @@ -4085,7 +4083,6 @@ static void UI_BuildFindPlayerList(qboolean force) { sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), "searching %d...", uiInfo.pendingServerStatus.num); numFound = 0; - numTimeOuts++; } for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { // if this pending server is valid @@ -4132,9 +4129,6 @@ static void UI_BuildFindPlayerList(qboolean force) { // if empty pending slot or timed out if (!uiInfo.pendingServerStatus.server[i].valid || uiInfo.pendingServerStatus.server[i].startTime < uiInfo.uiDC.realTime - ui_serverStatusTimeOut.integer) { - if (uiInfo.pendingServerStatus.server[i].valid) { - numTimeOuts++; - } // reset server status request for this address UI_GetServerStatusInfo( uiInfo.pendingServerStatus.server[i].adrstr, NULL ); // reuse pending slot