Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings

This commit is contained in:
Thilo Schulz 2011-07-29 12:27:00 +00:00
parent 1ea7ab1f42
commit 23f6fd1633
85 changed files with 246 additions and 496 deletions

View file

@ -904,9 +904,9 @@ static float CG_DrawTeamOverlay( float y, qboolean right, qboolean upper ) {
p = CG_ConfigString(CS_LOCATIONS + ci->location);
if (!p || !*p)
p = "unknown";
len = CG_DrawStrlen(p);
if (len > lwidth)
len = lwidth;
// len = CG_DrawStrlen(p);
// if (len > lwidth)
// len = lwidth;
// xx = x + TINYCHAR_WIDTH * 2 + TINYCHAR_WIDTH * pwidth +
// ((lwidth/2 - len/2) * TINYCHAR_WIDTH);
@ -1348,8 +1348,8 @@ CG_DrawTeamInfo
*/
#ifndef MISSIONPACK
static void CG_DrawTeamInfo( void ) {
int w, h;
int i, len;
int h;
int i;
vec4_t hcolor;
int chatHeight;
@ -1370,16 +1370,6 @@ static void CG_DrawTeamInfo( void ) {
h = (cgs.teamChatPos - cgs.teamLastChatPos) * TINYCHAR_HEIGHT;
w = 0;
for (i = cgs.teamLastChatPos; i < cgs.teamChatPos; i++) {
len = CG_DrawStrlen(cgs.teamChatMsgs[i % chatHeight]);
if (len > w)
w = len;
}
w *= TINYCHAR_WIDTH;
w += TINYCHAR_WIDTH * 2;
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) {
hcolor[0] = 1.0f;
hcolor[1] = 0.0f;
@ -1924,7 +1914,7 @@ CG_DrawCrosshair3D
*/
static void CG_DrawCrosshair3D(void)
{
float w, h;
float w;
qhandle_t hShader;
float f;
int ca;
@ -1947,14 +1937,13 @@ static void CG_DrawCrosshair3D(void)
return;
}
w = h = cg_crosshairSize.value;
w = cg_crosshairSize.value;
// pulse the size of the crosshair when picking up items
f = cg.time - cg.itemPickupBlendTime;
if ( f > 0 && f < ITEM_BLOB_TIME ) {
f /= ITEM_BLOB_TIME;
w *= ( 1 + f );
h *= ( 1 + f );
}
ca = cg_drawCrosshair.integer;
@ -2164,7 +2153,6 @@ static void CG_DrawTeamVote(void) {
static qboolean CG_DrawScoreboard( void ) {
#ifdef MISSIONPACK
static qboolean firstTime = qtrue;
float fade, *fadeColor;
if (menuScoreboard) {
menuScoreboard->window.flags &= ~WINDOW_FORCED;
@ -2188,20 +2176,15 @@ static qboolean CG_DrawScoreboard( void ) {
}
if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD || cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
fade = 1.0;
fadeColor = colorWhite;
} else {
fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME );
if ( !fadeColor ) {
if ( !CG_FadeColor( cg.scoreFadeTime, FADE_TIME ) ) {
// next time scoreboard comes up, don't print killer
cg.deferredPlayerLoading = 0;
cg.killerName[0] = 0;
firstTime = qtrue;
return qfalse;
}
fade = *fadeColor;
}
}
if (menuScoreboard == NULL) {
if ( cgs.gametype >= GT_TEAM ) {
@ -2361,9 +2344,12 @@ static void CG_DrawWarmup( void ) {
int w;
int sec;
int i;
float scale;
clientInfo_t *ci1, *ci2;
#ifdef MISSIONPACK
float scale;
#else
int cw;
#endif
clientInfo_t *ci1, *ci2;
const char *s;
sec = cg.warmup;
@ -2464,30 +2450,41 @@ static void CG_DrawWarmup( void ) {
break;
}
}
scale = 0.45f;
#ifdef MISSIONPACK
switch ( cg.warmupCount ) {
case 0:
cw = 28;
scale = 0.54f;
break;
case 1:
cw = 24;
scale = 0.51f;
break;
case 2:
cw = 20;
scale = 0.48f;
break;
default:
cw = 16;
scale = 0.45f;
break;
}
#ifdef MISSIONPACK
w = CG_Text_Width(s, scale, 0);
CG_Text_Paint(320 - w / 2, 125, scale, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE);
w = CG_Text_Width(s, scale, 0);
CG_Text_Paint(320 - w / 2, 125, scale, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE);
#else
switch ( cg.warmupCount ) {
case 0:
cw = 28;
break;
case 1:
cw = 24;
break;
case 2:
cw = 20;
break;
default:
cw = 16;
break;
}
w = CG_DrawStrlen( s );
CG_DrawStringExt( 320 - w * cw/2, 70, s, colorWhite,
qfalse, qtrue, cw, (int)(cw * 1.5), 0 );

View file

@ -671,7 +671,8 @@ Also called by client movement prediction code
void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) {
centity_t *cent;
vec3_t oldOrigin, origin, deltaOrigin;
vec3_t oldAngles, angles, deltaAngles;
vec3_t oldAngles, angles;
//vec3_t deltaAngles;
if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) {
VectorCopy( in, out );
@ -691,7 +692,7 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int
BG_EvaluateTrajectory( &cent->currentState.apos, toTime, angles );
VectorSubtract( origin, oldOrigin, deltaOrigin );
VectorSubtract( angles, oldAngles, deltaAngles );
//VectorSubtract( angles, oldAngles, deltaAngles );
VectorAdd( in, deltaOrigin, out );

View file

@ -599,11 +599,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_JUMP_PAD");
// CG_Printf( "EV_JUMP_PAD w/effect #%i\n", es->eventParm );
{
localEntity_t *smoke;
vec3_t up = {0, 0, 1};
smoke = CG_SmokePuff( cent->lerpOrigin, up,
CG_SmokePuff( cent->lerpOrigin, up,
32,
1, 1, 1, 0.33f,
1000,

View file

@ -150,10 +150,6 @@ typedef struct {
int painDirection; // flip from 0 to 1
int lightningFiring;
// railgun trail spawning
vec3_t railgunImpact;
qboolean railgunFlash;
int railFireTime;
// machinegun spinning
@ -419,7 +415,6 @@ typedef struct weaponInfo_s {
sfxHandle_t readySound;
sfxHandle_t firingSound;
qboolean loopFireSound;
} weaponInfo_t;
@ -837,7 +832,7 @@ typedef struct {
sfxHandle_t sfx_ric1;
sfxHandle_t sfx_ric2;
sfxHandle_t sfx_ric3;
sfxHandle_t sfx_railg;
//sfxHandle_t sfx_railg;
sfxHandle_t sfx_rockexp;
sfxHandle_t sfx_plasmaexp;
#ifdef MISSIONPACK
@ -862,7 +857,6 @@ typedef struct {
sfxHandle_t obeliskRespawnSound;
sfxHandle_t winnerSound;
sfxHandle_t loserSound;
sfxHandle_t youSuckSound;
#endif
sfxHandle_t gibSound;
sfxHandle_t gibBounce1Sound;

View file

@ -629,9 +629,6 @@ void CG_AddKamikaze( localEntity_t *le ) {
le->angles.trBase[1] = random() * 360;
le->angles.trBase[2] = random() * 360;
}
else {
c = 0;
}
memset(&shockwave, 0, sizeof(shockwave));
shockwave.hModel = cgs.media.kamikazeShockWave;
shockwave.reType = RT_MODEL;

View file

@ -725,7 +725,7 @@ static void CG_RegisterSounds( void ) {
cgs.media.sfx_ric1 = trap_S_RegisterSound ("sound/weapons/machinegun/ric1.wav", qfalse);
cgs.media.sfx_ric2 = trap_S_RegisterSound ("sound/weapons/machinegun/ric2.wav", qfalse);
cgs.media.sfx_ric3 = trap_S_RegisterSound ("sound/weapons/machinegun/ric3.wav", qfalse);
cgs.media.sfx_railg = trap_S_RegisterSound ("sound/weapons/railgun/railgf1a.wav", qfalse);
//cgs.media.sfx_railg = trap_S_RegisterSound ("sound/weapons/railgun/railgf1a.wav", qfalse);
cgs.media.sfx_rockexp = trap_S_RegisterSound ("sound/weapons/rocket/rocklx1a.wav", qfalse);
cgs.media.sfx_plasmaexp = trap_S_RegisterSound ("sound/weapons/plasma/plasmx1a.wav", qfalse);
#ifdef MISSIONPACK
@ -742,7 +742,6 @@ static void CG_RegisterSounds( void ) {
cgs.media.kamikazeFarSound = trap_S_RegisterSound( "sound/items/kam_explode_far.wav", qfalse );
cgs.media.winnerSound = trap_S_RegisterSound( "sound/feedback/voc_youwin.wav", qfalse );
cgs.media.loserSound = trap_S_RegisterSound( "sound/feedback/voc_youlose.wav", qfalse );
cgs.media.youSuckSound = trap_S_RegisterSound( "sound/misc/yousuck.wav", qfalse );
cgs.media.wstbimplSound = trap_S_RegisterSound("sound/weapons/proxmine/wstbimpl.wav", qfalse);
cgs.media.wstbimpmSound = trap_S_RegisterSound("sound/weapons/proxmine/wstbimpm.wav", qfalse);

View file

@ -160,52 +160,42 @@ void CG_SelectPrevPlayer( void ) {
static void CG_DrawPlayerArmorIcon( rectDef_t *rect, qboolean draw2D ) {
centity_t *cent;
playerState_t *ps;
vec3_t angles;
vec3_t origin;
if ( cg_drawStatus.integer == 0 ) {
if ( cg_drawStatus.integer == 0 ) {
return;
}
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
if ( draw2D || ( !cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
CG_DrawPic( rect->x, rect->y + rect->h/2 + 1, rect->w, rect->h, cgs.media.armorIcon );
} else if (cg_draw3dIcons.integer) {
VectorClear( angles );
origin[0] = 90;
origin[1] = 0;
origin[2] = -10;
angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0;
CG_Draw3DModel( rect->x, rect->y, rect->w, rect->h, cgs.media.armorModel, 0, origin, angles );
}
} else if (cg_draw3dIcons.integer) {
VectorClear( angles );
origin[0] = 90;
origin[1] = 0;
origin[2] = -10;
angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0f;
CG_Draw3DModel( rect->x, rect->y, rect->w, rect->h, cgs.media.armorModel, 0, origin, angles );
}
}
static void CG_DrawPlayerArmorValue(rectDef_t *rect, float scale, vec4_t color, qhandle_t shader, int textStyle) {
char num[16];
int value;
centity_t *cent;
int value;
playerState_t *ps;
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
value = ps->stats[STAT_ARMOR];
if (shader) {
trap_R_SetColor( color );
trap_R_SetColor( color );
CG_DrawPic(rect->x, rect->y, rect->w, rect->h, shader);
trap_R_SetColor( NULL );
trap_R_SetColor( NULL );
} else {
Com_sprintf (num, sizeof(num), "%i", value);
value = CG_Text_Width(num, scale, 0);
CG_Text_Paint(rect->x + (rect->w - value) / 2, rect->y + rect->h, scale, color, num, 0, 0, textStyle);
CG_Text_Paint(rect->x + (rect->w - value) / 2, rect->y + rect->h, scale, color, num, 0, 0, textStyle);
}
}
@ -220,29 +210,27 @@ static float healthColors[4][4] = {
static void CG_DrawPlayerAmmoIcon( rectDef_t *rect, qboolean draw2D ) {
centity_t *cent;
playerState_t *ps;
vec3_t angles;
vec3_t origin;
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
if ( draw2D || (!cg_draw3dIcons.integer && cg_drawIcons.integer) ) {
qhandle_t icon;
icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
qhandle_t icon;
icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
if ( icon ) {
CG_DrawPic( rect->x, rect->y, rect->w, rect->h, icon );
CG_DrawPic( rect->x, rect->y, rect->w, rect->h, icon );
}
} else if (cg_draw3dIcons.integer) {
if ( cent->currentState.weapon && cg_weapons[ cent->currentState.weapon ].ammoModel ) {
VectorClear( angles );
origin[0] = 70;
origin[1] = 0;
origin[2] = 0;
angles[YAW] = 90 + 20 * sin( cg.time / 1000.0 );
CG_Draw3DModel( rect->x, rect->y, rect->w, rect->h, cg_weapons[ cent->currentState.weapon ].ammoModel, 0, origin, angles );
}
}
} else if (cg_draw3dIcons.integer) {
if ( cent->currentState.weapon && cg_weapons[ cent->currentState.weapon ].ammoModel ) {
VectorClear( angles );
origin[0] = 70;
origin[1] = 0;
origin[2] = 0;
angles[YAW] = 90 + 20 * sin( cg.time / 1000.0 );
CG_Draw3DModel( rect->x, rect->y, rect->w, rect->h, cg_weapons[ cent->currentState.weapon ].ammoModel, 0, origin, angles );
}
}
}
static void CG_DrawPlayerAmmoValue(rectDef_t *rect, float scale, vec4_t color, qhandle_t shader, int textStyle) {
@ -364,7 +352,7 @@ static void CG_DrawSelectedPlayerArmor( rectDef_t *rect, float scale, vec4_t col
}
qhandle_t CG_StatusHandle(int task) {
qhandle_t h = cgs.media.assaultShader;
qhandle_t h;
switch (task) {
case TEAMTASK_OFFENSE :
h = cgs.media.assaultShader;

View file

@ -858,9 +858,7 @@ void CG_AddParticles (void)
float alpha;
float time, time2;
vec3_t org;
int color;
cparticle_t *active, *tail;
int type;
vec3_t rotate_ang;
if (!initparticles)
@ -965,16 +963,12 @@ void CG_AddParticles (void)
if (alpha > 1.0)
alpha = 1;
color = p->color;
time2 = time*time;
org[0] = p->org[0] + p->vel[0]*time + p->accel[0]*time2;
org[1] = p->org[1] + p->vel[1]*time + p->accel[1]*time2;
org[2] = p->org[2] + p->vel[2]*time + p->accel[2]*time2;
type = p->type;
CG_AddParticleToScene (p, org, alpha);
}
@ -1682,8 +1676,8 @@ qboolean ValidBloodPool (vec3_t start)
vec3_t angles;
vec3_t right, up;
vec3_t this_pos, x_pos, center_pos, end_pos;
float x, y;
float fwidth, fheight;
int x, y;
int fwidth, fheight;
trace_t trace;
vec3_t normal;

View file

@ -1575,7 +1575,6 @@ CG_DustTrail
*/
static void CG_DustTrail( centity_t *cent ) {
int anim;
localEntity_t *dust;
vec3_t end, vel;
trace_t tr;
@ -1607,7 +1606,7 @@ static void CG_DustTrail( centity_t *cent ) {
end[2] -= 16;
VectorSet(vel, 0, 0, -30);
dust = CG_SmokePuff( end, vel,
CG_SmokePuff( end, vel,
24,
.8f, .8f, 0.7f, 0.33f,
500,

View file

@ -295,7 +295,10 @@ CG_CheckLocalSounds
==================
*/
void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) {
int highScore, health, armor, reward;
int highScore, reward;
#ifdef MISSIONPACK
int health, armor;
#endif
sfxHandle_t sfx;
// don't play the sounds if the player just changed teams
@ -305,9 +308,9 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) {
// hit changes
if ( ps->persistant[PERS_HITS] > ops->persistant[PERS_HITS] ) {
#ifdef MISSIONPACK
armor = ps->persistant[PERS_ATTACKEE_ARMOR] & 0xff;
health = ps->persistant[PERS_ATTACKEE_ARMOR] >> 8;
#ifdef MISSIONPACK
if (armor > 50 ) {
trap_S_StartLocalSound( cgs.media.hitSoundHighArmor, CHAN_LOCAL_SOUND );
} else if (armor || health > 100) {

View file

@ -213,7 +213,7 @@ CG_RailTrail
==========================
*/
void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
vec3_t axis[36], move, move2, next_move, vec, temp;
vec3_t axis[36], move, move2, vec, temp;
float len;
int i, j, skip;
@ -271,7 +271,6 @@ void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
}
VectorMA(move, 20, vec, move);
VectorCopy(move, next_move);
VectorScale (vec, SPACING, vec);
skip = -1;
@ -471,7 +470,6 @@ static void CG_PlasmaTrail( centity_t *cent, const weaponInfo_t *wi ) {
vec3_t velocity, xvelocity, origin;
vec3_t offset, xoffset;
vec3_t v[3];
int t, startTime, step;
float waterScale = 1.0f;
@ -479,11 +477,7 @@ static void CG_PlasmaTrail( centity_t *cent, const weaponInfo_t *wi ) {
return;
}
step = 50;
es = &cent->currentState;
startTime = cent->trailTime;
t = step * ( (startTime + step) / step );
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
@ -528,21 +522,21 @@ static void CG_PlasmaTrail( centity_t *cent, const weaponInfo_t *wi ) {
VectorScale( xvelocity, waterScale, le->pos.trDelta );
AxisCopy( axisDefault, re->axis );
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_SPRITE;
re->radius = 0.25f;
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_SPRITE;
re->radius = 0.25f;
re->customShader = cgs.media.railRingsShader;
le->bounceFactor = 0.3f;
re->shaderRGBA[0] = wi->flashDlightColor[0] * 63;
re->shaderRGBA[1] = wi->flashDlightColor[1] * 63;
re->shaderRGBA[2] = wi->flashDlightColor[2] * 63;
re->shaderRGBA[3] = 63;
re->shaderRGBA[0] = wi->flashDlightColor[0] * 63;
re->shaderRGBA[1] = wi->flashDlightColor[1] * 63;
re->shaderRGBA[2] = wi->flashDlightColor[2] * 63;
re->shaderRGBA[3] = 63;
le->color[0] = wi->flashDlightColor[0] * 0.2;
le->color[1] = wi->flashDlightColor[1] * 0.2;
le->color[2] = wi->flashDlightColor[2] * 0.2;
le->color[3] = 0.25f;
le->color[0] = wi->flashDlightColor[0] * 0.2;
le->color[1] = wi->flashDlightColor[1] * 0.2;
le->color[2] = wi->flashDlightColor[2] * 0.2;
le->color[3] = 0.25f;
le->angles.trType = TR_LINEAR;
le->angles.trTime = cg.time;
@ -680,8 +674,6 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" );
}
weaponInfo->loopFireSound = qfalse;
switch ( weaponNum ) {
case WP_GAUNTLET:
MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f );
@ -708,8 +700,6 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" );
weaponInfo->missileTrailFunc = CG_GrappleTrail;
weaponInfo->missileDlight = 200;
weaponInfo->wiTrailTime = 2000;
weaponInfo->trailRadius = 64;
MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 );
weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse );
weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/melee/fstrun.wav", qfalse );
@ -719,7 +709,6 @@ void CG_RegisterWeapon( int weaponNum ) {
#ifdef MISSIONPACK
case WP_CHAINGUN:
weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/vulcan/wvulfire.wav", qfalse );
weaponInfo->loopFireSound = qtrue;
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/vulcan/vulcanf1b.wav", qfalse );
weaponInfo->flashSound[1] = trap_S_RegisterSound( "sound/weapons/vulcan/vulcanf2b.wav", qfalse );
@ -1135,28 +1124,6 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
}
*/
/*
===============
CG_SpawnRailTrail
Origin will be the exact tag point, which is slightly
different than the muzzle point used for determining hits.
===============
*/
static void CG_SpawnRailTrail( centity_t *cent, vec3_t origin ) {
clientInfo_t *ci;
if ( cent->currentState.weapon != WP_RAILGUN ) {
return;
}
if ( !cent->pe.railgunFlash ) {
return;
}
cent->pe.railgunFlash = qtrue;
ci = &cgs.clientinfo[ cent->currentState.clientNum ];
CG_RailTrail( ci, origin, cent->pe.railgunImpact );
}
/*
======================
@ -1338,7 +1305,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
// continuous flash
} else {
// impulse flash
if ( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME && !cent->pe.railgunFlash ) {
if ( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME ) {
return;
}
}
@ -1375,9 +1342,6 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
// add lightning bolt
CG_LightningBolt( nonPredictedCent, flash.origin );
// add rail trail
CG_SpawnRailTrail( cent, flash.origin );
if ( weapon->flashDlightColor[0] || weapon->flashDlightColor[1] || weapon->flashDlightColor[2] ) {
trap_R_AddLightToScene( flash.origin, 300 + (rand()&31), weapon->flashDlightColor[0],
weapon->flashDlightColor[1], weapon->flashDlightColor[2] );
@ -1878,6 +1842,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
case WP_RAILGUN:
mod = cgs.media.ringFlashModel;
shader = cgs.media.railExplosionShader;
//sfx = cgs.media.sfx_railg;
sfx = cgs.media.sfx_plasmaexp;
mark = cgs.media.energyMarkShader;
radius = 24;
@ -1917,15 +1882,6 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
}
mark = cgs.media.bulletMarkShader;
r = rand() & 3;
if ( r < 2 ) {
sfx = cgs.media.sfx_ric1;
} else if ( r == 2 ) {
sfx = cgs.media.sfx_ric2;
} else {
sfx = cgs.media.sfx_ric3;
}
radius = 8;
break;
#endif