[iortcw] 205/497: MP: Fix a bunch of stuff flagged by clang analyzer
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:51 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 54bcfe3cc096f87a16dff78456b565c3690b6e38
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Sat Sep 6 18:32:58 2014 +0000
MP: Fix a bunch of stuff flagged by clang analyzer
---
MP/code/botlib/be_aas_reach.c | 7 +--
MP/code/botlib/be_aas_route.c | 4 +-
MP/code/botlib/be_aas_sample.c | 8 ++-
MP/code/botlib/be_ai_move.c | 3 +-
MP/code/cgame/cg_consolecmds.c | 4 +-
MP/code/cgame/cg_draw.c | 47 ++++--------------
MP/code/cgame/cg_drawtools.c | 3 --
MP/code/cgame/cg_effects.c | 26 +++++-----
MP/code/cgame/cg_event.c | 2 -
MP/code/cgame/cg_localents.c | 4 --
MP/code/cgame/cg_marks.c | 2 +-
MP/code/cgame/cg_newdraw.c | 4 --
MP/code/cgame/cg_players.c | 8 ++-
MP/code/cgame/cg_scoreboard.c | 12 +----
MP/code/cgame/cg_view.c | 64 ------------------------
MP/code/cgame/cg_weapons.c | 23 ++-------
MP/code/client/cl_main.c | 19 ++++----
MP/code/client/snd_mix.c | 4 ++
MP/code/client/snd_wavelet.c | 4 +-
MP/code/game/ai_cast_events.c | 4 +-
MP/code/game/ai_cast_fight.c | 4 +-
MP/code/game/ai_cast_funcs.c | 22 +--------
MP/code/game/ai_cast_sight.c | 4 +-
MP/code/game/ai_cast_think.c | 10 ++--
MP/code/game/ai_dmq3.c | 2 +-
MP/code/game/ai_main.c | 4 ++
MP/code/game/ai_team.c | 6 +--
MP/code/game/bg_animation.c | 11 +++--
MP/code/game/bg_misc.c | 1 -
MP/code/game/bg_pmove.c | 26 ++++------
MP/code/game/g_alarm.c | 8 ++-
MP/code/game/g_cmds.c | 2 +-
MP/code/game/g_items.c | 8 ++-
MP/code/game/g_main.c | 2 -
MP/code/game/g_missile.c | 3 +-
MP/code/game/g_mover.c | 2 +-
MP/code/game/g_props.c | 6 +--
MP/code/game/g_target.c | 2 +-
MP/code/game/g_team.c | 3 +-
MP/code/game/g_tramcar.c | 4 ++
MP/code/game/g_weapon.c | 52 ++++++++++----------
MP/code/qcommon/files.c | 51 -------------------
MP/code/qcommon/qcommon.h | 2 -
MP/code/rend2/tr_bsp.c | 10 ++--
MP/code/rend2/tr_flares.c | 2 +-
MP/code/rend2/tr_font.c | 2 +-
MP/code/rend2/tr_image.c | 70 ++------------------------
MP/code/rend2/tr_init.c | 6 +--
MP/code/rend2/tr_local.h | 2 -
MP/code/rend2/tr_model.c | 25 +++++-----
MP/code/rend2/tr_model_iqm.c | 2 +-
MP/code/rend2/tr_shade_calc.c | 2 +-
MP/code/rend2/tr_shader.c | 2 +-
MP/code/rend2/tr_surface.c | 103 +--------------------------------------
MP/code/rend2/tr_world.c | 3 ++
MP/code/renderer/tr_bsp.c | 8 +--
MP/code/renderer/tr_flares.c | 2 +-
MP/code/renderer/tr_font.c | 2 +-
MP/code/renderer/tr_image.c | 76 +++++------------------------
MP/code/renderer/tr_init.c | 6 +--
MP/code/renderer/tr_local.h | 2 -
MP/code/renderer/tr_model.c | 45 ++++++++---------
MP/code/renderer/tr_model_iqm.c | 2 +-
MP/code/renderer/tr_shade_calc.c | 6 +--
MP/code/renderer/tr_shader.c | 2 +-
MP/code/renderer/tr_surface.c | 95 ------------------------------------
MP/code/renderer/tr_world.c | 10 ++--
MP/code/ui/ui_main.c | 10 ++--
MP/code/ui/ui_players.c | 5 ++
MP/code/ui/ui_shared.c | 9 +++-
SP/code/client/cl_cgame.c | 6 +--
71 files changed, 259 insertions(+), 743 deletions(-)
diff --git a/MP/code/botlib/be_aas_reach.c b/MP/code/botlib/be_aas_reach.c
index c6ff636..6dc4e95 100644
--- a/MP/code/botlib/be_aas_reach.c
+++ b/MP/code/botlib/be_aas_reach.c
@@ -3450,13 +3450,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 ) ) {
@@ -3468,7 +3469,7 @@ void AAS_Reachability_JumpPad( void ) {
AAS_UnlinkFromAreas( areas );
continue;
} //end if
- //
+ //
botimport.Print( PRT_MESSAGE, "found a trigger_push with velocity %f %f %f\n", velocity[0], velocity[1], velocity[2] );
//if there is a horizontal velocity check for a reachability without air control
if ( velocity[0] || velocity[1] ) {
diff --git a/MP/code/botlib/be_aas_route.c b/MP/code/botlib/be_aas_route.c
index c94bc6a..6c64a3c 100644
--- a/MP/code/botlib/be_aas_route.c
+++ b/MP/code/botlib/be_aas_route.c
@@ -1019,8 +1019,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 {
@@ -1051,6 +1049,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/MP/code/botlib/be_aas_sample.c b/MP/code/botlib/be_aas_sample.c
index 5d3301b..915e100 100644
--- a/MP/code/botlib/be_aas_sample.c
+++ b/MP/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/MP/code/botlib/be_ai_move.c b/MP/code/botlib/be_ai_move.c
index aeb1622..ed506d6 100644
--- a/MP/code/botlib/be_ai_move.c
+++ b/MP/code/botlib/be_ai_move.c
@@ -746,7 +746,7 @@ int BotAddToTarget( vec3_t start, vec3_t end, float maxdist, float *dist, vec3_t
int BotMovementViewTarget( int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target ) {
aas_reachability_t reach;
- int reachnum, lastareanum;
+ int reachnum = 0, lastareanum;
bot_movestate_t *ms;
vec3_t end;
float dist;
@@ -755,7 +755,6 @@ int BotMovementViewTarget( int movestate, bot_goal_t *goal, int travelflags, flo
if ( !ms ) {
return qfalse;
}
- reachnum = 0;
//if the bot has no goal or no last reachability
if ( !ms->lastreachnum || !goal ) {
return qfalse;
diff --git a/MP/code/cgame/cg_consolecmds.c b/MP/code/cgame/cg_consolecmds.c
index eff46ff..3ecdd4b 100644
--- a/MP/code/cgame/cg_consolecmds.c
+++ b/MP/code/cgame/cg_consolecmds.c
@@ -369,11 +369,11 @@ static void CG_OpenLimbo_f( void ) {
}
// Arnout - don't set currentteam when following as it won't be the actual currentteam
- if ( currentTeam != mp_team.integer && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) {
+ if ( currentTeam != mp_team.integer && cg.snap && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) {
trap_Cvar_Set( "mp_team", va( "%d", currentTeam ) );
}
- if ( currentTeam != mp_currentTeam.integer && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) {
+ if ( currentTeam != mp_currentTeam.integer && cg.snap && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) {
trap_Cvar_Set( "mp_currentTeam", va( "%d", currentTeam ) );
}
diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index c91db76..9107bd6 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -873,7 +873,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 ) {
@@ -1015,8 +1015,7 @@ CG_DrawNotify
#define NOTIFYLOC_X 0
static void CG_DrawNotify( void ) {
- int w;
- int i, len;
+ int i;
vec4_t hcolor;
int chatHeight;
float alphapercent;
@@ -1037,17 +1036,6 @@ static void CG_DrawNotify( void ) {
cgs.notifyLastPos++;
}
- w = 0;
-
- for ( i = cgs.notifyLastPos; i < cgs.notifyPos; i++ ) {
- len = CG_DrawStrlen( cgs.notifyMsgs[i % chatHeight] );
- if ( len > w ) {
- w = len;
- }
- }
- w *= TINYCHAR_WIDTH;
- w += TINYCHAR_WIDTH * 2;
-
if ( maxCharsBeforeOverlay <= 0 ) {
maxCharsBeforeOverlay = 80;
}
@@ -1926,12 +1914,6 @@ static void CG_DrawDynamiteStatus( void ) {
trap_R_SetColor( color );
- timeleft *= 5;
- timeleft -= ( timeleft % 5000 );
- timeleft += 5000;
- timeleft /= 1000;
-
-// name = va("Timer: %d", timeleft);
name = va( "Timer: 30" );
w = CG_DrawStrlen( name ) * BIGCHAR_WIDTH;
@@ -2415,7 +2397,6 @@ static void CG_DrawSpectatorMessage( void ) {
str2 = BindingFromName( "+attack" );
str = va( CG_TranslateString( "- Press %s to follow next player" ), str2 );
CG_DrawStringExt( x, y, str, color, qtrue, 0, TINYCHAR_WIDTH, TINYCHAR_HEIGHT, 0 );
- y += TINYCHAR_HEIGHT;
}
/*
@@ -2837,7 +2818,6 @@ CG_DrawFlashLightning
=================
*/
static void CG_DrawFlashLightning( void ) {
- float alpha;
centity_t *cent;
qhandle_t shader;
@@ -2855,20 +2835,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 );
}
@@ -3003,7 +2976,6 @@ static void CG_DrawObjectiveInfo( void ) {
if ( x1 + w > x2 )
x2 = x1 + w;
*/
- x = 320 - w / 2;
// jpw
y += cg.oidPrintCharWidth * 1.5;
@@ -3143,7 +3115,7 @@ void CG_DrawObjectiveIcons( void ) {
for ( i = 0; i < num; i++ ) {
s = CG_ConfigString( CS_MULTI_OBJECTIVE1 + i );
- buf = Info_ValueForKey( s, teamstr );
+ Info_ValueForKey( s, teamstr );
xx = x;
@@ -3232,7 +3204,6 @@ void CG_DrawObjectiveIcons( void ) {
if ( cgs.clientinfo[cg.snap->ps.clientNum].powerups & ( 1 << PW_REDFLAG ) ||
cgs.clientinfo[cg.snap->ps.clientNum].powerups & ( 1 << PW_BLUEFLAG ) ) {
CG_DrawPic( -7, y, 48, 48, trap_R_RegisterShader( "models/multiplayer/treasure/treasure" ) );
- y += 50;
}
}
// -NERVE - SMF
diff --git a/MP/code/cgame/cg_drawtools.c b/MP/code/cgame/cg_drawtools.c
index 376f4ef..b1c2d98 100644
--- a/MP/code/cgame/cg_drawtools.c
+++ b/MP/code/cgame/cg_drawtools.c
@@ -542,9 +542,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/MP/code/cgame/cg_effects.c b/MP/code/cgame/cg_effects.c
index afa0ebe..098e0ac 100644
--- a/MP/code/cgame/cg_effects.c
+++ b/MP/code/cgame/cg_effects.c
@@ -280,10 +280,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;
@@ -421,6 +424,10 @@ void CG_LaunchGib( centity_t *cent, vec3_t origin, vec3_t angles, vec3_t velocit
return;
}
+ if ( !cent ) {
+ return;
+ }
+
le = CG_AllocLocalEntity();
re = &le->refEntity;
@@ -1209,6 +1216,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 );
@@ -1407,7 +1415,7 @@ void CG_Spotlight( centity_t *cent, float *color, vec3_t realstart, vec3_t light
vec3_t dlightLoc;
// VectorMA(tr.endpos, -60, lightDir, dlightLoc); // back away from the hit
// trap_R_AddLightToScene(dlightLoc, 200, colorNorm[0], colorNorm[1], colorNorm[2], 0); // ,REF_JUNIOR_DLIGHT);
- VectorMA( tr.endpos, 0, lightDir, dlightLoc ); // back away from the hit
+ VectorCopy( tr.endpos, dlightLoc ); // back away from the hit
// 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);
}
@@ -1473,12 +1481,6 @@ void CG_RumbleEfx( float pitch, float yaw ) {
float yawRandom;
vec3_t recoil;
- //
- pitchRecoilAdd = 0;
- pitchAdd = 0;
- yawRandom = 0;
- //
-
if ( pitch < 1 ) {
pitch = 1;
}
@@ -1503,5 +1505,3 @@ void CG_RumbleEfx( float pitch, float yaw ) {
cg.recoilPitch -= pitchRecoilAdd;
}
-
-
diff --git a/MP/code/cgame/cg_event.c b/MP/code/cgame/cg_event.c
index 7560683..eb3b459 100644
--- a/MP/code/cgame/cg_event.c
+++ b/MP/code/cgame/cg_event.c
@@ -2235,7 +2235,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
// try with .wav
Q_strncpyz( tempStr, s, sizeof( tempStr ) );
Q_strcat( tempStr, sizeof( tempStr ), ".wav" );
- s = tempStr;
}
// done.
if ( cgs.gameSounds[ es->eventParm ] ) {
@@ -2257,7 +2256,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
// try with .wav
Q_strncpyz( tempStr, s, sizeof( tempStr ) );
Q_strcat( tempStr, sizeof( tempStr ), ".wav" );
- s = tempStr;
}
// done.
if ( cgs.gameSounds[ es->eventParm ] ) {
diff --git a/MP/code/cgame/cg_localents.c b/MP/code/cgame/cg_localents.c
index 2bf1515..4026bc4 100644
--- a/MP/code/cgame/cg_localents.c
+++ b/MP/code/cgame/cg_localents.c
@@ -872,9 +872,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 );
@@ -914,7 +911,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/MP/code/cgame/cg_marks.c b/MP/code/cgame/cg_marks.c
index 70ada39..1324ab2 100644
--- a/MP/code/cgame/cg_marks.c
+++ b/MP/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/MP/code/cgame/cg_newdraw.c b/MP/code/cgame/cg_newdraw.c
index 5e40249..542d0ed 100644
--- a/MP/code/cgame/cg_newdraw.c
+++ b/MP/code/cgame/cg_newdraw.c
@@ -764,8 +764,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
@@ -1018,8 +1016,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;
}
}
diff --git a/MP/code/cgame/cg_players.c b/MP/code/cgame/cg_players.c
index b920943..c98a275 100644
--- a/MP/code/cgame/cg_players.c
+++ b/MP/code/cgame/cg_players.c
@@ -187,7 +187,7 @@ CG_CalcMoveSpeeds
*/
void CG_CalcMoveSpeeds( clientInfo_t *ci ) {
char *tags[2] = {"tag_footleft", "tag_footright"};
- vec3_t oldPos[2];
+ vec3_t oldPos[2] = {{ 0 }};
refEntity_t refent;
animation_t *anim;
int i, j, k;
@@ -1177,6 +1177,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
}
@@ -2816,7 +2820,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/MP/code/cgame/cg_scoreboard.c b/MP/code/cgame/cg_scoreboard.c
index 164ee06..2e4951b 100644
--- a/MP/code/cgame/cg_scoreboard.c
+++ b/MP/code/cgame/cg_scoreboard.c
@@ -239,9 +239,7 @@ int WM_DrawObjectives( int x, int y, int width, float fade ) {
buf = Info_ValueForKey( s, "winner" );
if ( atoi( buf ) == -1 ) {
- str = "ITS A TIE!";
} else if ( atoi( buf ) ) {
- str = "ALLIES";
shader = "ui_mp/assets/portraits/allies_win";
flagshader = "ui_mp/assets/portraits/allies_win_flag.tga";
nameshader = "ui_mp/assets/portraits/text_allies.tga";
@@ -251,7 +249,6 @@ int WM_DrawObjectives( int x, int y, int width, float fade ) {
trap_S_StartLocalSound( trap_S_RegisterSound( "sound/multiplayer/music/l_complete_2.wav" ), CHAN_LOCAL_SOUND );
}
} else {
- str = "AXIS";
shader = "ui_mp/assets/portraits/axis_win";
flagshader = "ui_mp/assets/portraits/axis_win_flag.tga";
nameshader = "ui_mp/assets/portraits/text_axis.tga";
@@ -399,7 +396,6 @@ static void WM_DrawClientScore( int x, int y, score_t *score, float *color, floa
width = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH;
CG_FillRect( tempx, y + 1, width - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor );
- tempx += width;
} else {
CG_FillRect( tempx, y + 1, INFO_CLASS_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor );
tempx += INFO_CLASS_WIDTH;
@@ -408,7 +404,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;
}
}
@@ -478,7 +473,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;
}
const char* WM_TimeToString( float msec ) {
@@ -604,7 +598,6 @@ static int WM_TeamScoreboard( int x, int y, team_t team, float fade, int maxrows
tempx += INFO_SCORE_WIDTH;
CG_DrawSmallString( tempx, y, CG_TranslateString( "Ping" ), fade );
- tempx += INFO_LATENCY_WIDTH;
y += SMALLCHAR_HEIGHT;
@@ -677,7 +670,6 @@ qboolean CG_DrawScoreboard( void ) {
if ( cg.showScores || ( cg.predictedPlayerState.pm_type == PM_DEAD && cgs.gametype < GT_WOLF ) ||
cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
fade = 1.0;
- fadeColor = colorWhite;
} else {
fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME );
@@ -799,14 +791,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/MP/code/cgame/cg_view.c b/MP/code/cgame/cg_view.c
index d0ce6f0..81e7ea0 100644
--- a/MP/code/cgame/cg_view.c
+++ b/MP/code/cgame/cg_view.c
@@ -476,16 +476,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;
}
@@ -1346,12 +1341,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 );
@@ -1512,60 +1501,7 @@ int CG_GetMPSetupValue( void ) {
CG_DrawNotebook
=========================
*/
-/*
- VectorCopy(cg.refdefViewAngles, kickangle);
- AnglesToAxis (kickangle, wolfkick.axis);
-
-
- frame = cg.snap->ps.persistant[PERS_WOLFKICK];
-
- wolfkick.frame = frame;
- wolfkick.oldframe = frame - 1;
- wolfkick.backlerp = 1 - cg.frameInterpolation;
-
-*/
void CG_DrawNotebook( void ) {
-/*
- refEntity_t notebook;
- vec3_t notebookangle;
- int frame;
- static int oldtime = 0;
-
- static int tempnotebookcnt = 0;
-
- memset (¬ebook, 0, sizeof (notebook));
-
- // note to self we want this to lerp and advance frame
- notebook.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_HILIGHT;
- notebook.hModel = notebookModel;
-
- VectorCopy( cg.refdef.vieworg, notebook.origin );
-
- //----(SA) allow offsets for testing boot model
- if(cg_gun_x.value) VectorMA( notebook.origin, cg_gun_x.value, cg.refdef.viewaxis[0], notebook.origin );
- if(cg_gun_y.value) VectorMA( notebook.origin, cg_gun_y.value, cg.refdef.viewaxis[1], notebook.origin );
- if(cg_gun_z.value) VectorMA( notebook.origin, cg_gun_z.value, cg.refdef.viewaxis[2], notebook.origin );
- //----(SA) end
-
- VectorCopy(cg.refdefViewAngles, notebookangle);
- AnglesToAxis (notebookangle, notebook.axis);
-
- frame = tempnotebookcnt;
-
- tempnotebookcnt++;
-
- if (tempnotebookcnt > 25)
- tempnotebookcnt = 0;
-
- // CG_Printf("frame: %d\n", frame);
-
- CG_Printf("journal: frame: %d\n", frame);
-
- notebook.frame = frame;
- notebook.oldframe = frame - 1;
- notebook.backlerp = 1 - cg.frameInterpolation;
- trap_R_AddRefEntityToScene( ¬ebook );
-*/
}
//=========================================================================
diff --git a/MP/code/cgame/cg_weapons.c b/MP/code/cgame/cg_weapons.c
index e28b076..5c4ca66 100644
--- a/MP/code/cgame/cg_weapons.c
+++ b/MP/code/cgame/cg_weapons.c
@@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms
#include "cg_local.h"
-int wolfkickModel;
+//int wolfkickModel;
int hWeaponSnd;
int hWeaponEchoSnd; // JPW NERVE
int hflakWeaponSnd;
@@ -474,8 +474,6 @@ void CG_PyroSmokeTrail( centity_t *ent, const weaponInfo_t *wi ) {
dir[2] = 0;
VectorAdd( lastPos,dir,origin ); // store in origin
- rnd = random();
-
CG_GetWindVector( dir );
VectorScale( dir,65,dir ); // was 75, before that 55
@@ -1209,8 +1207,6 @@ void CG_RegisterWeapon( int weaponNum ) {
}
}
- bail = qfalse;
-
// used for spinning belt on venom
if ( i == W_FP_MODEL ) {
if ( !item->world_model[2] ) {
@@ -2717,6 +2713,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
}
void CG_AddPlayerFoot( refEntity_t *parent, playerState_t *ps, centity_t *cent ) {
+/*
refEntity_t wolfkick;
vec3_t kickangle;
int frame;
@@ -2763,7 +2760,7 @@ void CG_AddPlayerFoot( refEntity_t *parent, playerState_t *ps, centity_t *cent )
wolfkick.oldframe = frame - 1;
wolfkick.backlerp = 1 - cg.frameInterpolation;
trap_R_AddRefEntityToScene( &wolfkick );
-
+*/
}
/*
@@ -2867,7 +2864,7 @@ void CG_AddViewWeapon( playerState_t *ps ) {
// Rafael
// add the foot
- CG_AddPlayerFoot( &hand, ps, &cg.predictedPlayerEntity );
+ //CG_AddPlayerFoot( &hand, ps, &cg.predictedPlayerEntity );
cg.predictedPlayerEntity.lastWeaponClientFrame = cg.clientFrame;
}
@@ -5347,7 +5344,6 @@ void CG_Shard(centity_t *cent, vec3_t origin, vec3_t dir)
// jpw
break;
case WP_PANZERFAUST:
- sfx = cgs.media.sfx_rockexp;
case WP_ROCKET_LAUNCHER:
case VERYBIGEXPLOSION:
// mod = cgs.media.dishFlashModel;
@@ -5380,7 +5376,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();
@@ -5565,12 +5560,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;
@@ -5578,9 +5568,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;
@@ -5990,7 +5977,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
trace_t trace,trace2;
int sourceContentType, destContentType;
vec3_t dir;
- vec3_t start, trend; // JPW
+ vec3_t start = { 0 }, trend; // JPW
static int lastBloodSpat;
centity_t *cent;
diff --git a/MP/code/client/cl_main.c b/MP/code/client/cl_main.c
index 2cb300f..e6410bf 100644
--- a/MP/code/client/cl_main.c
+++ b/MP/code/client/cl_main.c
@@ -1829,8 +1829,6 @@ void CL_Connect_f( void ) {
// clear any previous "server full" type messages
clc.serverMessage[0] = 0;
- server = Cmd_Argv( 1 );
-
if ( com_sv_running->integer && !strcmp( server, "localhost" ) ) {
// if running a local server, kill it
SV_Shutdown( "Server quit\n" );
@@ -5776,13 +5774,16 @@ void CL_LoadTransTable( const char *fileName ) {
// set offset if we have one
if ( !Q_stricmp( "offset", token ) ) {
- token = COM_Parse( &text_p );
- t->x_offset = atof( token );
-
- token = COM_Parse( &text_p );
- t->y_offset = atof( token );
-
- token = COM_Parse( &text_p );
+ if ( t )
+ {
+ token = COM_Parse( &text_p );
+ t->x_offset = atof( token );
+
+ token = COM_Parse( &text_p );
+ t->y_offset = atof( token );
+
+ token = COM_Parse( &text_p );
+ }
}
if ( Q_stricmp( "}", token ) ) {
diff --git a/MP/code/client/snd_mix.c b/MP/code/client/snd_mix.c
index f4fa01a..1efe1e3 100644
--- a/MP/code/client/snd_mix.c
+++ b/MP/code/client/snd_mix.c
@@ -422,6 +422,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/MP/code/client/snd_wavelet.c b/MP/code/client/snd_wavelet.c
index a325ffd..71da208 100644
--- a/MP/code/client/snd_wavelet.c
+++ b/MP/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/MP/code/game/ai_cast_events.c b/MP/code/game/ai_cast_events.c
index 5f0be9a..f317a66 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->client ) {
+ if ( attacker && attacker != self ) {
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->client ) {
+ if ( attacker && attacker != self ) {
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/MP/code/game/ai_cast_fight.c b/MP/code/game/ai_cast_fight.c
index d82ac63..5595093 100644
--- a/MP/code/game/ai_cast_fight.c
+++ b/MP/code/game/ai_cast_fight.c
@@ -725,7 +725,7 @@ qboolean AICast_CheckAttack_real( cast_state_t *cs, int enemy, qboolean allowHit
}
}
//if the projectile does a radial damage
- if ( cs->bs->weaponnum == WP_ROCKET_LAUNCHER || cs->bs->weaponnum == WP_PANZERFAUST ) {
+ if ( cs->bs && ( cs->bs->weaponnum == WP_ROCKET_LAUNCHER || cs->bs->weaponnum == WP_PANZERFAUST ) ) {
if ( Distance( trace.endpos, g_entities[enemy].s.pos.trBase ) > 120 ) {
continue;
}
@@ -1279,7 +1279,7 @@ bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) {
//direction towards the enemy
VectorSubtract( cs->vislist[cs->bs->enemy].visible_pos, bs->origin, forward );
//the distance towards the enemy
- dist = VectorNormalize( forward );
+ VectorNormalize( forward );
//
// do we have somewhere we are trying to get to?
if ( cs->combatGoalTime > level.time ) {
diff --git a/MP/code/game/ai_cast_funcs.c b/MP/code/game/ai_cast_funcs.c
index 4060c6c..ba4ccb3 100644
--- a/MP/code/game/ai_cast_funcs.c
+++ b/MP/code/game/ai_cast_funcs.c
@@ -2055,8 +2055,6 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) {
// try to go to ambush mode
cs->bs->enemy = -1;
return AIFunc_DefaultStart( cs );
- } else {
- moved = qtrue;
}
}
}
@@ -2231,7 +2229,6 @@ char *AIFunc_BattleAmbush( cast_state_t *cs ) {
&& ( ( enemyDist - 1 ) > ( Distance( move.endpos, g_entities[cs->bs->enemy].s.pos.trBase ) ) ) ) ) {
// abort the manouver
VectorClear( cs->takeCoverPos );
- dist = 0;
}
//
// we should slow down on approaching the destination point
@@ -2695,8 +2692,6 @@ char *AIFunc_BattleChase( cast_state_t *cs ) {
VectorCopy( cs->bs->origin, cs->combatGoalOrigin );
VectorCopy( cs->bs->origin, cs->takeCoverPos );
return AIFunc_BattleAmbushStart( cs );
- } else {
- moved = qtrue;
}
}
//
@@ -3187,7 +3182,6 @@ char *AIFunc_BattleTakeCover( cast_state_t *cs ) {
&& ( ( enemyDist - 1 ) > ( Distance( move.endpos, g_entities[cs->bs->enemy].s.pos.trBase ) ) ) ) ) {
// abort the manouver
VectorClear( cs->takeCoverPos );
- dist = 0;
}
//
// do we went to play a rolling animation into a cover position?
@@ -3206,7 +3200,6 @@ char *AIFunc_BattleTakeCover( cast_state_t *cs ) {
if ( !( cs->aiFlags & AIFL_MISCFLAG1 ) && !AICast_VisibleFromPos( cs->vislist[cs->bs->enemy].real_visible_pos, cs->bs->enemy, move.endpos, cs->entityNum, qfalse )
&& !AICast_VisibleFromPos( cs->vislist[cs->bs->enemy].real_visible_pos, cs->bs->enemy, cs->bs->origin, cs->entityNum, qfalse ) ) {
VectorCopy( move.endpos, cs->takeCoverPos );
- dist = 0;
cs->aiFlags |= AIFL_MISCFLAG1; // dont do this again
}
//
@@ -3567,8 +3560,6 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) {
cs->bs->enemy = -1;
//G_Printf("aborting, movement failure\n");
return AIFunc_DefaultStart( cs );
- } else {
- moved = qtrue;
}
}
}
@@ -3967,7 +3958,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;
@@ -4179,7 +4170,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->bs->weaponnum ) ) {
numEnemies = AICast_ScanForEnemies( cs, enemies );
if ( numEnemies == -1 ) { // query mode
@@ -4324,7 +4314,6 @@ AIFunc_Battle()
*/
char *AIFunc_Battle( cast_state_t *cs ) {
bot_moveresult_t moveresult;
- int tfl;
bot_state_t *bs;
gentity_t *ent, *enemy;
@@ -4465,15 +4454,6 @@ char *AIFunc_Battle( cast_state_t *cs ) {
//
// setup for the fight
//
- 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;
- }
- //
/*
moveresult = AICast_CombatMove(cs, tfl);
//if the movement failed
diff --git a/MP/code/game/ai_cast_sight.c b/MP/code/game/ai_cast_sight.c
index 95f683b..bc0d68d 100644
--- a/MP/code/game/ai_cast_sight.c
+++ b/MP/code/game/ai_cast_sight.c
@@ -549,15 +549,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;
// TTimo unused
// static int lastNumUpdated;
cast_visibility_t *vis;
- src = 0;
- dest = 0;
if ( numchecks < 5 ) {
numchecks = 5;
}
diff --git a/MP/code/game/ai_cast_think.c b/MP/code/game/ai_cast_think.c
index 7abbb5f..e583f00 100644
--- a/MP/code/game/ai_cast_think.c
+++ b/MP/code/game/ai_cast_think.c
@@ -772,13 +772,13 @@ void AICast_StartFrame( int time ) {
//G_Printf( "AI startframe: %i\n", time );
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;
+ //}
//AICast_SightUpdate( (int)((float)SIGHT_PER_SEC * ((float)elapsed / 1000)) );
//
count = 0;
@@ -1079,7 +1079,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/MP/code/game/ai_dmq3.c b/MP/code/game/ai_dmq3.c
index 7732b9f..82ce8cb 100644
--- a/MP/code/game/ai_dmq3.c
+++ b/MP/code/game/ai_dmq3.c
@@ -1049,7 +1049,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/MP/code/game/ai_main.c b/MP/code/game/ai_main.c
index 175207d..fc2e80b 100644
--- a/MP/code/game/ai_main.c
+++ b/MP/code/game/ai_main.c
@@ -633,6 +633,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/MP/code/game/ai_team.c b/MP/code/game/ai_team.c
index d735b92..e691ced 100644
--- a/MP/code/game/ai_team.c
+++ b/MP/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/MP/code/game/bg_animation.c b/MP/code/game/bg_animation.c
index a841592..9368604 100644
--- a/MP/code/game/bg_animation.c
+++ b/MP/code/game/bg_animation.c
@@ -623,6 +623,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[]
@@ -648,18 +649,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 ) {
@@ -672,6 +676,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 );
@@ -742,9 +747,6 @@ qboolean BG_AnimParseAnimConfig( animModelInfo_t *animModelInfo, const char *fil
break;
}
headAnims[i].numFrames = atoi( token );
-
- // skip the movespeed
- token = COM_ParseExt( &text_p, qfalse );
}
animModelInfo->numHeadAnims = i;
@@ -910,6 +912,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] == ',' ) {
@@ -998,6 +1001,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
@@ -1027,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 sound" );
+ break;
}
// NOTE: only sound script are supported at this stage
if ( strstr( token, ".wav" ) ) {
diff --git a/MP/code/game/bg_misc.c b/MP/code/game/bg_misc.c
index 061954a..4fe390e 100644
--- a/MP/code/game/bg_misc.c
+++ b/MP/code/game/bg_misc.c
@@ -3645,7 +3645,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/MP/code/game/bg_pmove.c b/MP/code/game/bg_pmove.c
index af25ade..407e5bc 100644
--- a/MP/code/game/bg_pmove.c
+++ b/MP/code/game/bg_pmove.c
@@ -1556,7 +1556,7 @@ static void PM_Footsteps( void ) {
// DHM - Nerve :: before going to limbo, play a wounded/fallen animation
if ( !pm->ps->pm_time && !( pm->ps->pm_flags & PMF_LIMBO ) ) {
- animResult = BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_FALLEN, qtrue );
+ BG_AnimScriptAnimation( pm->ps, pm->ps->aiState, ANIM_MT_FALLEN, qtrue );
}
return;
@@ -1573,7 +1573,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;
}
@@ -1582,9 +1582,9 @@ static void PM_Footsteps( void ) {
if ( pm->waterlevel > 2 ) {
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;
@@ -1594,10 +1594,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 );
}
}
@@ -1617,7 +1617,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;
@@ -1701,7 +1701,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
@@ -3117,14 +3117,8 @@ static void PM_Weapon( void ) {
break;
// -NERVE - SMF
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/MP/code/game/g_alarm.c b/MP/code/game/g_alarm.c
index 7194bf1..2bda893 100644
--- a/MP/code/game/g_alarm.c
+++ b/MP/code/game/g_alarm.c
@@ -70,7 +70,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/MP/code/game/g_cmds.c b/MP/code/game/g_cmds.c
index e1cecbd..fbeb832 100644
--- a/MP/code/game/g_cmds.c
+++ b/MP/code/game/g_cmds.c
@@ -2227,7 +2227,7 @@ void ClientDamage( gentity_t *clent, int entnum, int enemynum, int id ) {
if ( enemy->s.weapon != WP_TESLA ) {
break;
}
- if ( !( enemy->client->buttons & BUTTON_ATTACK ) ) {
+ if ( enemy->client && !( enemy->client->buttons & BUTTON_ATTACK ) ) {
break;
}
//if ( AICast_GetCastState( enemy->s.number )->lastWeaponFiredWeaponNum != WP_TESLA )
diff --git a/MP/code/game/g_items.c b/MP/code/game/g_items.c
index 39b4568..63bf82e 100644
--- a/MP/code/game/g_items.c
+++ b/MP/code/game/g_items.c
@@ -637,7 +637,7 @@ RespawnItem
===============
*/
void RespawnItem( gentity_t *ent ) {
- if (!ent) {
+ if (! ent ) {
return;
}
@@ -657,10 +657,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/MP/code/game/g_main.c b/MP/code/game/g_main.c
index e8537ff..d2b4293 100644
--- a/MP/code/game/g_main.c
+++ b/MP/code/game/g_main.c
@@ -697,8 +697,6 @@ void G_CheckForCursorHints( gentity_t *ent ) {
} else {
hintDist = 0;
hintType = ps->serverCursorHint = HINT_FORCENONE;
- hintVal = ps->serverCursorHintVal = 0;
- return;
}
// jpw
}
diff --git a/MP/code/game/g_missile.c b/MP/code/game/g_missile.c
index b4fdad9..ca0a275 100644
--- a/MP/code/game/g_missile.c
+++ b/MP/code/game/g_missile.c
@@ -1242,7 +1242,8 @@ gentity_t *fire_grenade( gentity_t *self, vec3_t start, vec3_t dir, int grenadeW
bolt->accuracy = 0; // JPW NERVE sets to score below if dynamite is in trigger_objective_info & it's an objective
trap_SendServerCommand( self - g_entities, "cp \"Dynamite is set, but NOT armed!\"" );
// differentiate non-armed dynamite with non-pulsing dlight
- bolt->s.teamNum = self->client->sess.sessionTeam + 4;
+ if ( self->client )
+ bolt->s.teamNum = self->client->sess.sessionTeam + 4;
bolt->classname = "dynamite";
bolt->damage = 0;
// bolt->splashDamage = 300;
diff --git a/MP/code/game/g_mover.c b/MP/code/game/g_mover.c
index cfb94ba..86ee003 100644
--- a/MP/code/game/g_mover.c
+++ b/MP/code/game/g_mover.c
@@ -1114,7 +1114,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/MP/code/game/g_props.c b/MP/code/game/g_props.c
index 4ee2bf5..708ad72 100644
--- a/MP/code/game/g_props.c
+++ b/MP/code/game/g_props.c
@@ -885,11 +885,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;
@@ -1747,7 +1745,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/MP/code/game/g_target.c b/MP/code/game/g_target.c
index 66426ce..0bc9442 100644
--- a/MP/code/game/g_target.c
+++ b/MP/code/game/g_target.c
@@ -487,7 +487,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/MP/code/game/g_team.c b/MP/code/game/g_team.c
index a0c04ce..4e098f1 100644
--- a/MP/code/game/g_team.c
+++ b/MP/code/game/g_team.c
@@ -801,7 +801,7 @@ gentity_t *SelectRandomTeamSpawnPoint( int teamstate, team_t team, int spawnObje
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
@@ -886,7 +886,6 @@ gentity_t *SelectRandomTeamSpawnPoint( int teamstate, team_t team, int spawnObje
if ( spawnObjective ) {
i = spawnObjective - 1;
} else {
- j = 0;
for ( j = 0; j < count; j++ ) {
if ( spots[j]->spawnflags & 1 ) { // only use spawnpoint if it's a permanent one
// NERVE - SMF - make defenders spawn all the way back by default
diff --git a/MP/code/game/g_tramcar.c b/MP/code/game/g_tramcar.c
index 5a6fecd..2c378c0 100644
--- a/MP/code/game/g_tramcar.c
+++ b/MP/code/game/g_tramcar.c
@@ -550,6 +550,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/MP/code/game/g_weapon.c b/MP/code/game/g_weapon.c
index 2ee6e17..6ff387f 100644
--- a/MP/code/game/g_weapon.c
+++ b/MP/code/game/g_weapon.c
@@ -549,37 +549,37 @@ void Weapon_Engineer( gentity_t *ent ) {
} else if ( ( ent->client->sess.sessionTeam == TEAM_RED ) && ( hit->spawnflags & ALLIED_OBJECTIVE ) ) { // redundant but added for code clarity
te->s.eventParm = G_SoundIndex( "sound/multiplayer/axis/g-dynamite_planted.wav" );
}
- }
- if ( hit->spawnflags & AXIS_OBJECTIVE ) {
- te->s.teamNum = TEAM_RED;
- if ( ent->client->sess.sessionTeam == TEAM_BLUE ) { // transfer score info if this is a bomb scoring objective
- traceEnt->accuracy = hit->accuracy;
+ if ( hit->spawnflags & AXIS_OBJECTIVE ) {
+ te->s.teamNum = TEAM_RED;
+ if ( ent->client->sess.sessionTeam == TEAM_BLUE ) { // transfer score info if this is a bomb scoring objective
+ traceEnt->accuracy = hit->accuracy;
+ }
+ } else if ( hit->spawnflags & ALLIED_OBJECTIVE ) {
+ te->s.teamNum = TEAM_BLUE;
+ if ( ent->client->sess.sessionTeam == TEAM_RED ) { // ditto other team
+ traceEnt->accuracy = hit->accuracy;
+ }
}
- } else if ( hit->spawnflags & ALLIED_OBJECTIVE ) {
- te->s.teamNum = TEAM_BLUE;
- if ( ent->client->sess.sessionTeam == TEAM_RED ) { // ditto other team
- traceEnt->accuracy = hit->accuracy;
+ te->r.svFlags |= SVF_BROADCAST;
+
+ if ( ( ( hit->spawnflags & AXIS_OBJECTIVE ) && ( ent->client->sess.sessionTeam == TEAM_BLUE ) ) ||
+ ( ( hit->spawnflags & ALLIED_OBJECTIVE ) && ( ent->client->sess.sessionTeam == TEAM_RED ) ) ) {
+ if ( hit->track ) {
+ trap_SendServerCommand( -1, va( "cp \"%s\" 1", va( "Dynamite planted near %s!", hit->track ) ) );
+ } else {
+ trap_SendServerCommand( -1, va( "cp \"%s\" 1", va( "Dynamite planted near objective #%d!", hit->count ) ) );
+ }
}
- }
- te->r.svFlags |= SVF_BROADCAST;
-
- if ( ( ( hit->spawnflags & AXIS_OBJECTIVE ) && ( ent->client->sess.sessionTeam == TEAM_BLUE ) ) ||
- ( ( hit->spawnflags & ALLIED_OBJECTIVE ) && ( ent->client->sess.sessionTeam == TEAM_RED ) ) ) {
- if ( hit->track ) {
- trap_SendServerCommand( -1, va( "cp \"%s\" 1", va( "Dynamite planted near %s!", hit->track ) ) );
- } else {
- trap_SendServerCommand( -1, va( "cp \"%s\" 1", va( "Dynamite planted near objective #%d!", hit->count ) ) );
+ i = num;
+
+ if ( ( !( hit->spawnflags & OBJECTIVE_DESTROYED ) ) &&
+ te->s.teamNum && ( te->s.teamNum != ent->client->sess.sessionTeam ) ) {
+ AddScore( traceEnt->parent, WOLF_DYNAMITE_PLANT ); // give drop score to guy who dropped it
+ traceEnt->parent = ent; // give explode score to guy who armed it
+// jpw pulled hit->spawnflags |= OBJECTIVE_DESTROYED; // this is pretty kludgy but we can't test it in explode fn
}
}
- i = num;
-
- if ( ( !( hit->spawnflags & OBJECTIVE_DESTROYED ) ) &&
- te->s.teamNum && ( te->s.teamNum != ent->client->sess.sessionTeam ) ) {
- AddScore( traceEnt->parent, WOLF_DYNAMITE_PLANT ); // give drop score to guy who dropped it
- traceEnt->parent = ent; // give explode score to guy who armed it
-// jpw pulled hit->spawnflags |= OBJECTIVE_DESTROYED; // this is pretty kludgy but we can't test it in explode fn
- }
// jpw
}
}
diff --git a/MP/code/qcommon/files.c b/MP/code/qcommon/files.c
index 1ab3969..f9d2ea3 100644
--- a/MP/code/qcommon/files.c
+++ b/MP/code/qcommon/files.c
@@ -558,57 +558,6 @@ qboolean FS_CreatePath( char *OSPath ) {
/*
=================
-FS_CopyFile
-
-Copy a fully specified file from one place to another
-=================
-*/
-void FS_CopyFile( char *fromOSPath, char *toOSPath ) {
- FILE *f;
- int len;
- byte *buf;
-
- Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath );
-
- if ( strstr( fromOSPath, "journal.dat" ) || strstr( fromOSPath, "journaldata.dat" ) ) {
- Com_Printf( "Ignoring journal files\n" );
- return;
- }
-
- f = Sys_FOpen( fromOSPath, "rb" );
- if ( !f ) {
- return;
- }
- fseek( f, 0, SEEK_END );
- len = ftell( f );
- fseek( f, 0, SEEK_SET );
-
- // we are using direct malloc instead of Z_Malloc here, so it
- // probably won't work on a mac... Its only for developers anyway...
- buf = malloc( len );
- if ( fread( buf, 1, len, f ) != len ) {
- Com_Error( ERR_FATAL, "Short read in FS_Copyfiles()\n" );
- }
- fclose( f );
-
- if ( FS_CreatePath( toOSPath ) ) {
- return;
- }
-
- f = Sys_FOpen( toOSPath, "wb" );
- if ( !f ) {
- free( buf ); //DAJ free as well
- return;
- }
- if ( fwrite( buf, 1, len, f ) != len ) {
- Com_Error( ERR_FATAL, "Short write in FS_Copyfiles()\n" );
- }
- fclose( f );
- free( buf );
-}
-
-/*
-=================
FS_CheckFilenameIsMutable
ERR_FATAL if trying to maniuplate a file with the platform library, QVM, or pk3 extension
diff --git a/MP/code/qcommon/qcommon.h b/MP/code/qcommon/qcommon.h
index 321b42a..0727d4e 100644
--- a/MP/code/qcommon/qcommon.h
+++ b/MP/code/qcommon/qcommon.h
@@ -828,8 +828,6 @@ int FS_RandChecksumFeed( void );
char *FS_ShiftedStrStr( const char *string, const char *substring, int shift );
char *FS_ShiftStr( const char *string, int shift );
-void FS_CopyFile( char *fromOSPath, char *toOSPath );
-
qboolean FS_VerifyPak( const char *pak );
/*
diff --git a/MP/code/rend2/tr_bsp.c b/MP/code/rend2/tr_bsp.c
index 5f4af25..fc1509c 100644
--- a/MP/code/rend2/tr_bsp.c
+++ b/MP/code/rend2/tr_bsp.c
@@ -603,8 +603,6 @@ static void R_LoadVisibility( lump_t *l ) {
int len;
byte *buf;
- len = ( s_worldData.numClusters + 63 ) & ~63;
-
len = l->filelen;
if ( !len ) {
return;
@@ -1642,7 +1640,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 ) {
@@ -1698,7 +1696,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 ) {
@@ -1768,7 +1766,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 ) {
@@ -1824,7 +1822,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/MP/code/rend2/tr_flares.c b/MP/code/rend2/tr_flares.c
index bdc8104..dad093f 100644
--- a/MP/code/rend2/tr_flares.c
+++ b/MP/code/rend2/tr_flares.c
@@ -304,7 +304,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/MP/code/rend2/tr_font.c b/MP/code/rend2/tr_font.c
index 9978508..99431ac 100644
--- a/MP/code/rend2/tr_font.c
+++ b/MP/code/rend2/tr_font.c
@@ -456,7 +456,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
maxHeight = 0;
for ( i = GLYPH_START; i < GLYPH_END; i++ ) {
- glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
+ RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
}
xOut = 0;
diff --git a/MP/code/rend2/tr_image.c b/MP/code/rend2/tr_image.c
index 957f2e8..bb7a18a 100644
--- a/MP/code/rend2/tr_image.c
+++ b/MP/code/rend2/tr_image.c
@@ -45,54 +45,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] );
-//DAJ TEST imageBufferPtr[bufferType] = Z_Malloc( imageBufferSize[bufferType] );
- }
- if ( size > imageBufferSize[bufferType] ) { // it needs to grow
- if ( imageBufferPtr[bufferType] ) {
- free( imageBufferPtr[bufferType] );
- }
-//DAJ TEST Z_Free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = size;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
-//DAJ TEST imageBufferPtr[bufferType] = Z_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] );
-//DAJ TEST Z_Free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = 0;
- imageBufferPtr[bufferType] = NULL;
- }
-}
-
/*
** R_GammaCorrect
*/
@@ -2083,7 +2035,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;
@@ -2287,26 +2239,12 @@ image_t *R_CreateImage( const char *name, byte *pic, int width, int height, imgT
qboolean isLightmap = qfalse;
long hash;
int glWrapClampMode;
- 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 ) {
@@ -3350,9 +3288,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
diff --git a/MP/code/rend2/tr_init.c b/MP/code/rend2/tr_init.c
index b4c2670..646a0b4 100644
--- a/MP/code/rend2/tr_init.c
+++ b/MP/code/rend2/tr_init.c
@@ -1648,10 +1648,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/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index 84229a0..fa6c2c8 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -2324,7 +2324,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 );
@@ -2842,6 +2841,5 @@ extern int skyboxportal;
// 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/MP/code/rend2/tr_model.c b/MP/code/rend2/tr_model.c
index 02c7aa5..d74d1bf 100644
--- a/MP/code/rend2/tr_model.c
+++ b/MP/code/rend2/tr_model.c
@@ -543,8 +543,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 ) {
@@ -2172,16 +2170,16 @@ R_LerpTag
================
*/
int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNameIn, int startIndex ) {
- mdvTag_t *start, *end;
+ mdvTag_t *start, *end;
mdvTag_t start_space, end_space;
- int i;
- float frontLerp, backLerp;
- model_t *model;
- char tagName[MAX_QPATH]; //, *ch;
- int retval = 0;
- qhandle_t handle;
- int startFrame, endFrame;
- float frac;
+ int i;
+ float frontLerp, backLerp;
+ model_t *model;
+ char tagName[MAX_QPATH];
+ int retval = 0;
+ qhandle_t handle;
+ int startFrame, endFrame;
+ float frac;
handle = refent->hModel;
startFrame = refent->oldframe;
@@ -2196,8 +2194,9 @@ 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,
@@ -2209,7 +2208,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/MP/code/rend2/tr_model_iqm.c b/MP/code/rend2/tr_model_iqm.c
index 5b404cc..c88dd88 100644
--- a/MP/code/rend2/tr_model_iqm.c
+++ b/MP/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/MP/code/rend2/tr_shade_calc.c b/MP/code/rend2/tr_shade_calc.c
index f8e344d..dfc8e28 100644
--- a/MP/code/rend2/tr_shade_calc.c
+++ b/MP/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/MP/code/rend2/tr_shader.c b/MP/code/rend2/tr_shader.c
index cc55ef2..fc8c133 100644
--- a/MP/code/rend2/tr_shader.c
+++ b/MP/code/rend2/tr_shader.c
@@ -3750,7 +3750,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/MP/code/rend2/tr_surface.c b/MP/code/rend2/tr_surface.c
index a6c6eed..732e579 100644
--- a/MP/code/rend2/tr_surface.c
+++ b/MP/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/MP/code/rend2/tr_world.c b/MP/code/rend2/tr_world.c
index 9af4ddd..aff3585 100644
--- a/MP/code/rend2/tr_world.c
+++ b/MP/code/rend2/tr_world.c
@@ -629,6 +629,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/MP/code/renderer/tr_bsp.c b/MP/code/renderer/tr_bsp.c
index 88428b0..d4712b9 100644
--- a/MP/code/renderer/tr_bsp.c
+++ b/MP/code/renderer/tr_bsp.c
@@ -857,7 +857,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 ) {
@@ -913,7 +913,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 ) {
@@ -980,7 +980,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 ) {
@@ -1036,7 +1036,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/MP/code/renderer/tr_flares.c b/MP/code/renderer/tr_flares.c
index a1367a7..460324e 100644
--- a/MP/code/renderer/tr_flares.c
+++ b/MP/code/renderer/tr_flares.c
@@ -304,7 +304,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/MP/code/renderer/tr_font.c b/MP/code/renderer/tr_font.c
index 81d1697..24a8604 100644
--- a/MP/code/renderer/tr_font.c
+++ b/MP/code/renderer/tr_font.c
@@ -456,7 +456,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
maxHeight = 0;
for ( i = GLYPH_START; i < GLYPH_END; i++ ) {
- glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
+ RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
}
xOut = 0;
diff --git a/MP/code/renderer/tr_image.c b/MP/code/renderer/tr_image.c
index 8af7bdb..0852123 100644
--- a/MP/code/renderer/tr_image.c
+++ b/MP/code/renderer/tr_image.c
@@ -35,7 +35,6 @@ If you have questions concerning this license or the applicable additional terms
#include "tr_local.h"
-
static byte s_intensitytable[256];
static unsigned char s_gammatable[256];
@@ -45,54 +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] );
-//DAJ TEST imageBufferPtr[bufferType] = Z_Malloc( imageBufferSize[bufferType] );
- }
- if ( size > imageBufferSize[bufferType] ) { // it needs to grow
- if ( imageBufferPtr[bufferType] ) {
- free( imageBufferPtr[bufferType] );
- }
-//DAJ TEST Z_Free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = size;
- imageBufferPtr[bufferType] = malloc( imageBufferSize[bufferType] );
-//DAJ TEST imageBufferPtr[bufferType] = Z_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] );
-//DAJ TEST Z_Free( imageBufferPtr[bufferType] );
- imageBufferSize[bufferType] = 0;
- imageBufferPtr[bufferType] = NULL;
- }
-}
-
/*
** R_GammaCorrect
*/
@@ -703,7 +654,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;
@@ -718,16 +669,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;
@@ -758,13 +706,12 @@ 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;
}
- //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
@@ -928,7 +875,8 @@ static void Upload32( unsigned *data,
goto done;
}
memcpy( scaledBuffer, data, width * height * 4 );
- } else
+ }
+ else
{
// use the normal mip-mapping function to go down from here
while ( width > scaled_width || height > scaled_height ) {
@@ -1002,10 +950,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 );
}
/*
diff --git a/MP/code/renderer/tr_init.c b/MP/code/renderer/tr_init.c
index 3c37ca3..b19a197 100644
--- a/MP/code/renderer/tr_init.c
+++ b/MP/code/renderer/tr_init.c
@@ -1444,10 +1444,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/MP/code/renderer/tr_local.h b/MP/code/renderer/tr_local.h
index 5aecb72..475b244 100644
--- a/MP/code/renderer/tr_local.h
+++ b/MP/code/renderer/tr_local.h
@@ -1492,7 +1492,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 );
@@ -1944,6 +1943,5 @@ extern int skyboxportal;
// 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/MP/code/renderer/tr_model.c b/MP/code/renderer/tr_model.c
index 20be57a..e199bee 100644
--- a/MP/code/renderer/tr_model.c
+++ b/MP/code/renderer/tr_model.c
@@ -568,8 +568,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 ) {
@@ -877,7 +875,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;
@@ -938,16 +938,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 );
@@ -2063,18 +2063,18 @@ R_LerpTag
================
*/
int R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagNameIn, int startIndex ) {
- md3Tag_t *start, *end;
+ md3Tag_t *start, *end;
md3Tag_t start_space, end_space;
- md3Tag_t ustart, uend;
- int i;
- float frontLerp, backLerp;
- model_t *model;
- vec3_t sangles, eangles;
- char tagName[MAX_QPATH]; //, *ch;
- int retval = 0;
- qhandle_t handle;
- int startFrame, endFrame;
- float frac;
+ md3Tag_t ustart, uend;
+ int i;
+ float frontLerp, backLerp;
+ model_t *model;
+ vec3_t sangles, eangles;
+ char tagName[MAX_QPATH]; //, *ch;
+ int retval = 0;
+ qhandle_t handle;
+ int startFrame, endFrame;
+ float frac;
handle = refent->hModel;
startFrame = refent->oldframe;
@@ -2096,8 +2096,9 @@ 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,
@@ -2109,7 +2110,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 );
@@ -2125,7 +2126,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/MP/code/renderer/tr_model_iqm.c b/MP/code/renderer/tr_model_iqm.c
index 7da9c7b..b6f570e 100644
--- a/MP/code/renderer/tr_model_iqm.c
+++ b/MP/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/MP/code/renderer/tr_shade_calc.c b/MP/code/renderer/tr_shade_calc.c
index 279aa41..6061e52 100644
--- a/MP/code/renderer/tr_shade_calc.c
+++ b/MP/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/MP/code/renderer/tr_shader.c b/MP/code/renderer/tr_shader.c
index fae6165..547bc89 100644
--- a/MP/code/renderer/tr_shader.c
+++ b/MP/code/renderer/tr_shader.c
@@ -2968,7 +2968,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] = {0};
+ char *buffers[MAX_SHADER_FILES] = {NULL};
char *p;
int numShaderFiles;
int i;
diff --git a/MP/code/renderer/tr_surface.c b/MP/code/renderer/tr_surface.c
index d52a41b..d9ea120 100644
--- a/MP/code/renderer/tr_surface.c
+++ b/MP/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/MP/code/renderer/tr_world.c b/MP/code/renderer/tr_world.c
index 6b90a8f..4ab764d 100644
--- a/MP/code/renderer/tr_world.c
+++ b/MP/code/renderer/tr_world.c
@@ -478,8 +478,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;
@@ -487,7 +487,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;
@@ -497,10 +497,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/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index 8419797..233d1ee 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -640,7 +640,7 @@ void Text_Paint( float x, float y, float scale, vec4_t color, const char *text,
// NOTE: this is clearly non-optimal implementation, see Item_Text_AutoWrap_Paint for one
// if color_save != NULL, use to keep track of the current color between wraps
char* Text_AutoWrap_Paint_Chunk( float x, float y, int width, float scale, vec4_t color, char *text, float adjust, int limit, int style, qboolean dummy, vec4_t color_save ) {
- int len, count;
+ int len = 0, count;
vec4_t newColor;
glyphInfo_t *glyph;
float useScale;
@@ -757,7 +757,7 @@ char* Text_AutoWrap_Paint_Chunk( float x, float y, int width, float scale, vec4_
trap_R_SetColor( NULL );
}
}
- return text + strlen( text );
+ return text + len;
}
// count the lines that we will need to have to print with the given wrap parameters
@@ -4310,7 +4310,7 @@ void WM_ActivateLimboChat( void ) {
menuDef_t *menu;
itemDef_t *itemdef;
- menu = Menu_GetFocused();
+ Menu_GetFocused();
menu = Menus_ActivateByName( "wm_limboChat", qtrue );
if ( !menu || g_editItem ) {
@@ -5289,14 +5289,12 @@ UI_BuildServerDisplayList
==================
*/
static void UI_BuildServerDisplayList( int force ) {
- int i, count, clients, maxClients, ping, game, len, visible, friendlyFire, tourney, maxlives, punkbuster, antilag;
+ int i, count, clients, maxClients, ping, game = 0, len, visible, friendlyFire, tourney, maxlives, punkbuster, antilag;
char info[MAX_STRING_CHARS];
//qboolean startRefresh = qtrue; // TTimo: unused
static int numinvisible;
int lanSource;
- game = 0; // NERVE - SMF - shut up compiler warning
-
if ( !( force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh ) ) {
return;
}
diff --git a/MP/code/ui/ui_players.c b/MP/code/ui/ui_players.c
index 79457b1..0b2b930 100644
--- a/MP/code/ui/ui_players.c
+++ b/MP/code/ui/ui_players.c
@@ -1157,6 +1157,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[]
@@ -1182,18 +1183,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 ) {
@@ -1206,6 +1210,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/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c
index a72134e..569905c 100644
--- a/MP/code/ui/ui_shared.c
+++ b/MP/code/ui/ui_shared.c
@@ -1226,7 +1226,7 @@ void Script_Clipboard( itemDef_t *item, char **args ) {
-#define NOTEBOOK_MAX_PAGES 6 // this will not be a define
+//#define NOTEBOOK_MAX_PAGES 6 // this will not be a define
/*
@@ -1240,6 +1240,7 @@ Script_NotebookShowpage
==============
*/
void Script_NotebookShowpage( itemDef_t *item, char **args ) {
+/*
int i, inc, curpage, newpage = 0, pages;
pages = DC->getCVarValue( "cg_notebookpages" );
@@ -1330,6 +1331,7 @@ void Script_NotebookShowpage( itemDef_t *item, char **args ) {
DC->setCVar( "ui_notebookCurrentPage", va( "%d", curpage ) ); // store new current page
}
+*/
}
@@ -4638,7 +4640,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 );
}
@@ -6078,6 +6080,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;
diff --git a/SP/code/client/cl_cgame.c b/SP/code/client/cl_cgame.c
index f9db9b5..2b46067 100644
--- a/SP/code/client/cl_cgame.c
+++ b/SP/code/client/cl_cgame.c
@@ -38,9 +38,9 @@ If you have questions concerning this license or the applicable additional terms
extern botlib_export_t *botlib_export;
-extern qboolean loadCamera( int camNum, const char *name );
-extern void startCamera( int camNum, int time );
-extern qboolean getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov );
+qboolean loadCamera( int camNum, const char *name );
+void startCamera( int camNum, int time );
+qboolean getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov );
// RF, this is only used when running a local server
extern void SV_SendMoveSpeedsToGame( int entnum, char *text );
--
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