[iortcw] 209/497: SP: Fix a bunch of stuff flagged by clang analyzer
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit b1b283f4f6a10428ad1c6adf901cd104093ae9f3
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Mon Sep 8 19:45:04 2014 +0000
SP: Fix a bunch of stuff flagged by clang analyzer
---
MP/code/client/snd_mix.c | 4 ++
MP/code/game/ai_cast_events.c | 4 +-
SP/Makefile | 4 ++
SP/code/botlib/be_aas_reach.c | 5 +-
SP/code/botlib/be_aas_route.c | 4 +-
SP/code/botlib/be_aas_sample.c | 8 ++-
SP/code/botlib/be_ai_move.c | 4 ++
SP/code/botlib/l_precomp.c | 17 ++----
SP/code/cgame/cg_draw.c | 25 +++------
SP/code/cgame/cg_drawtools.c | 3 -
SP/code/cgame/cg_effects.c | 30 +++++-----
SP/code/cgame/cg_flamethrower.c | 3 +-
SP/code/cgame/cg_info.c | 4 +-
SP/code/cgame/cg_localents.c | 4 --
SP/code/cgame/cg_marks.c | 2 +-
SP/code/cgame/cg_newdraw.c | 7 ---
SP/code/cgame/cg_players.c | 19 +++----
SP/code/cgame/cg_scoreboard.c | 11 +---
SP/code/cgame/cg_view.c | 11 ----
SP/code/cgame/cg_weapons.c | 16 +-----
SP/code/client/cl_ui.c | 2 +-
SP/code/client/snd_mix.c | 20 +++++--
SP/code/client/snd_wavelet.c | 4 +-
SP/code/game/ai_cast_events.c | 7 ++-
SP/code/game/ai_cast_fight.c | 2 +-
SP/code/game/ai_cast_func_boss1.c | 2 +-
SP/code/game/ai_cast_funcs.c | 30 ++++------
SP/code/game/ai_cast_script.c | 1 -
SP/code/game/ai_cast_script_actions.c | 2 +-
SP/code/game/ai_cast_sight.c | 4 +-
SP/code/game/ai_cast_think.c | 10 ++--
SP/code/game/ai_dmq3.c | 2 +-
SP/code/game/ai_main.c | 4 ++
SP/code/game/ai_team.c | 6 +-
SP/code/game/bg_animation.c | 12 +++-
SP/code/game/bg_misc.c | 1 -
SP/code/game/bg_pmove.c | 24 +++-----
SP/code/game/g_active.c | 11 ++--
SP/code/game/g_alarm.c | 8 ++-
SP/code/game/g_items.c | 8 ++-
SP/code/game/g_misc.c | 6 +-
SP/code/game/g_mover.c | 2 +-
SP/code/game/g_props.c | 6 +-
SP/code/game/g_save.c | 2 +-
SP/code/game/g_script.c | 1 -
SP/code/game/g_target.c | 2 +-
SP/code/game/g_team.c | 3 +-
SP/code/game/g_tramcar.c | 4 ++
SP/code/qcommon/files.c | 4 ++
SP/code/qcommon/msg.c | 5 +-
SP/code/rend2/tr_backend.c | 9 +++
SP/code/rend2/tr_bsp.c | 10 ++--
SP/code/rend2/tr_flares.c | 2 +-
SP/code/rend2/tr_image.c | 69 ++---------------------
SP/code/rend2/tr_init.c | 6 +-
SP/code/rend2/tr_local.h | 2 -
SP/code/rend2/tr_model.c | 6 +-
SP/code/rend2/tr_model_iqm.c | 2 +-
SP/code/rend2/tr_shade_calc.c | 2 +-
SP/code/rend2/tr_shader.c | 2 +-
SP/code/rend2/tr_surface.c | 103 +---------------------------------
SP/code/rend2/tr_world.c | 3 +
SP/code/renderer/tr_backend.c | 3 +-
SP/code/renderer/tr_bsp.c | 8 +--
SP/code/renderer/tr_flares.c | 2 +-
SP/code/renderer/tr_image.c | 75 +++++--------------------
SP/code/renderer/tr_init.c | 6 +-
SP/code/renderer/tr_local.h | 2 -
SP/code/renderer/tr_model.c | 22 ++++----
SP/code/renderer/tr_model_iqm.c | 2 +-
SP/code/renderer/tr_shade_calc.c | 6 +-
SP/code/renderer/tr_surface.c | 95 -------------------------------
SP/code/renderer/tr_world.c | 10 ++--
SP/code/splines/splines.cpp | 11 +++-
SP/code/ui/ui_main.c | 2 +-
SP/code/ui/ui_players.c | 5 ++
SP/code/ui/ui_shared.c | 5 +-
77 files changed, 266 insertions(+), 584 deletions(-)
diff --git a/MP/code/client/snd_mix.c b/MP/code/client/snd_mix.c
index 1efe1e3..943c50f 100644
--- a/MP/code/client/snd_mix.c
+++ b/MP/code/client/snd_mix.c
@@ -236,6 +236,10 @@ static void S_PaintChannelFrom16_altivec( channel_t *ch, const sfx_t *sc, int co
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
+ if (sc->soundChannels <= 0) {
+ return;
+ }
+
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {
diff --git a/MP/code/game/ai_cast_events.c b/MP/code/game/ai_cast_events.c
index f317a66..f52606d 100644
--- a/MP/code/game/ai_cast_events.c
+++ b/MP/code/game/ai_cast_events.c
@@ -173,7 +173,7 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
}
// record the sighting (FIXME: silent weapons shouldn't do this, but the AI should react in some way)
- if ( attacker && attacker != self ) {
+ if ( attacker && attacker->client ) {
AICast_UpdateVisibility( self, attacker, qtrue, qtrue );
}
@@ -316,7 +316,7 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// set enemy weapon
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, 0, qfalse );
- if ( attacker && attacker != self ) {
+ if ( attacker && attacker->client ) {
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, inflictor->s.weapon, qtrue );
} else {
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, 0, qfalse );
diff --git a/SP/Makefile b/SP/Makefile
index 6b01648..4896b0a 100644
--- a/SP/Makefile
+++ b/SP/Makefile
@@ -1141,6 +1141,10 @@ ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
BASE_CFLAGS += -Qunused-arguments
endif
+ifeq ("$(CXX)", $(findstring "$(CXX)", "clang" "clang++"))
+ BASE_CFLAGS += -Qunused-arguments
+endif
+
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
endif
diff --git a/SP/code/botlib/be_aas_reach.c b/SP/code/botlib/be_aas_reach.c
index 63fd841..ecede77 100644
--- a/SP/code/botlib/be_aas_reach.c
+++ b/SP/code/botlib/be_aas_reach.c
@@ -3455,13 +3455,14 @@ void AAS_Reachability_JumpPad( void ) {
velocity[2] = time * gravity;
//get the areas the jump pad brush is in
areas = AAS_LinkEntityClientBBox( absmins, absmaxs, -1, PRESENCE_CROUCH );
- //*
+ /*
for ( link = areas; link; link = link->next_area )
{
if ( link->areanum == 5772 ) {
ret = qfalse;
}
- } //*/
+ }
+ */
for ( link = areas; link; link = link->next_area )
{
if ( AAS_AreaJumpPad( link->areanum ) ) {
diff --git a/SP/code/botlib/be_aas_route.c b/SP/code/botlib/be_aas_route.c
index fd90d7b..31580e3 100644
--- a/SP/code/botlib/be_aas_route.c
+++ b/SP/code/botlib/be_aas_route.c
@@ -1020,8 +1020,6 @@ aas_routingcache_t *AAS_ReadCache( fileHandle_t fp ) {
numtraveltimes = ( size - sizeof( aas_routingcache_32_t ) ) / 3;
- cache_reachabilities = (unsigned char *) cache + sizeof( aas_routingcache_32_t ) + numtraveltimes * sizeof (cache->traveltimes[0]);
-
if ( sizeof (intptr_t) == 4 ) {
nativecache = (aas_routingcache_t *) cache;
} else {
@@ -1052,6 +1050,8 @@ aas_routingcache_t *AAS_ReadCache( fileHandle_t fp ) {
// copy reachabilities to native structure, free original cache
if ( sizeof (intptr_t) != 4 ) {
for ( i = 0; i < numtraveltimes; i++ ) {
+ cache_reachabilities = (unsigned char *) cache + sizeof( aas_routingcache_32_t ) + numtraveltimes * sizeof (cache->traveltimes[0]);
+
nativecache->reachabilities[i] = cache_reachabilities[i];
}
diff --git a/SP/code/botlib/be_aas_sample.c b/SP/code/botlib/be_aas_sample.c
index 997cc9b..2eaba08 100644
--- a/SP/code/botlib/be_aas_sample.c
+++ b/SP/code/botlib/be_aas_sample.c
@@ -411,9 +411,11 @@ aas_trace_t AAS_TraceClientBBox( vec3_t start, vec3_t end, int presencetype,
//exactly the same when they're both the start point
if ( tstack_p->start[0] == start[0] &&
tstack_p->start[1] == start[1] &&
- tstack_p->start[2] == start[2] ) {
+ tstack_p->start[2] == start[2] )
+ {
trace.startsolid = qtrue;
trace.fraction = 0.0;
+ VectorClear(v1);
} //end if
else
{
@@ -460,9 +462,11 @@ aas_trace_t AAS_TraceClientBBox( vec3_t start, vec3_t end, int presencetype,
//exactly the same when they're both the start point
if ( tstack_p->start[0] == start[0] &&
tstack_p->start[1] == start[1] &&
- tstack_p->start[2] == start[2] ) {
+ tstack_p->start[2] == start[2] )
+ {
trace.startsolid = qtrue;
trace.fraction = 0.0;
+ VectorClear(v1);
} //end if
else
{
diff --git a/SP/code/botlib/be_ai_move.c b/SP/code/botlib/be_ai_move.c
index dfcab07..6f5af51 100644
--- a/SP/code/botlib/be_ai_move.c
+++ b/SP/code/botlib/be_ai_move.c
@@ -1211,6 +1211,9 @@ int Intersection( vec2_t p1, vec2_t p2, vec2_t p3, vec2_t p4, vec2_t out ) {
// Changes Globals: -
//===========================================================================
void BotCheckBlocked( bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_moveresult_t *result ) {
+ // RF, not required for Wolf AI
+ return;
+#if 0
vec3_t mins, maxs, end, up = {0, 0, 1};
bsp_trace_t trace;
@@ -1249,6 +1252,7 @@ void BotCheckBlocked( bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_move
#endif //DEBUG
} //end if
} //end else
+#endif
} //end of the function BotCheckBlocked
//===========================================================================
//
diff --git a/SP/code/botlib/l_precomp.c b/SP/code/botlib/l_precomp.c
index 9fd28eb..22fd3f1 100644
--- a/SP/code/botlib/l_precomp.c
+++ b/SP/code/botlib/l_precomp.c
@@ -1167,25 +1167,20 @@ int PC_Directive_define( source_t *source ) {
#else
define = PC_FindDefine( source->defines, token.string );
#endif //DEFINEHASHING
- if ( define ) {
- if ( define->flags & DEFINE_FIXED ) {
+ if ( define )
+ {
+ if ( define->flags & DEFINE_FIXED )
+ {
SourceError( source, "can't redefine %s", token.string );
return qfalse;
} //end if
SourceWarning( source, "redefinition of %s", token.string );
//unread the define name before executing the #undef directive
PC_UnreadSourceToken( source, &token );
- if ( !PC_Directive_undef( source ) ) {
+ if ( !PC_Directive_undef( source ) )
return qfalse;
- }
- //if the define was not removed (define->flags & DEFINE_FIXED)
-#if DEFINEHASHING
- define = PC_FindHashedDefine( source->definehash, token.string );
-#else
- define = PC_FindDefine( source->defines, token.string );
-#endif //DEFINEHASHING
} //end if
- //allocate define
+ //allocate define
define = (define_t *) GetMemory(sizeof(define_t));
memset( define, 0, sizeof( define_t ) );
define->name = (char *) GetMemory(strlen(token.string) + 1);
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index 4f310c5..5009433 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -1195,7 +1195,7 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
y = CG_DrawFPS( y );
}
if ( cg_drawTimer.integer ) {
- y = CG_DrawTimer( y );
+ CG_DrawTimer( y );
}
// (SA) disabling drawattacker for the time being
// if ( cg_drawAttacker.integer ) {
@@ -3180,8 +3180,6 @@ CG_DrawFlashLightning
=================
*/
static void CG_DrawFlashLightning( void ) {
- //vec4_t col={1,1,1,1}; // TTimo: unused
- float alpha;
centity_t *cent;
qhandle_t shader;
@@ -3199,20 +3197,13 @@ static void CG_DrawFlashLightning( void ) {
return;
}
- alpha = 1.0 - (float)( cg.time - cent->pe.teslaDamagedTime ) / LIGHTNING_FLASH_TIME;
- if ( alpha > 0 ) {
- if ( alpha >= 1.0 ) {
- alpha = 1.0;
- }
-
- if ( ( cg.time / 50 ) % ( 2 + ( cg.time % 2 ) ) == 0 ) {
- shader = cgs.media.viewTeslaAltDamageEffectShader;
- } else {
- shader = cgs.media.viewTeslaDamageEffectShader;
- }
-
- CG_DrawPic( -10, -10, 650, 490, shader );
+ if ( ( cg.time / 50 ) % ( 2 + ( cg.time % 2 ) ) == 0 ) {
+ shader = cgs.media.viewTeslaAltDamageEffectShader;
+ } else {
+ shader = cgs.media.viewTeslaDamageEffectShader;
}
+
+ CG_DrawPic( -10, -10, 650, 490, shader );
}
@@ -3314,8 +3305,6 @@ static void CG_DrawObjectiveInfo( void ) {
x2 = x1 + w;
}
- x = OID_LEFT;
-
y += cg.oidPrintCharWidth * 1.5;
while ( *start && ( *start != '\n' ) ) {
diff --git a/SP/code/cgame/cg_drawtools.c b/SP/code/cgame/cg_drawtools.c
index a121fe7..dff1484 100644
--- a/SP/code/cgame/cg_drawtools.c
+++ b/SP/code/cgame/cg_drawtools.c
@@ -516,9 +516,6 @@ void CG_DrawStringExt3( int x, int y, const char *string, const float *setColor,
x -= xx;
- s = string;
- xx = x;
-
// draw the drop shadow
if ( shadow ) {
color[0] = color[1] = color[2] = 0;
diff --git a/SP/code/cgame/cg_effects.c b/SP/code/cgame/cg_effects.c
index 4974217..2534446 100644
--- a/SP/code/cgame/cg_effects.c
+++ b/SP/code/cgame/cg_effects.c
@@ -267,10 +267,13 @@ localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
VectorCopy( newOrigin, ex->refEntity.oldorigin );
// Ridah, move away from the wall as the sprite expands
- ex->pos.trType = TR_LINEAR;
- ex->pos.trTime = cg.time;
- VectorCopy( newOrigin, ex->pos.trBase );
- VectorScale( dir, 48, ex->pos.trDelta );
+ if ( dir )
+ {
+ ex->pos.trType = TR_LINEAR;
+ ex->pos.trTime = cg.time;
+ VectorCopy( newOrigin, ex->pos.trBase );
+ VectorScale( dir, 48, ex->pos.trDelta );
+ }
// done.
ex->color[0] = ex->color[1] = ex->color[2] = 1.0;
@@ -427,6 +430,10 @@ void CG_LaunchGib( centity_t *cent, vec3_t origin, vec3_t angles, vec3_t velocit
refEntity_t *re;
int i;
+ if ( !cent ) {
+ return;
+ }
+
le = CG_AllocLocalEntity();
re = &le->refEntity;
@@ -668,7 +675,7 @@ void CG_GibPlayer( centity_t *cent, vec3_t playerOrigin, vec3_t gdir ) {
vec3_t junctionOrigin[MAXJUNCTIONS];
int junction;
int j;
- float size;
+ float size = 0.0;
vec3_t axis[3], angles;
char *JunctiongibTags[] = {
@@ -833,7 +840,7 @@ void CG_GibPlayer( centity_t *cent, vec3_t playerOrigin, vec3_t gdir ) {
VectorCopy( junctionOrigin[i], origin );
if ( ( cent->currentState.aiChar == AICHAR_HELGA ) || ( cent->currentState.aiChar == AICHAR_HEINRICH ) ) {
- size *= 3.0;
+ //size *= 3.0;
velocity[0] = crandom() * GIB_VELOCITY * 2.0;
velocity[1] = crandom() * GIB_VELOCITY * 2.0;
velocity[2] = GIB_JUMP + random() * GIB_VELOCITY;
@@ -1371,6 +1378,7 @@ void CG_Spotlight( centity_t *cent, float *color, vec3_t realstart, vec3_t light
// first trace to see if anything is hit
if ( flags & SL_NOTRACE ) {
tr.fraction = 1.0; // force no hit
+ VectorCopy(traceEnd, tr.endpos);
} else {
if ( flags & SL_TRACEWORLDONLY ) {
CG_Trace( &tr, start, NULL, NULL, traceEnd, -1, CONTENTS_SOLID );
@@ -1604,7 +1612,7 @@ void CG_Spotlight( centity_t *cent, float *color, vec3_t realstart, vec3_t light
if ( !( flags & SL_NODLIGHT ) ) {
vec3_t dlightLoc;
// VectorMA(tr.endpos, -60, lightDir, dlightLoc); // back away from the hit
- VectorMA( tr.endpos, 0, lightDir, dlightLoc ); // back away from the hit
+ VectorCopy( tr.endpos, dlightLoc ); // back away from the hit
// trap_R_AddLightToScene(dlightLoc, 200, colorNorm[0], colorNorm[1], colorNorm[2], 0); // ,REF_JUNIOR_DLIGHT);
// trap_R_AddLightToScene(dlightLoc, radius*2, colorNorm[0], colorNorm[1], colorNorm[2], 0); // ,REF_JUNIOR_DLIGHT);
trap_R_AddLightToScene( dlightLoc, radius * 2, 0.3, 0.3, 0.3, 0 ); // ,REF_JUNIOR_DLIGHT);
@@ -1673,12 +1681,6 @@ void CG_RumbleEfx( float pitch, float yaw ) {
float yawRandom;
vec3_t recoil;
- //
- pitchRecoilAdd = 0;
- pitchAdd = 0;
- yawRandom = 0;
- //
-
if ( pitch < 1 ) {
pitch = 1;
}
@@ -1703,5 +1705,3 @@ void CG_RumbleEfx( float pitch, float yaw ) {
cg.recoilPitch -= pitchRecoilAdd;
}
-
-
diff --git a/SP/code/cgame/cg_flamethrower.c b/SP/code/cgame/cg_flamethrower.c
index 8f445d3..257bae1 100644
--- a/SP/code/cgame/cg_flamethrower.c
+++ b/SP/code/cgame/cg_flamethrower.c
@@ -277,7 +277,7 @@ void CG_FireFlameChunks( centity_t *cent, vec3_t origin, vec3_t angles, float sp
// if this entity was firing last frame, interpolate the angles as we spawn the chunks that
// fired over the last frame
- if ( ( centInfo->lastClientFrame == cent->currentState.frame ) &&
+ if ( ( centInfo->lastClientFrame == cent->currentState.frame ) &&
( centInfo->lastFlameChunk && centInfo->lastFiring == firing ) ) {
AngleVectors( centInfo->lastAngles, lastFwd, lastRight, lastUp );
VectorCopy( centInfo->lastOrigin, lastOrg );
@@ -379,7 +379,6 @@ void CG_FireFlameChunks( centity_t *cent, vec3_t origin, vec3_t angles, float sp
} else {
centInfo->lastFiring = firing;
- t = cg.time;
VectorCopy( thisOrg, org );
diff --git a/SP/code/cgame/cg_info.c b/SP/code/cgame/cg_info.c
index f1e3fe4..ee0d8d1 100644
--- a/SP/code/cgame/cg_info.c
+++ b/SP/code/cgame/cg_info.c
@@ -361,7 +361,7 @@ void CG_DrawExitStats( void ) {
CG_Text_Paint( statsItems[i].labelX, y, 2, 0.3, color2, va( "%s:", CG_translateString( statsItems[i].label ) ), 0, 0, statsItems[i].labelFlags );
}
- token = COM_Parse( &mstats );
+ COM_Parse( &mstats );
// end (parse it)
}
@@ -410,7 +410,7 @@ void CG_DrawInformation( void ) {
}
if ( !levelshot ) {
- levelshot = trap_R_RegisterShaderNoMip( "levelshots/unknownmap.jpg" );
+ trap_R_RegisterShaderNoMip( "levelshots/unknownmap.jpg" );
}
trap_R_SetColor( NULL );
diff --git a/SP/code/cgame/cg_localents.c b/SP/code/cgame/cg_localents.c
index 178fcc4..63d7862 100644
--- a/SP/code/cgame/cg_localents.c
+++ b/SP/code/cgame/cg_localents.c
@@ -1000,9 +1000,6 @@ void CG_AddClientCritter( localEntity_t *le ) {
// calculate new position
BG_EvaluateTrajectory( &le->pos, time, newOrigin );
- VectorSubtract( enemyPos, le->refEntity.origin, v );
- enemyDist = VectorNormalize( v );
-
// trace a line from previous position to new position
CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, le->ownerNum, MASK_SHOT );
@@ -1071,7 +1068,6 @@ void CG_AddClientCritter( localEntity_t *le ) {
oldSpeed = VectorLength( le->pos.trDelta );
// track the enemy
- backup = *le;
VectorSubtract( enemyPos, le->refEntity.origin, v );
enemyDist = VectorNormalize( v );
diff --git a/SP/code/cgame/cg_marks.c b/SP/code/cgame/cg_marks.c
index b7358b6..6cb3007 100644
--- a/SP/code/cgame/cg_marks.c
+++ b/SP/code/cgame/cg_marks.c
@@ -72,7 +72,7 @@ CG_FreeMarkPoly
==================
*/
void CG_FreeMarkPoly( markPoly_t *le ) {
- if ( !le->prevMark ) {
+ if ( !le->prevMark || !le->nextMark ) {
CG_Error( "CG_FreeLocalEntity: not active" );
}
diff --git a/SP/code/cgame/cg_newdraw.c b/SP/code/cgame/cg_newdraw.c
index fecff36..6e5b01a 100644
--- a/SP/code/cgame/cg_newdraw.c
+++ b/SP/code/cgame/cg_newdraw.c
@@ -679,8 +679,6 @@ static void CG_DrawPlayerHead( rectDef_t *rect, qboolean draw2D ) {
cg.headEndYaw = 180 + 20 * cos( crandom() * M_PI );
cg.headEndPitch = 5 * cos( crandom() * M_PI );
}
-
- size = rect->w * 1.25;
}
// if the server was frozen for a while we may have a bad head start time
@@ -981,8 +979,6 @@ static void CG_DrawSelectedPlayerPowerup( rectDef_t *rect, qboolean draw2D ) {
item = BG_FindItemForPowerup( j );
if ( item ) {
CG_DrawPic( x, y, rect->w, rect->h, trap_R_RegisterShader( item->icon ) );
- x += 3;
- y += 3;
return;
}
}
@@ -2168,9 +2164,6 @@ static void CG_DrawFatigue( rectDef_t *rect, vec4_t color, int align ) {
int flags = 0;
float chargeTime; // DHM - Nerve
- barFrac = (float)cg.snap->ps.sprintTime / SPRINTTIME;
-// omBarFrac = 1.0f-barFrac;
-
if ( align != HUD_HORIZONTAL ) {
flags |= 4; // BAR_VERT
flags |= 1; // BAR_LEFT (left, when vertical means grow 'up')
diff --git a/SP/code/cgame/cg_players.c b/SP/code/cgame/cg_players.c
index 311a769..c24cf9d 100644
--- a/SP/code/cgame/cg_players.c
+++ b/SP/code/cgame/cg_players.c
@@ -1767,6 +1767,10 @@ void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation, float
// get the next frame based on the animation
anim = lf->animation;
+
+ if ( !anim )
+ return;
+
if ( !anim->frameLerp ) {
return; // shouldn't happen
}
@@ -3485,9 +3489,7 @@ void CG_AddZombieSpiritEffect( centity_t *cent ) {
fadeRatio = 1.0;
}
- if ( cent->pe.cueZombieSpirit ) {
- alpha = fadeRatio;
- } else {
+ if ( !cent->pe.cueZombieSpirit ) {
alpha = 1.0 - ( (float)( cg.time - cent->pe.zombieSpiritEndTime ) / (float)fadeOutTime );
fadeRatio = alpha;
if ( alpha < 0.0 ) {
@@ -3617,9 +3619,7 @@ void CG_AddZombieFlameEffect( centity_t *cent ) {
fadeRatio = 1.0;
}
- if ( cent->pe.cueZombieSpirit ) {
- alpha = fadeRatio;
- } else {
+ if ( !cent->pe.cueZombieSpirit ) {
alpha = ( (float)( cent->pe.zombieSpiritEndTime - cg.time ) / (float)fadeOutTime );
fadeRatio = alpha;
if ( alpha < 0.0 ) {
@@ -3860,7 +3860,6 @@ void CG_AddLoperGroundEffect( centity_t *cent ) {
}
} else {
cent->pe.loperGroundValidTime = cg.time;
- duration = LOPER_GROUNDCHARGE_DURATION;
alpha = 1.0;
lightAlpha = 1.0;
}
@@ -4223,9 +4222,7 @@ void CG_AddHelgaSpiritEffect( centity_t *cent ) {
fadeRatio = 1.0;
}
- if ( cent->pe.cueZombieSpirit ) {
- alpha = fadeRatio;
- } else {
+ if ( !cent->pe.cueZombieSpirit ) {
alpha = 1.0 - ( (float)( cg.time - cent->pe.zombieSpiritEndTime ) / (float)fadeOutTime );
fadeRatio = alpha;
if ( alpha < 0.0 ) {
@@ -5046,7 +5043,7 @@ void CG_Player( centity_t *cent ) {
cent->pe.headRefEnt = head;
// add the shadow
- shadow = CG_PlayerShadow( cent, &shadowPlane );
+ CG_PlayerShadow( cent, &shadowPlane );
// set the shadowplane for accessories
acc.shadowPlane = shadowPlane;
diff --git a/SP/code/cgame/cg_scoreboard.c b/SP/code/cgame/cg_scoreboard.c
index ff75f4d..341f9cb 100644
--- a/SP/code/cgame/cg_scoreboard.c
+++ b/SP/code/cgame/cg_scoreboard.c
@@ -200,7 +200,6 @@ static void WM_DrawClientScore( int x, int y, score_t *score, float *color, floa
tempx += INFO_SCORE_WIDTH;
CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor );
- tempx += INFO_LATENCY_WIDTH;
}
tempx = x;
@@ -213,7 +212,6 @@ static void WM_DrawClientScore( int x, int y, score_t *score, float *color, floa
tempx += INFO_SCORE_WIDTH;
CG_DrawSmallString( tempx, y, va( "%4i", score->ping ), fade );
- tempx += INFO_LATENCY_WIDTH;
}
/*
@@ -266,7 +264,6 @@ static int WM_TeamScoreboard( int x, int y, team_t team, float fade ) {
tempx += INFO_SCORE_WIDTH;
CG_FillRect( tempx, y, INFO_LATENCY_WIDTH - INFO_BORDER, INFO_TEAM_HEIGHT, hcolor );
- tempx += INFO_LATENCY_WIDTH;
// draw player info
VectorSet( hcolor, 1, 1, 1 );
@@ -423,7 +420,6 @@ int WM_ScoreboardOverlay( int x, int y, float fade ) {
x += INFO_SCORE_WIDTH;
CG_DrawSmallString( x, y, "Latency", fade );
- x += INFO_LATENCY_WIDTH;
y += 20;
@@ -468,7 +464,6 @@ qboolean CG_DrawScoreboard( void ) {
if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD ||
cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
fade = 1.0;
- fadeColor = colorWhite;
} else {
fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME );
@@ -553,7 +548,7 @@ qboolean CG_DrawScoreboard( void ) {
y = WM_TeamScoreboard( x, y, TEAM_BLUE, fade );
y = WM_TeamScoreboard( x, y, TEAM_RED, fade );
}
- y = WM_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
+ WM_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
}
// -NERVE - SMF
else if ( cgs.gametype >= GT_TEAM ) {
@@ -567,14 +562,14 @@ qboolean CG_DrawScoreboard( void ) {
y = CG_TeamScoreboard( x, y, TEAM_BLUE, fade );
y = CG_TeamScoreboard( x, y, TEAM_RED, fade );
}
- y = CG_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
+ CG_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
} else if ( cgs.gametype != GT_SINGLE_PLAYER ) { //----(SA) modified
//
// free for all scoreboard
//
y = CG_TeamScoreboard( x, y, TEAM_FREE, fade );
- y = CG_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
+ CG_TeamScoreboard( x, y, TEAM_SPECTATOR, fade );
}
// load any models that have been deferred
diff --git a/SP/code/cgame/cg_view.c b/SP/code/cgame/cg_view.c
index 10c8b5d..135f916 100644
--- a/SP/code/cgame/cg_view.c
+++ b/SP/code/cgame/cg_view.c
@@ -457,16 +457,11 @@ void CG_Concussive( centity_t *cent ) {
if ( !cg.renderingThirdPerson && cent->currentState.density == cg.snap->ps.clientNum ) {
//
pitchRecoilAdd = 0;
- pitchAdd = 0;
- yawRandom = 0;
//
VectorSubtract( cg.snap->ps.origin, cent->currentState.origin, vec );
length = VectorLength( vec );
- // pitchAdd = 12+rand()%3;
- // yawRandom = 6;
-
if ( length > 1024 ) {
return;
}
@@ -1242,12 +1237,6 @@ void CG_DrawSkyBoxPortal( void ) {
if ( !token || !token[0] ) {
CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n" );
}
- fov_x = atoi( token );
-
- if ( !fov_x ) {
- fov_x = 90;
- }
-
// setup fog the first time, ignore this part of the configstring after that
token = COM_ParseExt( &cstr, qfalse );
diff --git a/SP/code/cgame/cg_weapons.c b/SP/code/cgame/cg_weapons.c
index ec3c3dd..5096b4d 100644
--- a/SP/code/cgame/cg_weapons.c
+++ b/SP/code/cgame/cg_weapons.c
@@ -422,7 +422,6 @@ void CG_PyroSmokeTrail( centity_t *ent, const weaponInfo_t *wi ) {
for ( ; t <= ent->trailTime ; t += step ) {
BG_EvaluateTrajectory( &es->pos, t, lastPos );
- rnd = random();
//VectorCopy (ent->lerpOrigin, lastPos);
@@ -1992,15 +1991,12 @@ static float CG_VenomSpinAngle( centity_t *cent ) {
float speed;
qboolean firing;
- delta = cg.time - cent->pe.barrelTime;
-
firing = (qboolean)( cent->currentState.eFlags & EF_FIRING );
if ( cg.snap->ps.weaponstate != WEAPON_FIRING ) { // (SA) this seems better
firing = qfalse;
}
-
delta = cg.time - cent->pe.barrelTime;
if ( cent->pe.barrelSpinning ) {
angle = cent->pe.barrelAngle + delta * SPIN_SPEED;
@@ -5067,7 +5063,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, in
// Ridah
int lightOverdraw;
vec3_t sprOrg;
- vec3_t sprVel;
+ vec3_t sprVel = { 0 };
int i,j;
//----(SA) added
@@ -5506,7 +5502,6 @@ void CG_Shard(centity_t *cent, vec3_t origin, vec3_t dir)
}
// NOTE: these must all have the same duration, so that we are less likely to use a wider range of images per scene
- r = 2 + rand() % 3;
for ( i = 0; i < 4; i++ ) {
if ( weapon == VERYBIGEXPLOSION ) {
for ( j = 0; j < 3; j++ ) sprOrg[j] = origin[j] + 32 * dir[j] + 32 * crandom();
@@ -5529,7 +5524,6 @@ void CG_Shard(centity_t *cent, vec3_t origin, vec3_t dir)
CG_ParticleExplosion( "explode1", sprOrg, sprVel, 1600, 20, 200 + random() * 400 );
// NOTE: these must all have the same duration, so that we are less likely to use a wider range of images per scene
- r = 2 + rand() % 3;
for ( i = 0; i < 4; i++ ) {
for ( j = 0; j < 3; j++ ) sprOrg[j] = origin[j] + 160 * crandom();
CG_ParticleExplosion( "explode1", sprOrg, sprVel, 1600, 40, 260 + rand() % 120 );
@@ -5629,12 +5623,7 @@ void CG_MissileHitWallSmall( int weapon, int clientNum, vec3_t origin, vec3_t di
vec3_t sprVel;
// int i,j;
- mark = 0;
- radius = 32;
- sfx = 0;
mod = 0;
- shader = 0;
- light = 0;
lightColor[0] = 1;
lightColor[1] = 1;
lightColor[2] = 0;
@@ -5642,9 +5631,6 @@ void CG_MissileHitWallSmall( int weapon, int clientNum, vec3_t origin, vec3_t di
lightOverdraw = 0;
// set defaults
- isSprite = qfalse;
- duration = 600;
-
shader = cgs.media.rocketExplosionShader; // copied from RL
sfx = cgs.media.sfx_rockexp;
mark = cgs.media.burnMarkShader;
diff --git a/SP/code/client/cl_ui.c b/SP/code/client/cl_ui.c
index 3802886..b4bf1cd 100644
--- a/SP/code/client/cl_ui.c
+++ b/SP/code/client/cl_ui.c
@@ -1161,7 +1161,7 @@ void CL_InitUI( void ) {
#ifdef WOLF_SP_DEMO
uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE );
#else
- uivm = VM_Create( "ui", CL_UISystemCalls, Cvar_VariableValue( "vm_ui" ) );
+ uivm = VM_Create( "ui", CL_UISystemCalls, interpret );
#endif
if ( !uivm ) {
diff --git a/SP/code/client/snd_mix.c b/SP/code/client/snd_mix.c
index d61f712..89245bf 100644
--- a/SP/code/client/snd_mix.c
+++ b/SP/code/client/snd_mix.c
@@ -412,15 +412,17 @@ void S_SetVoiceAmplitudeFromMuLaw( const sfx_t *sc, int sampleOffset, int count,
sfx_count = 0;
samples = (byte *)chunk->sndChunk + sampleOffset;
for ( i = 0; i < count; i++ ) {
- if ( samples >= (byte *)chunk->sndChunk + ( SND_CHUNK_SIZE * 2 ) ) {
+ if ( chunk && ( samples >= (byte *)chunk->sndChunk + ( SND_CHUNK_SIZE * 2 ) ) ) {
chunk = chunk->next;
samples = (byte *)chunk->sndChunk;
}
- data = mulawToShort[*samples];
- if ( abs( data ) > 5000 ) {
- sfx_count += ( data * 255 ) >> 8;
+ if ( samples ) {
+ data = mulawToShort[*samples];
+ if ( abs( data ) > 5000 ) {
+ sfx_count += ( data * 255 ) >> 8;
+ }
+ samples++;
}
- samples++;
}
//Com_Printf("Voice sfx_count = %d, count = %d\n", sfx_count, count );
// adjust the sfx_count according to the frametime (scale down for longer frametimes)
@@ -455,6 +457,10 @@ static void S_PaintChannelFrom16_altivec( channel_t *ch, const sfx_t *sc, int co
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
+ if (sc->soundChannels <= 0) {
+ return;
+ }
+
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {
@@ -641,6 +647,10 @@ static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int cou
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
+ if (sc->soundChannels <= 0) {
+ return;
+ }
+
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {
diff --git a/SP/code/client/snd_wavelet.c b/SP/code/client/snd_wavelet.c
index a325ffd..71da208 100644
--- a/SP/code/client/snd_wavelet.c
+++ b/SP/code/client/snd_wavelet.c
@@ -119,7 +119,7 @@ void NXPutc(NXStream *stream, char out) {
void encodeWavelet( sfx_t *sfx, short *packets) {
- float wksp[4097], temp;
+ float wksp[4097] = { 0.0f }, temp;
int i, samples, size;
sndBuffer *newchunk, *chunk;
byte *out;
@@ -169,7 +169,7 @@ void encodeWavelet( sfx_t *sfx, short *packets) {
}
void decodeWavelet(sndBuffer *chunk, short *to) {
- float wksp[4097];
+ float wksp[4097] = { 0.0f };
int i;
byte *out;
diff --git a/SP/code/game/ai_cast_events.c b/SP/code/game/ai_cast_events.c
index a8fd0f3..7248363 100644
--- a/SP/code/game/ai_cast_events.c
+++ b/SP/code/game/ai_cast_events.c
@@ -176,7 +176,7 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
}
// record the sighting (FIXME: silent weapons shouldn't do this, but the AI should react in some way)
- if ( attacker->client ) {
+ if ( attacker && attacker->client ) {
AICast_UpdateVisibility( self, attacker, qtrue, qtrue );
}
@@ -312,7 +312,7 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// set enemy weapon
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, 0, qfalse );
- if ( attacker->client ) {
+ if ( attacker && attacker->client ) {
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, inflictor->s.weapon, qtrue );
} else {
BG_UpdateConditionValue( self->s.number, ANIM_COND_ENEMY_WEAPON, 0, qfalse );
@@ -388,7 +388,8 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if ( !cs->rebirthTime ) {
G_UseTargets( self, self );
// really dead now, so call the script
- AICast_ScriptEvent( cs, "death", attacker->aiName ? attacker->aiName : "" );
+ if ( attacker )
+ AICast_ScriptEvent( cs, "death", attacker->aiName ? attacker->aiName : "" );
// call the deathfunc for this cast, so we can play associated sounds, or do any character-specific things
if ( !( cs->aiFlags & AIFL_DENYACTION ) && cs->deathfunc ) {
cs->deathfunc( self, attacker, damage, meansOfDeath ); //----(SA) added mod
diff --git a/SP/code/game/ai_cast_fight.c b/SP/code/game/ai_cast_fight.c
index 41e06e7..cb2bcc3 100644
--- a/SP/code/game/ai_cast_fight.c
+++ b/SP/code/game/ai_cast_fight.c
@@ -1370,7 +1370,7 @@ bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) {
//direction towards the enemy
VectorSubtract( cs->vislist[cs->enemyNum].visible_pos, bs->origin, forward );
//the distance towards the enemy
- dist = VectorNormalize( forward );
+ VectorNormalize( forward );
//VectorNegate( forward, backward );
//
// do we have somewhere we are trying to get to?
diff --git a/SP/code/game/ai_cast_func_boss1.c b/SP/code/game/ai_cast_func_boss1.c
index 52297ba..e435986 100644
--- a/SP/code/game/ai_cast_func_boss1.c
+++ b/SP/code/game/ai_cast_func_boss1.c
@@ -698,7 +698,7 @@ char *AIFunc_Heinrich_Earthquake( cast_state_t *cs ) {
ecs = AICast_GetCastState( cs->enemyNum );
VectorMA( enemy->r.currentOrigin, HEINRICH_STOMP_DELAY, enemy->client->ps.velocity, enemyVec );
- enemyDist = VectorDistance( ent->r.currentOrigin, enemyVec );
+ VectorDistance( ent->r.currentOrigin, enemyVec );
if ( ent->client->ps.torsoTimer < 500 ) {
int rnd;
diff --git a/SP/code/game/ai_cast_funcs.c b/SP/code/game/ai_cast_funcs.c
index 610cc21..57c8ed9 100644
--- a/SP/code/game/ai_cast_funcs.c
+++ b/SP/code/game/ai_cast_funcs.c
@@ -2266,8 +2266,6 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) {
// try to go to ambush mode
cs->enemyNum = -1;
return AIFunc_DefaultStart( cs );
- } else {
- moved = qtrue;
}
// slow down real close to the goal, so we don't go passed it
cs->speedScale = AICast_SpeedScaleForDistance( cs, dist, chaseDist );
@@ -2459,7 +2457,6 @@ char *AIFunc_BattleAmbush( cast_state_t *cs ) {
&& ( ( enemyDist - 1 ) > ( Distance( move.endpos, g_entities[cs->enemyNum].s.pos.trBase ) ) ) ) ) {
// abort the manouver
VectorClear( cs->takeCoverPos );
- dist = 0;
}
//
// we should slow down on approaching the destination point
@@ -2962,8 +2959,6 @@ char *AIFunc_BattleChase( cast_state_t *cs ) {
VectorCopy( cs->bs->origin, cs->takeCoverPos );
return AIFunc_BattleAmbushStart( cs );
}
- } else {
- moved = qtrue;
}
}
//
@@ -3482,7 +3477,6 @@ char *AIFunc_BattleTakeCover( cast_state_t *cs ) {
&& ( ( enemyDist - 1 ) > ( Distance( move.endpos, g_entities[cs->enemyNum].s.pos.trBase ) ) ) ) ) {
// abort the manouver
VectorClear( cs->takeCoverPos );
- dist = 0;
}
//
// do we want to play a rolling animation into a cover position?
@@ -3502,7 +3496,6 @@ char *AIFunc_BattleTakeCover( cast_state_t *cs ) {
&& !AICast_VisibleFromPos( cs->vislist[cs->enemyNum].real_visible_pos, cs->enemyNum, cs->bs->origin, cs->entityNum, qfalse )
&& trap_AAS_PointAreaNum( move.endpos ) ) { // make sure the endpos is in a valid area
VectorCopy( move.endpos, cs->takeCoverPos );
- dist = 0;
cs->aiFlags |= AIFL_MISCFLAG1; // dont do this again
}
//
@@ -3902,8 +3895,6 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) {
cs->enemyNum = -1;
//G_Printf("aborting, movement failure\n");
return AIFunc_DefaultStart( cs );
- } else {
- moved = qtrue;
}
}
}
@@ -4122,7 +4113,7 @@ char *AIFunc_BattleMG42( cast_state_t *cs ) {
//
// TODO: play a special "holding mg42" torso animation
//
- VectorCopy( angles, cs->ideal_viewangles );
+ //VectorCopy( angles, cs->ideal_viewangles );
if ( cs->triggerReleaseTime < level.time ) {
trap_EA_Attack( bs->client );
cs->bFlags |= BFL_ATTACKED;
@@ -4312,7 +4303,7 @@ char *AIFunc_GrenadeKick( cast_state_t *cs ) {
bot_state_t *bs;
vec3_t destorg, vec;
float dist, speed;
- int enemies[MAX_CLIENTS], numEnemies, i;
+ int enemies[MAX_CLIENTS], numEnemies = 0, i;
qboolean shouldAttack;
gentity_t *danger;
gentity_t *ent;
@@ -4521,7 +4512,6 @@ char *AIFunc_GrenadeKick( cast_state_t *cs ) {
// look for things we should attack
// if we are out of ammo, we shouldn't bother trying to attack
shouldAttack = qfalse;
- numEnemies = 0;
if ( AICast_GotEnoughAmmoForWeapon( cs, cs->weaponNum ) ) {
numEnemies = AICast_ScanForEnemies( cs, enemies );
if ( numEnemies == -1 ) { // query mode
@@ -4624,7 +4614,7 @@ AIFunc_Battle()
*/
char *AIFunc_Battle( cast_state_t *cs ) {
bot_moveresult_t moveresult;
- int tfl;
+ //int tfl;
bot_state_t *bs;
gentity_t *ent, *enemy;
@@ -4777,14 +4767,14 @@ char *AIFunc_Battle( cast_state_t *cs ) {
//
// setup for the fight
//
- tfl = cs->travelflags;
+ //tfl = cs->travelflags;
//if in lava or slime the bot should be able to get out
- if ( BotInLava( bs ) ) {
- tfl |= TFL_LAVA;
- }
- if ( BotInSlime( bs ) ) {
- tfl |= TFL_SLIME;
- }
+ //if ( BotInLava( bs ) ) {
+ // tfl |= TFL_LAVA;
+ //}
+ //if ( BotInSlime( bs ) ) {
+ // tfl |= TFL_SLIME;
+ //}
//
/*
moveresult = AICast_CombatMove(cs, tfl);
diff --git a/SP/code/game/ai_cast_script.c b/SP/code/game/ai_cast_script.c
index 0e0f5ac..9548e45 100644
--- a/SP/code/game/ai_cast_script.c
+++ b/SP/code/game/ai_cast_script.c
@@ -418,7 +418,6 @@ void AICast_ScriptParse( cast_state_t *cs ) {
return;
}
- buildScript = trap_Cvar_VariableIntegerValue( "com_buildScript" );
buildScript = qtrue;
pScript = level.scriptAI;
diff --git a/SP/code/game/ai_cast_script_actions.c b/SP/code/game/ai_cast_script_actions.c
index 43c7a28..29888ba 100644
--- a/SP/code/game/ai_cast_script_actions.c
+++ b/SP/code/game/ai_cast_script_actions.c
@@ -566,7 +566,7 @@ qboolean AICast_ScriptAction_Wait( cast_state_t *cs, char *params ) {
}
} else
// if we are reloading, look for somewhere to hide
- if ( cs->castScriptStatus.scriptWaitHideTime > level.time || cs->bs->cur_ps.weaponTime > 500 ) {
+ if ( cs->castScriptStatus.scriptWaitHideTime > level.time || ( cs->bs && cs->bs->cur_ps.weaponTime > 500 ) ) {
if ( cs->castScriptStatus.scriptWaitHideTime < level.time ) {
// look for a hide pos within the wait range
diff --git a/SP/code/game/ai_cast_sight.c b/SP/code/game/ai_cast_sight.c
index d33ea9c..de45edc 100644
--- a/SP/code/game/ai_cast_sight.c
+++ b/SP/code/game/ai_cast_sight.c
@@ -557,15 +557,13 @@ static int lastsrc = 0, lastdest = 0;
void AICast_SightUpdate( int numchecks ) {
int count = 0, destcount, srccount;
- int src, dest;
+ int src = 0, dest = 0;
gentity_t *srcent, *destent;
cast_state_t *cs, *dcs;
//static int lastNumUpdated; // TTimo: unused
cast_visibility_t *vis;
#define SIGHT_MIN_DELAY 200
- src = 0;
- dest = 0;
if ( numchecks < 5 ) {
numchecks = 5;
}
diff --git a/SP/code/game/ai_cast_think.c b/SP/code/game/ai_cast_think.c
index 9997a87..8b0fc71 100644
--- a/SP/code/game/ai_cast_think.c
+++ b/SP/code/game/ai_cast_think.c
@@ -1000,13 +1000,13 @@ void AICast_StartServerFrame( int time ) {
AICast_AgePlayTime( 0 );
if ( elapsed < 0 ) {
- elapsed = 0;
+ // elapsed = 0;
lasttime = time;
}
// don't let the framerate drop below 10
- if ( elapsed > 100 ) {
- elapsed = 100;
- }
+ //if ( elapsed > 100 ) {
+ // elapsed = 100;
+ //}
//
// process player's current script if it exists
AICast_ScriptRun( AICast_GetCastState( 0 ), qfalse );
@@ -1205,7 +1205,7 @@ done:
// hack, if we are above ground, chances are it's because we only did one frame, and gravity isn't applied until
// after the frame, so try and drop us down some
- if ( move->groundEntityNum == ENTITYNUM_NONE ) {
+ if ( pm.ps->groundEntityNum == ENTITYNUM_NONE ) {
VectorCopy( move->endpos, end );
end[2] -= 32;
trap_Trace( &tr, move->endpos, pm.mins, pm.maxs, end, pm.ps->clientNum, pm.tracemask );
diff --git a/SP/code/game/ai_dmq3.c b/SP/code/game/ai_dmq3.c
index 073cd7b..6c8de38 100644
--- a/SP/code/game/ai_dmq3.c
+++ b/SP/code/game/ai_dmq3.c
@@ -1047,7 +1047,7 @@ BotRoamGoal
void BotRoamGoal( bot_state_t *bs, vec3_t goal ) {
float len, r1, r2, sign, n;
int pc;
- vec3_t dir, bestorg, belowbestorg;
+ vec3_t dir, bestorg = {0}, belowbestorg;
bsp_trace_t trace;
for ( n = 0; n < 10; n++ ) {
diff --git a/SP/code/game/ai_main.c b/SP/code/game/ai_main.c
index f2f931e..220e199 100644
--- a/SP/code/game/ai_main.c
+++ b/SP/code/game/ai_main.c
@@ -631,6 +631,10 @@ int BotAISetupClient( int client, struct bot_settings_s *settings ) {
}
bs = botstates[client];
+ if ( !bs ) {
+ return qfalse;
+ }
+
if ( bs && bs->inuse ) {
BotAI_Print( PRT_FATAL, "client %d already setup\n", client );
return qfalse;
diff --git a/SP/code/game/ai_team.c b/SP/code/game/ai_team.c
index 5abb62e..86ae5f6 100644
--- a/SP/code/game/ai_team.c
+++ b/SP/code/game/ai_team.c
@@ -152,7 +152,7 @@ int BotSortTeamMatesByBaseTravelTime( bot_state_t *bs, int *teammates, int maxte
continue;
}
//
- if ( BotSameTeam( bs, i ) ) {
+ if ( BotSameTeam( bs, i ) && goal ) {
//
traveltime = BotClientTravelTimeToGoal( i, goal );
//
@@ -209,7 +209,7 @@ BotCTFOrders
*/
void BotCTFOrders_BothFlagsNotAtBase( bot_state_t *bs ) {
int numteammates, defenders, attackers, i, other;
- int teammates[MAX_CLIENTS];
+ int teammates[MAX_CLIENTS] = {0};
char name[MAX_NETNAME], carriername[MAX_NETNAME];
numteammates = BotSortTeamMatesByBaseTravelTime( bs, teammates, sizeof( teammates ) );
@@ -441,7 +441,7 @@ BotCTFOrders
*/
void BotCTFOrders_BothFlagsAtBase( bot_state_t *bs ) {
int numteammates, defenders, attackers, i;
- int teammates[MAX_CLIENTS];
+ int teammates[MAX_CLIENTS] = {0};
char name[MAX_NETNAME];
// char buf[MAX_MESSAGE_SIZE];
diff --git a/SP/code/game/bg_animation.c b/SP/code/game/bg_animation.c
index fc37898..c351755 100644
--- a/SP/code/game/bg_animation.c
+++ b/SP/code/game/bg_animation.c
@@ -633,6 +633,7 @@ qboolean BG_AnimParseAnimConfig( animModelInfo_t *animModelInfo, const char *fil
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
} else {
// just set it to the equivalent animStrings[]
@@ -658,18 +659,21 @@ qboolean BG_AnimParseAnimConfig( animModelInfo_t *animModelInfo, const char *fil
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
animations[i].numFrames = atoi( token );
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "end of file without ENDANIMS: line %i", COM_GetCurrentParseLine() + 1 );
+ break;
}
animations[i].loopFrames = atoi( token );
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "end of file without ENDANIMS: line %i", COM_GetCurrentParseLine() + 1 );
+ break;
}
fps = atof( token );
if ( fps == 0 ) {
@@ -682,6 +686,7 @@ qboolean BG_AnimParseAnimConfig( animModelInfo_t *animModelInfo, const char *fil
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
animations[i].moveSpeed = atoi( token );
@@ -771,7 +776,7 @@ qboolean BG_AnimParseAnimConfig( animModelInfo_t *animModelInfo, const char *fil
headAnims[i].numFrames = atoi( token );
// skip the movespeed
- token = COM_ParseExt( &text_p, qfalse );
+ COM_ParseExt( &text_p, qfalse );
}
animModelInfo->numHeadAnims = i;
@@ -937,6 +942,7 @@ qboolean BG_ParseConditions( char **text_pp, animScriptItem_t *scriptItem ) {
token = COM_ParseExt( text_pp, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "BG_AnimParseAnimScript: expected condition value, found end of line" ); // RF modification
+ break;
}
// check for a comma (condition divider)
if ( token[strlen( token ) - 1] == ',' ) {
@@ -1025,6 +1031,7 @@ void BG_ParseCommands( char **input, animScriptItem_t *scriptItem, animModelInfo
token = COM_ParseExt( input, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "BG_ParseCommands: expected duration value" );
+ break;
}
command->animDuration[partIndex] = atoi( token );
} else { // unget the token
@@ -1054,6 +1061,7 @@ void BG_ParseCommands( char **input, animScriptItem_t *scriptItem, animModelInfo
token = COM_ParseExt( input, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "BG_ParseCommands: expected sound" );
+ break;
}
// NOTE: only sound script are supported at this stage
if ( strstr( token, ".wav" ) ) {
@@ -1066,6 +1074,7 @@ void BG_ParseCommands( char **input, animScriptItem_t *scriptItem, animModelInfo
token = COM_ParseExt( input, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "BG_ParseCommands: expected showpart number" );
+ break;
}
if ( atoi( token ) > 7 ) {
BG_AnimParseError( "BG_ParseCommands: showpart number '%d' is too big! (max 8)", atoi( token ) ) ;
@@ -1076,6 +1085,7 @@ void BG_ParseCommands( char **input, animScriptItem_t *scriptItem, animModelInfo
token = COM_ParseExt( input, qfalse );
if ( !token || !token[0] ) {
BG_AnimParseError( "BG_ParseCommands: expected hidepart number" );
+ break;
}
if ( atoi( token ) > 7 ) {
BG_AnimParseError( "BG_ParseCommands: hidepart number '%d' is too big! (max 8)", atoi( token ) ) ;
diff --git a/SP/code/game/bg_misc.c b/SP/code/game/bg_misc.c
index 71b96f6..d63bb90 100644
--- a/SP/code/game/bg_misc.c
+++ b/SP/code/game/bg_misc.c
@@ -4129,7 +4129,6 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t resu
return;
}
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
- phase = deltaTime / (float)tr->trDuration;
VectorScale( tr->trDelta, deltaTime * deltaTime, result );
break;
case TR_DECCELERATE: // trDelta is breaking force
diff --git a/SP/code/game/bg_pmove.c b/SP/code/game/bg_pmove.c
index 7b769d2..1483722 100644
--- a/SP/code/game/bg_pmove.c
+++ b/SP/code/game/bg_pmove.c
@@ -1686,7 +1686,7 @@ static void PM_Footsteps( void ) {
// mg42, always idle
if ( pm->ps->persistant[PERS_HWEAPON_USE] ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
//
return;
}
@@ -1695,9 +1695,9 @@ static void PM_Footsteps( void ) {
if ( pm->waterlevel > 1 ) {
if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_SWIMBK, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_SWIMBK, qtrue );
} else {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_SWIM, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_SWIM, qtrue );
}
return;
@@ -1707,10 +1707,10 @@ static void PM_Footsteps( void ) {
if ( pm->ps->groundEntityNum == ENTITYNUM_NONE ) {
if ( pm->ps->pm_flags & PMF_LADDER ) { // on ladder
if ( pm->ps->velocity[2] >= 0 ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_CLIMBUP, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_CLIMBUP, qtrue );
//BG_PlayAnimName( pm->ps, "BOTH_CLIMB", ANIM_BP_BOTH, qfalse, qtrue, qfalse );
} else if ( pm->ps->velocity[2] < 0 ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_CLIMBDOWN, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_CLIMBDOWN, qtrue );
//BG_PlayAnimName( pm->ps, "BOTH_CLIMB_DOWN", ANIM_BP_BOTH, qfalse, qtrue, qfalse );
}
}
@@ -1731,7 +1731,7 @@ static void PM_Footsteps( void ) {
animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLECR, qtrue );
}
if ( animResult < 0 ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
}
//
return;
@@ -1829,7 +1829,7 @@ static void PM_Footsteps( void ) {
// if no anim found yet, then just use the idle as default
if ( animResult < 0 ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_IDLE, qtrue );
}
// check for footstep / splash sounds
@@ -3464,14 +3464,8 @@ addTime = 50;
break;
// jpw
case WP_MONSTER_ATTACK1:
-switch ( pm->ps->aiChar ) {
-case AICHAR_ZOMBIE:
- // Zombie spitting blood
- addTime = 1000;
- break;
-default:
- break;
-}
+addTime = 1000;
+break;
default:
case WP_GAUNTLET:
diff --git a/SP/code/game/g_active.c b/SP/code/game/g_active.c
index d5d267c..23e9fb0 100644
--- a/SP/code/game/g_active.c
+++ b/SP/code/game/g_active.c
@@ -563,8 +563,8 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
int event, eventParm;
gclient_t *client;
int damage;
- int stunTime; //----(SA) added
- float fallSoundMul;
+ int stunTime; //----(SA) added
+ float fallSoundMul = 1.0f; // default to normal range
// vec3_t origin, angles;
// qboolean fired;
// gitem_t *item;
@@ -596,7 +596,6 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
}
stunTime = 0; //----(SA) added
- fallSoundMul = 1.0f; // default to normal range
//----(SA) FIXME: TODO: hmm, going through here adding surfaceparms it seems that the value for ent->client->ps.pm_time was weird. (1000 for all but dmg_25 which has 250?)
if ( event == EV_FALL_NDIE ) {
@@ -623,7 +622,7 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
stunTime = 0;
}
- if ( stunTime ) {
+ if ( ent->client && stunTime ) {
ent->client->ps.pm_time = stunTime;
ent->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
VectorClear( ent->client->ps.velocity );
@@ -698,11 +697,11 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
default:
if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
// RF, handle footstep sounds
- if ( ent->client->ps.pm_flags & PMF_DUCKED ) { // no when crouching
+ if ( ent->client && ( ent->client->ps.pm_flags & PMF_DUCKED ) ) { // no when crouching
break;
}
- if ( ent->client->pers.cmd.buttons & BUTTON_WALKING ) {
+ if ( ent->client && ( ent->client->pers.cmd.buttons & BUTTON_WALKING ) ) {
break;
}
diff --git a/SP/code/game/g_alarm.c b/SP/code/game/g_alarm.c
index 2a9df3d..20077d9 100644
--- a/SP/code/game/g_alarm.c
+++ b/SP/code/game/g_alarm.c
@@ -81,7 +81,13 @@ alarmbox_updateparts
*/
void alarmbox_updateparts( gentity_t *ent, qboolean matestoo ) {
gentity_t *t, *mate;
- qboolean alarming = ( ent->s.frame == 1 );
+ qboolean alarming;
+
+ if ( !ent ) {
+ return;
+ }
+
+ alarming = ( ent->s.frame == 1 );
// update teammates
if ( matestoo ) {
diff --git a/SP/code/game/g_items.c b/SP/code/game/g_items.c
index 6fd39e0..2413aa9 100644
--- a/SP/code/game/g_items.c
+++ b/SP/code/game/g_items.c
@@ -571,7 +571,7 @@ RespawnItem
===============
*/
void RespawnItem( gentity_t *ent ) {
- if (!ent) {
+ if ( !ent ) {
return;
}
@@ -591,10 +591,14 @@ void RespawnItem( gentity_t *ent ) {
choice = rand() % count;
- for ( count = 0, ent = master; count < choice; ent = ent->teamchain, count++ )
+ for ( count = 0, ent = master; ent && count < choice; ent = ent->teamchain, count++ )
;
}
+ if ( !ent ) {
+ return;
+ }
+
ent->r.contents = CONTENTS_TRIGGER;
//ent->s.eFlags &= ~EF_NODRAW;
ent->flags &= ~FL_NODRAW;
diff --git a/SP/code/game/g_misc.c b/SP/code/game/g_misc.c
index 676329e..986df88 100644
--- a/SP/code/game/g_misc.c
+++ b/SP/code/game/g_misc.c
@@ -1629,7 +1629,7 @@ Fire_Lead
//----(SA) added 'activator' so the bits that used to expect 'ent' to be the gun still work
void Fire_Lead( gentity_t *ent, gentity_t *activator, float spread, int damage, vec3_t muzzle, vec3_t angles ) {
trace_t tr;
- vec3_t end, lead_muzzle, mg42_muzzle;
+ vec3_t end, lead_muzzle, mg42_muzzle = {0};
float r;
float u;
gentity_t *tent;
@@ -1953,6 +1953,8 @@ void mg42_track( gentity_t *self, gentity_t *other ) {
if ( other->active ) {
if ( ( !( level.time % 100 ) ) && ( other->client ) && ( other->client->buttons & BUTTON_ATTACK ) ) {
+ other->client->ps.viewlocked = 1;
+
if ( self->s.frame && !is_flak ) {
// G_Printf ("gun: destroyed = %d\n", self->s.frame);
G_AddEvent( self, EV_GENERAL_SOUND, snd_noammo );
@@ -2026,8 +2028,6 @@ void mg42_track( gentity_t *self, gentity_t *other ) {
other->client->ps.viewlocked = 2; // this enable screen jitter when firing
}
}
- } else {
- other->client->ps.viewlocked = 1;
}
// move to the position over the next frame
diff --git a/SP/code/game/g_mover.c b/SP/code/game/g_mover.c
index 26786bd..a3a3055 100644
--- a/SP/code/game/g_mover.c
+++ b/SP/code/game/g_mover.c
@@ -1103,7 +1103,7 @@ qboolean IsBinaryMoverBlocked( gentity_t *ent, gentity_t *other, gentity_t *acti
if ( !activator ) {
if ( Q_stricmp( other->classname, "target_relay" ) == 0 ) {
is_relay = qtrue;
- } else if ( !activator->client ) {
+ } else {
return qfalse;
}
}
diff --git a/SP/code/game/g_props.c b/SP/code/game/g_props.c
index d8cd734..5a5bad1 100644
--- a/SP/code/game/g_props.c
+++ b/SP/code/game/g_props.c
@@ -881,11 +881,9 @@ void Props_Chair_Touch( gentity_t *self, gentity_t *other, trace_t *trace );
void Props_Chair_Die( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, int damage, int mod );
void Just_Got_Thrown( gentity_t *self ) {
- float len;
+ float len = 0;
vec3_t vec;
- len = 0;
-
if ( self->s.groundEntityNum == -1 ) {
self->nextthink = level.time + FRAMETIME;
@@ -1713,7 +1711,7 @@ void Use_DamageInflictor( gentity_t *ent, gentity_t *other, gentity_t *activator
gentity_t *daent;
daent = NULL;
- while ( ( daent = G_Find( daent, FOFS( targetname ), daent->target ) ) != NULL )
+ while ( daent && ( ( daent = G_Find( daent, FOFS( targetname ), daent->target ) ) != NULL ) )
{
if ( daent == ent ) {
G_Printf( "Use_DamageInflictor damaging self.\n" );
diff --git a/SP/code/game/g_save.c b/SP/code/game/g_save.c
index b92eeda..df10677 100644
--- a/SP/code/game/g_save.c
+++ b/SP/code/game/g_save.c
@@ -774,7 +774,7 @@ ReadEntity
void ReadEntity( fileHandle_t f, gentity_t *ent, int size ) {
saveField_t *field;
ignoreField_t *ifield;
- gentity_t temp, backup, backup2;
+ gentity_t temp = {{0}}, backup, backup2;
vmCvar_t cvar;
int decodedSize;
diff --git a/SP/code/game/g_script.c b/SP/code/game/g_script.c
index e85a4b0..982531b 100644
--- a/SP/code/game/g_script.c
+++ b/SP/code/game/g_script.c
@@ -308,7 +308,6 @@ void G_Script_ScriptParse( gentity_t *ent ) {
return;
}
- buildScript = trap_Cvar_VariableIntegerValue( "com_buildScript" );
buildScript = qtrue;
pScript = level.scriptEntity;
diff --git a/SP/code/game/g_target.c b/SP/code/game/g_target.c
index 579976d..0c05a9c 100644
--- a/SP/code/game/g_target.c
+++ b/SP/code/game/g_target.c
@@ -488,7 +488,7 @@ void target_relay_use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
}
- if ( self->spawnflags & 16 ) { // (SA) take key
+ if ( item && ( self->spawnflags & 16 ) ) { // (SA) take key
activator->client->ps.stats[STAT_KEYS] &= ~( 1 << item->giTag );
// (SA) TODO: "took inventory item" sound
}
diff --git a/SP/code/game/g_team.c b/SP/code/game/g_team.c
index 101c969..0240c5b 100644
--- a/SP/code/game/g_team.c
+++ b/SP/code/game/g_team.c
@@ -636,7 +636,7 @@ gentity_t *SelectRandomTeamSpawnPoint( int teamstate, team_t team ) {
gentity_t *spots[MAX_TEAM_SPAWN_POINTS];
char *classname;
qboolean initialSpawn = qfalse; // DHM - Nerve
- int i = 0,j; // JPW NERVE
+ int i = 0,j = 0; // JPW NERVE
int closest; // JPW NERVE
float shortest,tmp; // JPW NERVE
vec3_t target; // JPW NERVE
@@ -695,7 +695,6 @@ gentity_t *SelectRandomTeamSpawnPoint( int teamstate, team_t team ) {
} else {
// FIXME: temporarily select target as farthest point from first team spawnpoint
// we'll want to replace this with the target coords pulled from the UI target selection
- j = 0;
for ( j = 0; j < count; j++ ) {
if ( spots[j]->spawnflags & 1 ) { // only use spawnpoint if it's a permanent one
i = FindFarthestObjectiveIndex( spots[j]->s.origin );
diff --git a/SP/code/game/g_tramcar.c b/SP/code/game/g_tramcar.c
index 77aadfc..b4aa070 100644
--- a/SP/code/game/g_tramcar.c
+++ b/SP/code/game/g_tramcar.c
@@ -544,6 +544,10 @@ extern void func_explosive_explode( gentity_t *self, gentity_t *inflictor, genti
void Tramcar_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) {
gentity_t *slave;
+ if ( !self ) {
+ return;
+ }
+
func_explosive_explode( self, self, inflictor, 0, 0 );
// link all teammembers
diff --git a/SP/code/qcommon/files.c b/SP/code/qcommon/files.c
index 7383ab1..4910e5d 100644
--- a/SP/code/qcommon/files.c
+++ b/SP/code/qcommon/files.c
@@ -590,11 +590,13 @@ static void FS_CopyFile( char *fromOSPath, char *toOSPath ) {
fclose( f );
if ( FS_CreatePath( toOSPath ) ) {
+ free( buf );
return;
}
f = Sys_FOpen( toOSPath, "wb" );
if ( !f ) {
+ free( buf );
return;
}
if ( fwrite( buf, 1, len, f ) != len ) {
@@ -637,11 +639,13 @@ void FS_CopyFileOS( char *from, char *to ) {
fclose( f );
if ( FS_CreatePath( toOSPath ) ) {
+ free( buf );
return;
}
f = Sys_FOpen( toOSPath, "wb" );
if ( !f ) {
+ free( buf );
return;
}
if ( fwrite( buf, 1, len, f ) != len ) {
diff --git a/SP/code/qcommon/msg.c b/SP/code/qcommon/msg.c
index 7bf7f08..088e406 100644
--- a/SP/code/qcommon/msg.c
+++ b/SP/code/qcommon/msg.c
@@ -1027,7 +1027,7 @@ identical, under the assumption that the in-order delta code will catch it.
*/
void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entityState_s *to,
qboolean force ) {
- int i, c;
+ int i;
int numFields;
netField_t *field;
int trunc;
@@ -1052,8 +1052,6 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity
// struct without updating the message fields
assert( numFields + 1 == sizeof( *from ) / 4 );
- c = msg->cursize;
-
// a NULL to is a delta remove message
if ( to == NULL ) {
if ( from == NULL ) {
@@ -1188,7 +1186,6 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity
}
}
}
- c = msg->cursize - c;
if ( print ) {
if ( msg->bit == 0 ) {
diff --git a/SP/code/rend2/tr_backend.c b/SP/code/rend2/tr_backend.c
index 3fcb7d9..8bb9f5d 100644
--- a/SP/code/rend2/tr_backend.c
+++ b/SP/code/rend2/tr_backend.c
@@ -969,6 +969,15 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
oldNumIndex = tess.numIndexes;
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );
+
+ // RF, convert the newly created vertexes into dust particles, and overwrite
+ if (backEnd.currentEntity->e.reFlags & REFLAG_ZOMBIEFX) {
+ RB_ZombieFX( 0, drawSurf, oldNumVerts, oldNumIndex );
+ }
+ else if (backEnd.currentEntity->e.reFlags & REFLAG_ZOMBIEFX2) {
+ RB_ZombieFX( 1, drawSurf, oldNumVerts, oldNumIndex );
+ }
+
continue;
}
oldSort = drawSurf->sort;
diff --git a/SP/code/rend2/tr_bsp.c b/SP/code/rend2/tr_bsp.c
index fa274e5..1b9365d 100644
--- a/SP/code/rend2/tr_bsp.c
+++ b/SP/code/rend2/tr_bsp.c
@@ -602,8 +602,6 @@ static void R_LoadVisibility( lump_t *l ) {
int len;
byte *buf;
- len = ( s_worldData.numClusters + 63 ) & ~63;
-
len = l->filelen;
if ( !len ) {
return;
@@ -1638,7 +1636,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for ( m = 0; m < 2; m++ ) {
- if ( grid2->width >= MAX_GRID_SIZE ) {
+ if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -1694,7 +1692,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for ( m = 0; m < 2; m++ ) {
- if ( grid2->height >= MAX_GRID_SIZE ) {
+ if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -1764,7 +1762,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for ( k = grid1->height - 1; k > 1; k -= 2 ) {
for ( m = 0; m < 2; m++ ) {
- if ( grid2->width >= MAX_GRID_SIZE ) {
+ if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -1820,7 +1818,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for ( m = 0; m < 2; m++ ) {
- if ( grid2->height >= MAX_GRID_SIZE ) {
+ if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
diff --git a/SP/code/rend2/tr_flares.c b/SP/code/rend2/tr_flares.c
index 27c03e4..f88fdc7 100644
--- a/SP/code/rend2/tr_flares.c
+++ b/SP/code/rend2/tr_flares.c
@@ -306,7 +306,7 @@ void RB_AddCoronaFlares( void ) {
}
cor = backEnd.refdef.coronas;
- fog = tr.world->fogs;
+
for ( i = 0 ; i < backEnd.refdef.num_coronas ; i++, cor++ ) {
// find which fog volume the corona is in
diff --git a/SP/code/rend2/tr_image.c b/SP/code/rend2/tr_image.c
index 92320be..592ee40 100644
--- a/SP/code/rend2/tr_image.c
+++ b/SP/code/rend2/tr_image.c
@@ -44,49 +44,6 @@ int gl_filter_max = GL_LINEAR;
#define FILE_HASH_SIZE 4096
static image_t* hashTable[FILE_HASH_SIZE];
-// Ridah, in order to prevent zone fragmentation, all images will
-// be read into this buffer. In order to keep things as fast as possible,
-// we'll give it a starting value, which will account for the majority of
-// images, but allow it to grow if the buffer isn't big enough
-#define R_IMAGE_BUFFER_SIZE ( 512 * 512 * 4 ) // 512 x 512 x 32bit
-
-typedef enum {
- BUFFER_IMAGE,
- BUFFER_SCALED,
- BUFFER_RESAMPLED,
- BUFFER_MAX_TYPES
-} bufferMemType_t;
-
-int imageBufferSize[BUFFER_MAX_TYPES] = {0,0,0};
-void *imageBufferPtr[BUFFER_MAX_TYPES] = {NULL,NULL,NULL};
-
-void *R_GetImageBuffer( int size, bufferMemType_t bufferType ) {
- if ( imageBufferSize[bufferType] < R_IMAGE_BUFFER_SIZE && size <= imageBufferSize[bufferType] ) {
- imageBufferSize[bufferType] = R_IMAGE_BUFFER_SIZE;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
- }
- if ( size > imageBufferSize[bufferType] ) { // it needs to grow
- if ( imageBufferPtr[bufferType] ) {
- free( imageBufferPtr[bufferType] );
- }
- imageBufferSize[bufferType] = size;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
- }
-
- return imageBufferPtr[bufferType];
-}
-
-void R_FreeImageBuffer( void ) {
- int bufferType;
- for ( bufferType = 0; bufferType < BUFFER_MAX_TYPES; bufferType++ ) {
- if ( !imageBufferPtr[bufferType] ) {
- return;
- }
- free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = 0;
- imageBufferPtr[bufferType] = NULL;
- }
-}
/*
** R_GammaCorrect
@@ -2072,7 +2029,7 @@ static void Upload32( byte *data, int width, int height, imgType_t type, imgFlag
if ( r_rmse->value ) {
while ( R_RMSE( (byte *)data, width, height ) < r_rmse->value ) {
rmse_saved += ( height * width * 4 ) - ( ( width >> 1 ) * ( height >> 1 ) * 4 );
- resampledBuffer = R_GetImageBuffer( ( width >> 1 ) * ( height >> 1 ) * 4, BUFFER_RESAMPLED );
+ resampledBuffer = ri.Hunk_AllocateTempMemory( ( width >> 1 ) * ( height >> 1 ) * 4 );
ResampleTexture( data, width, height, resampledBuffer, width >> 1, height >> 1 );
data = resampledBuffer;
width = width >> 1;
@@ -2280,26 +2237,12 @@ image_t *R_CreateImageExt( const char *name, byte *pic, int width, int height, i
qboolean isLightmap = qfalse;
int glWrapClampMode;
long hash;
- qboolean noCompress = qfalse;
if ( strlen( name ) >= MAX_QPATH ) {
ri.Error( ERR_DROP, "R_CreateImage: \"%s\" is too long", name );
}
if ( !strncmp( name, "*lightmap", 9 ) ) {
isLightmap = qtrue;
- noCompress = qtrue;
- }
- if ( !noCompress && strstr( name, "skies" ) ) {
- noCompress = qtrue;
- }
- if ( !noCompress && strstr( name, "weapons" ) ) { // don't compress view weapon skins
- noCompress = qtrue;
- }
- // RF, if the shader hasn't specifically asked for it, don't allow compression
- if ( r_ext_compressed_textures->integer == 2 && ( tr.allowCompress != qtrue ) ) {
- noCompress = qtrue;
- } else if ( r_ext_compressed_textures->integer == 1 && ( tr.allowCompress < 0 ) ) {
- noCompress = qtrue;
}
if ( tr.numImages == MAX_DRAWIMAGES ) {
@@ -3362,9 +3305,9 @@ qhandle_t RE_GetShaderFromModel( qhandle_t modelid, int surfnum, int withlightma
// msurface_t *surf;
// shader_t *shd;
- if ( surfnum < 0 ) {
- surfnum = 0;
- }
+// if ( surfnum < 0 ) {
+// surfnum = 0;
+// }
// model = R_GetModelByHandle( modelid ); // (SA) should be correct now
/* FIXME - Rend2
@@ -4014,7 +3957,7 @@ qboolean R_CropImage( char *name, byte **pic, int border, int *width, int *heigh
#endif // RESIZE
#endif // FUNNEL_HACK
- temppic = malloc( sizeof( unsigned int ) * diff[0] * diff[1] );
+ temppic = ri.Z_Malloc( sizeof( unsigned int ) * diff[0] * diff[1] );
outpixel = temppic;
for ( row = mins[1]; row < maxs[1]; row++ )
@@ -4127,7 +4070,7 @@ void R_CropAndNumberImagesInDirectory( char *dir, char *ext, int maxWidth, in
#else
newWidth = maxWidth;
newHeight = maxHeight;
- temppic = malloc( sizeof( unsigned int ) * newWidth * newHeight );
+ temppic = ri.Z_Malloc( sizeof( unsigned int ) * newWidth * newHeight );
ResampleTexture( pic, width, height, temppic, newWidth, newHeight );
memcpy( pic, temppic, sizeof( unsigned int ) * newWidth * newHeight );
ri.Free( temppic );
diff --git a/SP/code/rend2/tr_init.c b/SP/code/rend2/tr_init.c
index 1a52d9c..85917e7 100644
--- a/SP/code/rend2/tr_init.c
+++ b/SP/code/rend2/tr_init.c
@@ -1673,10 +1673,8 @@ void RE_Shutdown( qboolean destroyWindow ) {
if ( destroyWindow ) {
GLimp_Shutdown();
- // Ridah, release the virtual memory
- R_Hunk_End();
- R_FreeImageBuffer();
- //ri.Tag_Free(); // wipe all render alloc'd zone memory
+ Com_Memset( &glConfig, 0, sizeof( glConfig ) );
+ Com_Memset( &glState, 0, sizeof( glState ) );
}
tr.registered = qfalse;
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index 2d75320..8727f64 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -2353,7 +2353,6 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float color[4],
void RB_InstantQuad( vec4_t quadVerts[4] );
//void RB_InstantQuad2(vec4_t quadVerts[4], vec2_t texCoords[4], vec4_t color, shaderProgram_t *sp, vec2_t invTexRes);
void RB_InstantQuad2(vec4_t quadVerts[4], vec2_t texCoords[4]);
-void RB_AddQuadStampFadingCornersExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 );
void RB_ShowImages( void );
@@ -2870,6 +2869,5 @@ extern int drawskyboxportal;
// Ridah, virtual memory
void *R_Hunk_Begin( void );
void R_Hunk_End( void );
-void R_FreeImageBuffer( void );
#endif //TR_LOCAL_H (THIS MUST BE LAST!!)
diff --git a/SP/code/rend2/tr_model.c b/SP/code/rend2/tr_model.c
index 3ed85c1..59cad61 100644
--- a/SP/code/rend2/tr_model.c
+++ b/SP/code/rend2/tr_model.c
@@ -545,8 +545,6 @@ qboolean R_MDC_EncodeXyzCompressed( const vec3_t vec, const vec3_t normal, mdcXy
int i;
unsigned char anorm;
- i = sizeof( mdcXyzCompressed_t );
-
retval.ofsVec = 0;
for ( i = 0; i < 3; i++ ) {
if ( fabs( vec[i] ) >= MDC_MAX_DIST ) {
@@ -2194,7 +2192,7 @@ int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNam
start = &start_space;
end = &end_space;
retval = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, startIndex, &start);
- retval = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, startIndex, &end);
+ R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, startIndex, &end);
}
else if ( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
@@ -2206,7 +2204,7 @@ int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNam
} else if ( model->type == MOD_MESH ) {
// old MD3 style
retval = R_GetTag(model->mdv[0], startFrame, tagName, startIndex, &start);
- retval = R_GetTag(model->mdv[0], endFrame, tagName, startIndex, &end);
+ R_GetTag(model->mdv[0], endFrame, tagName, startIndex, &end);
} else if ( model->type == MOD_MDS ) { // use bone lerping
retval = R_GetBoneTag( tag, model->mds, startIndex, refent, tagNameIn );
diff --git a/SP/code/rend2/tr_model_iqm.c b/SP/code/rend2/tr_model_iqm.c
index d442b7a..86656fa 100644
--- a/SP/code/rend2/tr_model_iqm.c
+++ b/SP/code/rend2/tr_model_iqm.c
@@ -144,7 +144,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
unsigned short *framedata;
char *str;
int i, j;
- float jointInvMats[IQM_MAX_JOINTS * 12];
+ float jointInvMats[IQM_MAX_JOINTS * 12] = {0.0f};
float *mat, *matInv;
size_t size, joint_names;
iqmData_t *iqmData;
diff --git a/SP/code/rend2/tr_shade_calc.c b/SP/code/rend2/tr_shade_calc.c
index fd3febb..11859a2 100644
--- a/SP/code/rend2/tr_shade_calc.c
+++ b/SP/code/rend2/tr_shade_calc.c
@@ -694,7 +694,7 @@ float RB_CalcWaveAlphaSingle( const waveForm_t *wf )
*/
void RB_CalcModulateColorsByFog( unsigned char *colors ) {
int i;
- float texCoords[SHADER_MAX_VERTEXES][2];
+ float texCoords[SHADER_MAX_VERTEXES][2] = {{0.0f}};
// calculate texcoords so we can derive density
// this is not wasted, because it would only have
diff --git a/SP/code/rend2/tr_shader.c b/SP/code/rend2/tr_shader.c
index 79baee9..ac66772 100644
--- a/SP/code/rend2/tr_shader.c
+++ b/SP/code/rend2/tr_shader.c
@@ -3864,7 +3864,7 @@ a single large text block that can be scanned for shader names
#define MAX_SHADER_FILES 4096
static void ScanAndLoadShaderFiles( void ) {
char **shaderFiles;
- char *buffers[MAX_SHADER_FILES];
+ char *buffers[MAX_SHADER_FILES] = {NULL};
char *p;
int numShaderFiles;
int i;
diff --git a/SP/code/rend2/tr_surface.c b/SP/code/rend2/tr_surface.c
index b248b8c..988073e 100644
--- a/SP/code/rend2/tr_surface.c
+++ b/SP/code/rend2/tr_surface.c
@@ -90,107 +90,6 @@ void RB_CheckVBOandIBO(VBO_t *vbo, IBO_t *ibo)
/*
==============
-RB_AddQuadStampFadingCornersExt
-
- Creates a sprite with the center at colors[3] alpha, and the corners all 0 alpha
-==============
-*/
-void RB_AddQuadStampFadingCornersExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 ) {
- vec3_t normal;
- int ndx;
- byte lColor[4];
-
- RB_CHECKOVERFLOW( 5, 12 );
-
- ndx = tess.numVertexes;
-
- // triangle indexes for a simple quad
- tess.indexes[ tess.numIndexes + 0 ] = ndx + 0;
- tess.indexes[ tess.numIndexes + 1 ] = ndx + 1;
- tess.indexes[ tess.numIndexes + 2 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 3 ] = ndx + 1;
- tess.indexes[ tess.numIndexes + 4 ] = ndx + 2;
- tess.indexes[ tess.numIndexes + 5 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 6 ] = ndx + 2;
- tess.indexes[ tess.numIndexes + 7 ] = ndx + 3;
- tess.indexes[ tess.numIndexes + 8 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 9 ] = ndx + 3;
- tess.indexes[ tess.numIndexes + 10] = ndx + 0;
- tess.indexes[ tess.numIndexes + 11] = ndx + 4;
-
- tess.xyz[ndx][0] = origin[0] + left[0] + up[0];
- tess.xyz[ndx][1] = origin[1] + left[1] + up[1];
- tess.xyz[ndx][2] = origin[2] + left[2] + up[2];
-
- tess.xyz[ndx + 1][0] = origin[0] - left[0] + up[0];
- tess.xyz[ndx + 1][1] = origin[1] - left[1] + up[1];
- tess.xyz[ndx + 1][2] = origin[2] - left[2] + up[2];
-
- tess.xyz[ndx + 2][0] = origin[0] - left[0] - up[0];
- tess.xyz[ndx + 2][1] = origin[1] - left[1] - up[1];
- tess.xyz[ndx + 2][2] = origin[2] - left[2] - up[2];
-
- tess.xyz[ndx + 3][0] = origin[0] + left[0] - up[0];
- tess.xyz[ndx + 3][1] = origin[1] + left[1] - up[1];
- tess.xyz[ndx + 3][2] = origin[2] + left[2] - up[2];
-
- tess.xyz[ndx + 4][0] = origin[0];
- tess.xyz[ndx + 4][1] = origin[1];
- tess.xyz[ndx + 4][2] = origin[2];
-
-
- // constant normal all the way around
- VectorSubtract( vec3_origin, backEnd.viewParms.or.axis[0], normal );
-
- //tess.normal[ndx][0] = tess.normal[ndx + 1][0] = tess.normal[ndx + 2][0] = tess.normal[ndx + 3][0] = tess.normal[ndx + 4][0] = normal[0];
- //tess.normal[ndx][1] = tess.normal[ndx + 1][1] = tess.normal[ndx + 2][1] = tess.normal[ndx + 3][1] = tess.normal[ndx + 4][1] = normal[1];
- //tess.normal[ndx][2] = tess.normal[ndx + 1][2] = tess.normal[ndx + 2][2] = tess.normal[ndx + 3][2] = tess.normal[ndx + 4][2] = normal[2];
-
- tess.normal[ndx] =
- tess.normal[ndx+1] =
- tess.normal[ndx+2] =
- tess.normal[ndx+3] =
- tess.normal[ndx+4] = R_VboPackNormal(normal);
-
- // standard square texture coordinates
- tess.texCoords[ndx][0][0] = tess.texCoords[ndx][1][0] = s1;
- tess.texCoords[ndx][0][1] = tess.texCoords[ndx][1][1] = t1;
-
- tess.texCoords[ndx + 1][0][0] = tess.texCoords[ndx + 1][1][0] = s2;
- tess.texCoords[ndx + 1][0][1] = tess.texCoords[ndx + 1][1][1] = t1;
-
- tess.texCoords[ndx + 2][0][0] = tess.texCoords[ndx + 2][1][0] = s2;
- tess.texCoords[ndx + 2][0][1] = tess.texCoords[ndx + 2][1][1] = t2;
-
- tess.texCoords[ndx + 3][0][0] = tess.texCoords[ndx + 3][1][0] = s1;
- tess.texCoords[ndx + 3][0][1] = tess.texCoords[ndx + 3][1][1] = t2;
-
- tess.texCoords[ndx + 4][0][0] = tess.texCoords[ndx + 4][1][0] = ( s1 + s2 ) / 2.0;
- tess.texCoords[ndx + 4][0][1] = tess.texCoords[ndx + 4][1][1] = ( t1 + t2 ) / 2.0;
-
- // center uses full alpha
- *( unsigned int * ) &tess.vertexColors[ndx + 4] =
- *( unsigned int * )color;
-
- // fade around edges
- memcpy( lColor, color, sizeof( byte ) * 4 );
- lColor[3] = 0;
- *( unsigned int * ) &tess.vertexColors[ndx] =
- *( unsigned int * ) &tess.vertexColors[ndx + 1] =
- *( unsigned int * ) &tess.vertexColors[ndx + 2] =
- *( unsigned int * ) &tess.vertexColors[ndx + 3] =
- *( unsigned int * )lColor;
-
-
- tess.numVertexes += 5;
- tess.numIndexes += 12;
-}
-
-/*
-==============
RB_AddQuadStampExt
==============
*/
@@ -359,6 +258,8 @@ static void RB_SurfaceSplash( void ) {
VectorSubtract( vec3_origin, left, left );
}
+ VectorScale4(ent->e.shaderRGBA, 1.0f / 255.0f, colors);
+
RB_AddQuadStamp( ent->e.origin, left, up, colors );
}
diff --git a/SP/code/rend2/tr_world.c b/SP/code/rend2/tr_world.c
index ff3bf97..4987d83 100644
--- a/SP/code/rend2/tr_world.c
+++ b/SP/code/rend2/tr_world.c
@@ -630,6 +630,9 @@ static void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits,
int c;
int surf, *view;
+ // RF, hack, dlight elimination above is unreliable
+ dlightBits = 0xffffffff;
+
tr.pc.c_leafs++;
// add to z buffer bounds
diff --git a/SP/code/renderer/tr_backend.c b/SP/code/renderer/tr_backend.c
index 7cc10a1..48bd722 100644
--- a/SP/code/renderer/tr_backend.c
+++ b/SP/code/renderer/tr_backend.c
@@ -929,7 +929,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
oldNumIndex = tess.numIndexes;
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );
-/*
+
// RF, convert the newly created vertexes into dust particles, and overwrite
if (backEnd.currentEntity->e.reFlags & REFLAG_ZOMBIEFX) {
RB_ZombieFX( 0, drawSurf, oldNumVerts, oldNumIndex );
@@ -937,7 +937,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
else if (backEnd.currentEntity->e.reFlags & REFLAG_ZOMBIEFX2) {
RB_ZombieFX( 1, drawSurf, oldNumVerts, oldNumIndex );
}
-*/
continue;
}
oldSort = drawSurf->sort;
diff --git a/SP/code/renderer/tr_bsp.c b/SP/code/renderer/tr_bsp.c
index 5ba2c7a..6a3ef50 100644
--- a/SP/code/renderer/tr_bsp.c
+++ b/SP/code/renderer/tr_bsp.c
@@ -855,7 +855,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for ( m = 0; m < 2; m++ ) {
- if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
+ if ( grid2->width >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -911,7 +911,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for ( m = 0; m < 2; m++ ) {
- if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
+ if ( grid2->height >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -978,7 +978,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
for ( k = 0; k < grid1->height - 2; k += 2 ) {
for ( m = 0; m < 2; m++ ) {
- if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
+ if ( grid2->width >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
@@ -1034,7 +1034,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
}
for ( m = 0; m < 2; m++ ) {
- if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
+ if ( grid2->height >= MAX_GRID_SIZE ) {
break;
}
if ( m ) {
diff --git a/SP/code/renderer/tr_flares.c b/SP/code/renderer/tr_flares.c
index 5aab7b5..40f31b5 100644
--- a/SP/code/renderer/tr_flares.c
+++ b/SP/code/renderer/tr_flares.c
@@ -306,7 +306,7 @@ void RB_AddCoronaFlares( void ) {
}
cor = backEnd.refdef.coronas;
- fog = tr.world->fogs;
+
for ( i = 0 ; i < backEnd.refdef.num_coronas ; i++, cor++ ) {
// find which fog volume the corona is in
diff --git a/SP/code/renderer/tr_image.c b/SP/code/renderer/tr_image.c
index 1a0eb18..a107ace 100644
--- a/SP/code/renderer/tr_image.c
+++ b/SP/code/renderer/tr_image.c
@@ -44,49 +44,6 @@ int gl_filter_max = GL_LINEAR;
#define FILE_HASH_SIZE 4096
static image_t* hashTable[FILE_HASH_SIZE];
-// Ridah, in order to prevent zone fragmentation, all images will
-// be read into this buffer. In order to keep things as fast as possible,
-// we'll give it a starting value, which will account for the majority of
-// images, but allow it to grow if the buffer isn't big enough
-#define R_IMAGE_BUFFER_SIZE ( 512 * 512 * 4 ) // 512 x 512 x 32bit
-
-typedef enum {
- BUFFER_IMAGE,
- BUFFER_SCALED,
- BUFFER_RESAMPLED,
- BUFFER_MAX_TYPES
-} bufferMemType_t;
-
-int imageBufferSize[BUFFER_MAX_TYPES] = {0,0,0};
-void *imageBufferPtr[BUFFER_MAX_TYPES] = {NULL,NULL,NULL};
-
-void *R_GetImageBuffer( int size, bufferMemType_t bufferType ) {
- if ( imageBufferSize[bufferType] < R_IMAGE_BUFFER_SIZE && size <= imageBufferSize[bufferType] ) {
- imageBufferSize[bufferType] = R_IMAGE_BUFFER_SIZE;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
- }
- if ( size > imageBufferSize[bufferType] ) { // it needs to grow
- if ( imageBufferPtr[bufferType] ) {
- free( imageBufferPtr[bufferType] );
- }
- imageBufferSize[bufferType] = size;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
- }
-
- return imageBufferPtr[bufferType];
-}
-
-void R_FreeImageBuffer( void ) {
- int bufferType;
- for ( bufferType = 0; bufferType < BUFFER_MAX_TYPES; bufferType++ ) {
- if ( !imageBufferPtr[bufferType] ) {
- return;
- }
- free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = 0;
- imageBufferPtr[bufferType] = NULL;
- }
-}
/*
** R_GammaCorrect
@@ -698,7 +655,7 @@ static void Upload32( unsigned *data,
if ( r_rmse->value ) {
while ( R_RMSE( (byte *)data, width, height ) < r_rmse->value ) {
rmse_saved += ( height * width * 4 ) - ( ( width >> 1 ) * ( height >> 1 ) * 4 );
- resampledBuffer = R_GetImageBuffer( ( width >> 1 ) * ( height >> 1 ) * 4, BUFFER_RESAMPLED );
+ resampledBuffer = ri.Hunk_AllocateTempMemory( ( width >> 1 ) * ( height >> 1 ) * 4 );
ResampleTexture( data, width, height, resampledBuffer, width >> 1, height >> 1 );
data = resampledBuffer;
width = width >> 1;
@@ -712,7 +669,7 @@ static void Upload32( unsigned *data,
// just do the RMSE of 1 (reduce perfect)
while ( R_RMSE( (byte *)data, width, height ) < 1.0 ) {
rmse_saved += ( height * width * 4 ) - ( ( width >> 1 ) * ( height >> 1 ) * 4 );
- resampledBuffer = R_GetImageBuffer( ( width >> 1 ) * ( height >> 1 ) * 4, BUFFER_RESAMPLED );
+ resampledBuffer = ri.Hunk_AllocateTempMemory( ( width >> 1 ) * ( height >> 1 ) * 4 );
ResampleTexture( data, width, height, resampledBuffer, width >> 1, height >> 1 );
data = resampledBuffer;
width = width >> 1;
@@ -728,16 +685,13 @@ static void Upload32( unsigned *data,
;
for ( scaled_height = 1 ; scaled_height < height ; scaled_height <<= 1 )
;
- if ( r_roundImagesDown->integer && scaled_width > width ) {
+ if ( r_roundImagesDown->integer && scaled_width > width )
scaled_width >>= 1;
- }
- if ( r_roundImagesDown->integer && scaled_height > height ) {
+ if ( r_roundImagesDown->integer && scaled_height > height )
scaled_height >>= 1;
- }
if ( scaled_width != width || scaled_height != height ) {
- //resampledBuffer = ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
- resampledBuffer = R_GetImageBuffer( scaled_width * scaled_height * 4, BUFFER_RESAMPLED );
+ resampledBuffer = ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
ResampleTexture( data, width, height, resampledBuffer, scaled_width, scaled_height );
data = resampledBuffer;
width = scaled_width;
@@ -763,7 +717,7 @@ static void Upload32( unsigned *data,
// deal with a half mip resampling
//
while ( scaled_width > glConfig.maxTextureSize
- || scaled_height > glConfig.maxTextureSize ) {
+ || scaled_height > glConfig.maxTextureSize ) {
scaled_width >>= 1;
scaled_height >>= 1;
}
@@ -785,7 +739,7 @@ static void Upload32( unsigned *data,
ri.Printf( PRINT_ALL, "r_lowMemTextureSize forcing reduction from %i x %i to %i x %i\n", width, height, scaled_width, scaled_height );
- resampledBuffer = R_GetImageBuffer( scaled_width * scaled_height * 4, BUFFER_RESAMPLED );
+ resampledBuffer = ri.Hunk_AllocateTempMemory( scaled_width * scaled_height * 4 );
ResampleTexture( data, width, height, resampledBuffer, scaled_width, scaled_height );
data = resampledBuffer;
width = scaled_width;
@@ -804,8 +758,7 @@ static void Upload32( unsigned *data,
scaled_height = 1;
}
- //scaledBuffer = ri.Hunk_AllocateTempMemory( sizeof( unsigned ) * scaled_width * scaled_height );
- scaledBuffer = R_GetImageBuffer( sizeof( unsigned ) * scaled_width * scaled_height, BUFFER_SCALED );
+ scaledBuffer = ri.Hunk_AllocateTempMemory( sizeof( unsigned ) * scaled_width * scaled_height );
//
// scan the texture for each channel's max values
@@ -1043,10 +996,10 @@ done:
GL_CheckErrors();
- //if ( scaledBuffer != 0 )
- // ri.Hunk_FreeTempMemory( scaledBuffer );
- //if ( resampledBuffer != 0 )
- // ri.Hunk_FreeTempMemory( resampledBuffer );
+ if ( scaledBuffer != 0 )
+ ri.Hunk_FreeTempMemory( scaledBuffer );
+ if ( resampledBuffer != 0 )
+ ri.Hunk_FreeTempMemory( resampledBuffer );
}
@@ -2462,7 +2415,7 @@ qboolean R_CropImage( char *name, byte **pic, int border, int *width, int *heigh
#endif // RESIZE
#endif // FUNNEL_HACK
- temppic = malloc( sizeof( unsigned int ) * diff[0] * diff[1] );
+ temppic = ri.Z_Malloc( sizeof( unsigned int ) * diff[0] * diff[1] );
outpixel = temppic;
for ( row = mins[1]; row < maxs[1]; row++ )
@@ -2575,7 +2528,7 @@ void R_CropAndNumberImagesInDirectory( char *dir, char *ext, int maxWidth, in
#else
newWidth = maxWidth;
newHeight = maxHeight;
- temppic = malloc( sizeof( unsigned int ) * newWidth * newHeight );
+ temppic = ri.Z_Malloc( sizeof( unsigned int ) * newWidth * newHeight );
ResampleTexture( (unsigned int *)pic, width, height, (unsigned int *)temppic, newWidth, newHeight );
memcpy( pic, temppic, sizeof( unsigned int ) * newWidth * newHeight );
ri.Free( temppic );
diff --git a/SP/code/renderer/tr_init.c b/SP/code/renderer/tr_init.c
index 2c97de1..6f34ff6 100644
--- a/SP/code/renderer/tr_init.c
+++ b/SP/code/renderer/tr_init.c
@@ -1470,10 +1470,8 @@ void RE_Shutdown( qboolean destroyWindow ) {
if ( destroyWindow ) {
GLimp_Shutdown();
- // Ridah, release the virtual memory
- R_Hunk_End();
- R_FreeImageBuffer();
- //ri.Tag_Free(); // wipe all render alloc'd zone memory
+ Com_Memset( &glConfig, 0, sizeof( glConfig ) );
+ Com_Memset( &glState, 0, sizeof( glState ) );
}
tr.registered = qfalse;
diff --git a/SP/code/renderer/tr_local.h b/SP/code/renderer/tr_local.h
index 9646f5e..4c9ef07 100644
--- a/SP/code/renderer/tr_local.h
+++ b/SP/code/renderer/tr_local.h
@@ -1519,7 +1519,6 @@ void RB_StageIteratorLightmappedMultitexture( void );
void RB_AddQuadStamp( vec3_t origin, vec3_t left, vec3_t up, byte *color );
void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 );
-void RB_AddQuadStampFadingCornersExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 );
void RB_ShowImages( void );
@@ -1971,6 +1970,5 @@ extern int drawskyboxportal;
// Ridah, virtual memory
void *R_Hunk_Begin( void );
void R_Hunk_End( void );
-void R_FreeImageBuffer( void );
#endif //TR_LOCAL_H (THIS MUST BE LAST!!)
diff --git a/SP/code/renderer/tr_model.c b/SP/code/renderer/tr_model.c
index f2c5aea..c471aff 100644
--- a/SP/code/renderer/tr_model.c
+++ b/SP/code/renderer/tr_model.c
@@ -571,8 +571,6 @@ qboolean R_MDC_EncodeXyzCompressed( const vec3_t vec, const vec3_t normal, mdcXy
int i;
unsigned char anorm;
- i = sizeof( mdcXyzCompressed_t );
-
retval.ofsVec = 0;
for ( i = 0; i < 3; i++ ) {
if ( fabs( vec[i] ) >= MDC_MAX_DIST ) {
@@ -880,7 +878,9 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *mod_
md3St_t *st;
md3XyzNormal_t *xyz;
mdcXyzCompressed_t *xyzComp;
+#ifdef Q3_BIG_ENDIAN
mdcTag_t *tag;
+#endif
short *ps;
int version;
int size;
@@ -941,16 +941,16 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *mod_
}
}
+#ifdef Q3_BIG_ENDIAN
// swap all the tags
tag = ( mdcTag_t * )( (byte *)mod->mdc[lod] + mod->mdc[lod]->ofsTags );
- if ( LittleLong( 1 ) != 1 ) {
- for ( i = 0 ; i < mod->mdc[lod]->numTags * mod->mdc[lod]->numFrames ; i++, tag++ ) {
- for ( j = 0 ; j < 3 ; j++ ) {
- tag->xyz[j] = LittleShort( tag->xyz[j] );
- tag->angles[j] = LittleShort( tag->angles[j] );
- }
+ for ( i = 0 ; i < mod->mdc[lod]->numTags * mod->mdc[lod]->numFrames ; i++, tag++ ) {
+ for ( j = 0 ; j < 3 ; j++ ) {
+ tag->xyz[j] = LittleShort( tag->xyz[j] );
+ tag->angles[j] = LittleShort( tag->angles[j] );
}
}
+#endif
// swap all the surfaces
surf = ( mdcSurface_t * )( (byte *)mod->mdc[lod] + mod->mdc[lod]->ofsSurfaces );
@@ -2091,7 +2091,7 @@ int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNam
start = &start_space;
end = &end_space;
retval = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, startIndex, &start);
- retval = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, startIndex, &end);
+ R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, startIndex, &end);
}
else if ( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
@@ -2103,7 +2103,7 @@ int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNam
} else if ( model->type == MOD_MESH ) {
// old MD3 style
retval = R_GetTag( (byte *)model->md3[0], startFrame, tagName, startIndex, &start );
- retval = R_GetTag( (byte *)model->md3[0], endFrame, tagName, startIndex, &end );
+ R_GetTag( (byte *)model->md3[0], endFrame, tagName, startIndex, &end );
} else if ( model->type == MOD_MDS ) { // use bone lerping
retval = R_GetBoneTag( tag, model->mds, startIndex, refent, tagNameIn );
@@ -2119,7 +2119,7 @@ int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNam
mdcTag_t *cstart, *cend;
retval = R_GetMDCTag( (byte *)model->mdc[0], startFrame, tagName, startIndex, &cstart );
- retval = R_GetMDCTag( (byte *)model->mdc[0], endFrame, tagName, startIndex, &cend );
+ R_GetMDCTag( (byte *)model->mdc[0], endFrame, tagName, startIndex, &cend );
// uncompress the MDC tags into MD3 style tags
if ( cstart && cend ) {
diff --git a/SP/code/renderer/tr_model_iqm.c b/SP/code/renderer/tr_model_iqm.c
index 543aeeb..5ab41c2 100644
--- a/SP/code/renderer/tr_model_iqm.c
+++ b/SP/code/renderer/tr_model_iqm.c
@@ -144,7 +144,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
unsigned short *framedata;
char *str;
int i, j;
- float jointInvMats[IQM_MAX_JOINTS * 12];
+ float jointInvMats[IQM_MAX_JOINTS * 12] = {0.0f};
float *mat, *matInv;
size_t size, joint_names;
iqmData_t *iqmData;
diff --git a/SP/code/renderer/tr_shade_calc.c b/SP/code/renderer/tr_shade_calc.c
index e687e2f..c9ff99d 100644
--- a/SP/code/renderer/tr_shade_calc.c
+++ b/SP/code/renderer/tr_shade_calc.c
@@ -781,7 +781,7 @@ void RB_CalcWaveAlpha( const waveForm_t *wf, unsigned char *dstColors ) {
*/
void RB_CalcModulateColorsByFog( unsigned char *colors ) {
int i;
- float texCoords[SHADER_MAX_VERTEXES][2];
+ float texCoords[SHADER_MAX_VERTEXES][2] = {{0.0f}};
// calculate texcoords so we can derive density
// this is not wasted, because it would only have
@@ -801,7 +801,7 @@ void RB_CalcModulateColorsByFog( unsigned char *colors ) {
*/
void RB_CalcModulateAlphasByFog( unsigned char *colors ) {
int i;
- float texCoords[SHADER_MAX_VERTEXES][2];
+ float texCoords[SHADER_MAX_VERTEXES][2] = {{0.0f}};
// calculate texcoords so we can derive density
// this is not wasted, because it would only have
@@ -819,7 +819,7 @@ void RB_CalcModulateAlphasByFog( unsigned char *colors ) {
*/
void RB_CalcModulateRGBAsByFog( unsigned char *colors ) {
int i;
- float texCoords[SHADER_MAX_VERTEXES][2];
+ float texCoords[SHADER_MAX_VERTEXES][2] = {{0.0f}};
// calculate texcoords so we can derive density
// this is not wasted, because it would only have
diff --git a/SP/code/renderer/tr_surface.c b/SP/code/renderer/tr_surface.c
index b5f4b5c..6e28b44 100644
--- a/SP/code/renderer/tr_surface.c
+++ b/SP/code/renderer/tr_surface.c
@@ -75,101 +75,6 @@ void RB_CheckOverflow( int verts, int indexes ) {
/*
==============
-RB_AddQuadStampFadingCornersExt
-
- Creates a sprite with the center at colors[3] alpha, and the corners all 0 alpha
-==============
-*/
-void RB_AddQuadStampFadingCornersExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 ) {
- vec3_t normal;
- int ndx;
- byte lColor[4];
-
- RB_CHECKOVERFLOW( 5, 12 );
-
- ndx = tess.numVertexes;
-
- // triangle indexes for a simple quad
- tess.indexes[ tess.numIndexes + 0 ] = ndx + 0;
- tess.indexes[ tess.numIndexes + 1 ] = ndx + 1;
- tess.indexes[ tess.numIndexes + 2 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 3 ] = ndx + 1;
- tess.indexes[ tess.numIndexes + 4 ] = ndx + 2;
- tess.indexes[ tess.numIndexes + 5 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 6 ] = ndx + 2;
- tess.indexes[ tess.numIndexes + 7 ] = ndx + 3;
- tess.indexes[ tess.numIndexes + 8 ] = ndx + 4;
-
- tess.indexes[ tess.numIndexes + 9 ] = ndx + 3;
- tess.indexes[ tess.numIndexes + 10] = ndx + 0;
- tess.indexes[ tess.numIndexes + 11] = ndx + 4;
-
- tess.xyz[ndx][0] = origin[0] + left[0] + up[0];
- tess.xyz[ndx][1] = origin[1] + left[1] + up[1];
- tess.xyz[ndx][2] = origin[2] + left[2] + up[2];
-
- tess.xyz[ndx + 1][0] = origin[0] - left[0] + up[0];
- tess.xyz[ndx + 1][1] = origin[1] - left[1] + up[1];
- tess.xyz[ndx + 1][2] = origin[2] - left[2] + up[2];
-
- tess.xyz[ndx + 2][0] = origin[0] - left[0] - up[0];
- tess.xyz[ndx + 2][1] = origin[1] - left[1] - up[1];
- tess.xyz[ndx + 2][2] = origin[2] - left[2] - up[2];
-
- tess.xyz[ndx + 3][0] = origin[0] + left[0] - up[0];
- tess.xyz[ndx + 3][1] = origin[1] + left[1] - up[1];
- tess.xyz[ndx + 3][2] = origin[2] + left[2] - up[2];
-
- tess.xyz[ndx + 4][0] = origin[0];
- tess.xyz[ndx + 4][1] = origin[1];
- tess.xyz[ndx + 4][2] = origin[2];
-
-
- // constant normal all the way around
- VectorSubtract( vec3_origin, backEnd.viewParms.or.axis[0], normal );
-
- tess.normal[ndx][0] = tess.normal[ndx + 1][0] = tess.normal[ndx + 2][0] = tess.normal[ndx + 3][0] = tess.normal[ndx + 4][0] = normal[0];
- tess.normal[ndx][1] = tess.normal[ndx + 1][1] = tess.normal[ndx + 2][1] = tess.normal[ndx + 3][1] = tess.normal[ndx + 4][1] = normal[1];
- tess.normal[ndx][2] = tess.normal[ndx + 1][2] = tess.normal[ndx + 2][2] = tess.normal[ndx + 3][2] = tess.normal[ndx + 4][2] = normal[2];
-
- // standard square texture coordinates
- tess.texCoords[ndx][0][0] = tess.texCoords[ndx][1][0] = s1;
- tess.texCoords[ndx][0][1] = tess.texCoords[ndx][1][1] = t1;
-
- tess.texCoords[ndx + 1][0][0] = tess.texCoords[ndx + 1][1][0] = s2;
- tess.texCoords[ndx + 1][0][1] = tess.texCoords[ndx + 1][1][1] = t1;
-
- tess.texCoords[ndx + 2][0][0] = tess.texCoords[ndx + 2][1][0] = s2;
- tess.texCoords[ndx + 2][0][1] = tess.texCoords[ndx + 2][1][1] = t2;
-
- tess.texCoords[ndx + 3][0][0] = tess.texCoords[ndx + 3][1][0] = s1;
- tess.texCoords[ndx + 3][0][1] = tess.texCoords[ndx + 3][1][1] = t2;
-
- tess.texCoords[ndx + 4][0][0] = tess.texCoords[ndx + 4][1][0] = ( s1 + s2 ) / 2.0;
- tess.texCoords[ndx + 4][0][1] = tess.texCoords[ndx + 4][1][1] = ( t1 + t2 ) / 2.0;
-
- // center uses full alpha
- *( unsigned int * ) &tess.vertexColors[ndx + 4] =
- *( unsigned int * )color;
-
- // fade around edges
- memcpy( lColor, color, sizeof( byte ) * 4 );
- lColor[3] = 0;
- *( unsigned int * ) &tess.vertexColors[ndx] =
- *( unsigned int * ) &tess.vertexColors[ndx + 1] =
- *( unsigned int * ) &tess.vertexColors[ndx + 2] =
- *( unsigned int * ) &tess.vertexColors[ndx + 3] =
- *( unsigned int * )lColor;
-
-
- tess.numVertexes += 5;
- tess.numIndexes += 12;
-}
-
-/*
-==============
RB_AddQuadStampExt
==============
*/
diff --git a/SP/code/renderer/tr_world.c b/SP/code/renderer/tr_world.c
index 9cb4aa0..5e87506 100644
--- a/SP/code/renderer/tr_world.c
+++ b/SP/code/renderer/tr_world.c
@@ -474,8 +474,8 @@ static void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits )
// determine which dlights are needed
newDlights[0] = 0;
newDlights[1] = 0;
-/*
-// if ( dlightBits )
+
+ if ( dlightBits )
{
int i;
@@ -483,7 +483,7 @@ static void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits )
dlight_t *dl;
float dist;
-// if ( dlightBits & ( 1 << i ) ) {
+ if ( dlightBits & ( 1 << i ) ) {
dl = &tr.refdef.dlights[i];
dist = DotProduct( dl->origin, node->plane->normal ) - node->plane->dist;
@@ -493,10 +493,10 @@ static void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits )
if ( dist < dl->radius ) {
newDlights[1] |= ( 1 << i );
}
-// }
+ }
}
}
-*/
+
// recurse down the children, front side first
R_RecursiveWorldNode( node->children[0], planeBits, newDlights[0] );
diff --git a/SP/code/splines/splines.cpp b/SP/code/splines/splines.cpp
index 3881f15..52fde71 100644
--- a/SP/code/splines/splines.cpp
+++ b/SP/code/splines/splines.cpp
@@ -66,6 +66,11 @@ qboolean loadCamera( int camNum, const char *name ) {
qboolean getCameraInfo( int camNum, int time, float *origin, float *angles, float *fov ) {
idVec3 dir, org;
+
+ dir[0] = 0;
+ dir[1] = 0;
+ dir[2] = 0;
+
if ( camNum < 0 || camNum >= MAX_CAMERAS ) {
return qfalse;
}
@@ -463,7 +468,7 @@ void idSplineList::parse( const char *( *text ) ) {
} else if ( Q_stricmp( key.c_str(), "name" ) == 0 ) {
name = token;
}
- token = Com_Parse( text );
+ Com_Parse( text );
} while ( 1 );
@@ -958,7 +963,7 @@ void idCameraEvent::parse( const char *( *text ) ) {
} else if ( Q_stricmp( key.c_str(), "time" ) == 0 ) {
time = atoi( token );
}
- token = Com_Parse( text );
+ Com_Parse( text );
} while ( 1 );
@@ -1070,7 +1075,7 @@ void idCameraFOV::parse( const char *( *text ) ) {
} else if ( Q_stricmp( key.c_str(), "time" ) == 0 ) {
time = atoi( token );
}
- token = Com_Parse( text );
+ Com_Parse( text );
} while ( 1 );
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index d658841..e3a3ecb 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -4320,7 +4320,7 @@ void WM_ActivateLimboChat( void ) {
menuDef_t *menu;
itemDef_t *itemdef;
- menu = Menu_GetFocused();
+ Menu_GetFocused();
menu = Menus_ActivateByName( "wm_limboChat" );
if ( !menu || g_editItem ) {
diff --git a/SP/code/ui/ui_players.c b/SP/code/ui/ui_players.c
index 6a88b72..5ea653a 100644
--- a/SP/code/ui/ui_players.c
+++ b/SP/code/ui/ui_players.c
@@ -1127,6 +1127,7 @@ static qboolean AnimParseAnimConfig( playerInfo_t *animModelInfo, const char *fi
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
} else {
// just set it to the equivalent animStrings[]
@@ -1152,18 +1153,21 @@ static qboolean AnimParseAnimConfig( playerInfo_t *animModelInfo, const char *fi
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
animations[i].numFrames = atoi( token );
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS: line %i" );
+ break;
}
animations[i].loopFrames = atoi( token );
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS: line %i" );
+ break;
}
fps = atof( token );
if ( fps == 0 ) {
@@ -1176,6 +1180,7 @@ static qboolean AnimParseAnimConfig( playerInfo_t *animModelInfo, const char *fi
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS" );
+ break;
}
animations[i].moveSpeed = atoi( token );
diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c
index 30ac739..591394f 100644
--- a/SP/code/ui/ui_shared.c
+++ b/SP/code/ui/ui_shared.c
@@ -4577,7 +4577,7 @@ void Menu_HandleMouseMove( menuDef_t *menu, float x, float y ) {
}
}
}
- } else if ( menu->items[i]->window.flags & WINDOW_MOUSEOVER ) {
+ } else if ( menu->items[i] && menu->items[i]->window.flags & WINDOW_MOUSEOVER ) {
Item_MouseLeave( menu->items[i] );
Item_SetMouseOver( menu->items[i], qfalse );
}
@@ -6016,6 +6016,9 @@ qboolean MenuParse_itemDef( itemDef_t *item, int handle ) {
menuDef_t *menu = (menuDef_t*)item;
if ( menu->itemCount < MAX_MENUITEMS ) {
menu->items[menu->itemCount] = UI_Alloc( sizeof( itemDef_t ) );
+ if ( !menu->items[menu->itemCount] ) {
+ return qfalse;
+ }
Item_Init( menu->items[menu->itemCount] );
if ( !Item_Parse( handle, menu->items[menu->itemCount] ) ) {
return qfalse;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list