Skip to content

Commit

Permalink
cgame - game - q3_ui: Fix compiler warnings from some unused/uninitia…
Browse files Browse the repository at this point in the history
…lized/badly used variables/functions
  • Loading branch information
LegendaryGuard committed Nov 30, 2024
1 parent a6b6a42 commit a91bfd4
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 125 deletions.
8 changes: 4 additions & 4 deletions source/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ static void CG_DrawStatusBar( void ) {
int spacer = CHAR_WIDTH*2;
vec4_t hcolor;
vec3_t angles;
vec3_t origin;
// BFP - Unused variable
// vec3_t origin;

static float colors[4][4] = {
// { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
Expand Down Expand Up @@ -449,7 +450,6 @@ static void CG_DrawStatusBar( void ) {
}
#endif

// BFP - TODO: Draw a HUD bar of 6 points to indicate ki attack preparation
// BFP - TODO: Draw player powerlevel info


Expand Down Expand Up @@ -1980,7 +1980,7 @@ static void CG_DrawTeamVote(void) {
}


static qboolean CG_DrawScoreboard() {
static qboolean CG_DrawScoreboard( void ) {
return CG_DrawOldScoreboard();
}

Expand Down Expand Up @@ -2319,7 +2319,7 @@ static void CG_Draw2D( void ) {
}


static void CG_DrawTourneyScoreboard() {
static void CG_DrawTourneyScoreboard( void ) {
CG_DrawOldTourneyScoreboard();
}

Expand Down
18 changes: 11 additions & 7 deletions source/cgame/cg_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ void CG_ExplosionEffect( vec3_t origin, vec3_t dir ) { // BFP - Explosion effect
// BFP - Low poly sphere
// BFP - TODO: Apply explosionModel from bfp attack config, highPolySphereModel is just a test
qhandle_t sphereModel = ( cg_lowpolysphere.integer > 0 ) ? cgs.media.lowPolySphereModel : cgs.media.highPolySphereModel;
localEntity_t *leSphere, *leRing, *leShell;
localEntity_t *leSphere, *leRing = NULL, *leShell = NULL;

VectorMA( origin, 10, dir, origin );

Expand Down Expand Up @@ -768,19 +768,23 @@ void CG_ExplosionEffect( vec3_t origin, vec3_t dir ) { // BFP - Explosion effect
if ( explosionRingScaleFactorChargeMult > MAX_SCALEFACTOR ) explosionRingScaleFactorChargeMult = MAX_SCALEFACTOR;
scale = explosionRingScaleFactor + explosionRingScaleFactorChargeMult * numPointsChargedOverMin;
if ( scale > MAX_SCALE ) scale = MAX_SCALE;
VectorScale( leRing->refEntity.axis[0], scale, leRing->refEntity.axis[0] );
VectorScale( leRing->refEntity.axis[1], scale, leRing->refEntity.axis[1] );
VectorScale( leRing->refEntity.axis[2], scale, leRing->refEntity.axis[2] );
if ( leRing ) {
VectorScale( leRing->refEntity.axis[0], scale, leRing->refEntity.axis[0] );
VectorScale( leRing->refEntity.axis[1], scale, leRing->refEntity.axis[1] );
VectorScale( leRing->refEntity.axis[2], scale, leRing->refEntity.axis[2] );
}
}

if ( cg_explosionShell.integer > 0 ) {
if ( explosionShellScaleFactor > MAX_SCALEFACTOR ) explosionShellScaleFactor = MAX_SCALEFACTOR;
if ( explosionShellScaleFactorChargeMult > MAX_SCALEFACTOR ) explosionShellScaleFactorChargeMult = MAX_SCALEFACTOR;
scale = explosionShellScaleFactor + explosionShellScaleFactorChargeMult * numPointsChargedOverMin;
if ( scale > MAX_SCALE ) scale = MAX_SCALE;
VectorScale( leShell->refEntity.axis[0], scale, leShell->refEntity.axis[0] );
VectorScale( leShell->refEntity.axis[1], scale, leShell->refEntity.axis[1] );
VectorScale( leShell->refEntity.axis[2], scale, leShell->refEntity.axis[2] );
if ( leShell ) {
VectorScale( leShell->refEntity.axis[0], scale, leShell->refEntity.axis[0] );
VectorScale( leShell->refEntity.axis[1], scale, leShell->refEntity.axis[1] );
VectorScale( leShell->refEntity.axis[2], scale, leShell->refEntity.axis[2] );
}
}
}

Expand Down
24 changes: 12 additions & 12 deletions source/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ void CG_MouseEvent(int x, int y);
void CG_EventHandling(int type);
void CG_RankRunFrame( void );
void CG_SetScoreSelection(void *menu);
score_t *CG_GetSelectedScore();
void CG_BuildSpectatorString();
score_t *CG_GetSelectedScore( void );
void CG_BuildSpectatorString( void );


//
Expand Down Expand Up @@ -1159,23 +1159,23 @@ void CG_OwnerDraw(float x, float y, float w, float h, float text_x, float text_y
void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style);
int CG_Text_Width(const char *text, float scale, int limit);
int CG_Text_Height(const char *text, float scale, int limit);
void CG_SelectPrevPlayer();
void CG_SelectNextPlayer();
void CG_SelectPrevPlayer( void );
void CG_SelectNextPlayer( void );
float CG_GetValue(int ownerDraw);
qboolean CG_OwnerDrawVisible(int flags);
void CG_RunMenuScript(char **args);
void CG_ShowResponseHead();
void CG_ShowResponseHead( void );
void CG_SetPrintString(int type, const char *p);
void CG_InitTeamChat();
void CG_InitTeamChat( void );
void CG_GetTeamColor(vec4_t *color);
const char *CG_GetGameStatusText();
const char *CG_GetKillerText();
const char *CG_GetGameStatusText( void );
const char *CG_GetKillerText( void );
void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandle_t skin, vec3_t origin, vec3_t angles );
void CG_Text_PaintChar(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader);
void CG_CheckOrderPending();
const char *CG_GameTypeString();
qboolean CG_YourTeamHasFlag();
qboolean CG_OtherTeamHasFlag();
void CG_CheckOrderPending( void );
const char *CG_GameTypeString( void );
qboolean CG_YourTeamHasFlag( void );
qboolean CG_OtherTeamHasFlag( void );
qhandle_t CG_StatusHandle(int task);


Expand Down
2 changes: 2 additions & 0 deletions source/cgame/cg_localents.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ static void CG_AddExplosion( localEntity_t *ex ) {
case LE_EXPLOSION_SHELL:
scale = 1.12f; // scale faster than the explosion sphere
break;
default:
break;
}

VectorScale( ent->axis[0], scale, ent->axis[0] );
Expand Down
2 changes: 1 addition & 1 deletion source/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ CG_BuildSpectatorString
=======================
*/
void CG_BuildSpectatorString() {
void CG_BuildSpectatorString( void ) {
int i;
cg.spectatorList[0] = 0;
for (i = 0; i < MAX_CLIENTS; i++) {
Expand Down
11 changes: 2 additions & 9 deletions source/cgame/cg_particles.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
float ratio;
float invratio;
vec3_t color;
polyVert_t TRIverts[3];
vec3_t rright2, rup2;

#if 0 /* // BFP - Unused particle type conditionals */
#if 0 /* // BFP - Unused particle type variable and conditionals */
polyVert_t TRIverts[3];
if (p->type == P_WEATHER || p->type == P_WEATHER_TURBULENT || p->type == P_WEATHER_FLURRY)
{// create a front facing polygon

Expand Down Expand Up @@ -867,9 +866,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;

timenonscaled = trap_Milliseconds(); // BFP - That's what the variable makes non-timescaled
Expand Down Expand Up @@ -948,16 +945,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);
}

Expand Down
4 changes: 3 additions & 1 deletion source/cgame/cg_playerstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ If the ammo has gone low enough to generate the warning, play a sound
void CG_CheckAmmo( void ) {
int i;
int total;
int previous;
int weapons;

// BFP - Unused variable
// int previous;

// BFP - TODO: Replace to ki

// see about how many seconds of ammo we have remaining
Expand Down
3 changes: 2 additions & 1 deletion source/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,8 @@ CG_ShotgunPellet
*/
static void CG_ShotgunPellet( vec3_t start, vec3_t end, int skipNum ) {
trace_t tr;
int sourceContentType, destContentType;
// BFP - Unused variables
// int sourceContentType, destContentType;

CG_Trace( &tr, start, NULL, NULL, end, skipNum, MASK_SHOT );

Expand Down
2 changes: 1 addition & 1 deletion source/game/bg_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ grabbing them easier
============
*/
qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime ) {
vec3_t origin;
vec3_t origin = {0, 0, 0};

BG_EvaluateTrajectory( &item->pos, atTime, origin );

Expand Down
20 changes: 9 additions & 11 deletions source/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ keep holding down the attack key, keeps muzzling and
doesn't shoot anything while the ki is wasted out of control.
==================
*/
static void PM_KiAttackTorsoAnim() { // BFP - Torso ki attack anims
static void PM_KiAttackTorsoAnim( void ) { // BFP - Torso ki attack anims
if ( ( pm->cmd.buttons & BUTTON_ATTACK ) && !( pm->ps->pm_flags & PMF_KI_ATTACK ) ) {
switch( pm->ps->weapon ) {
case WP_ROCKET_LAUNCHER: { PM_StartTorsoAnim( TORSO_ATTACK1_PREPARE ); break; }
Expand Down Expand Up @@ -216,7 +216,7 @@ static void PM_TorsoStatusAnim( int anim ) { // BFP - Torso status handling
PM_ForceJumpAnim
==================
*/
static void PM_ForceJumpAnim() { // BFP - Jump anim handling
static void PM_ForceJumpAnim( void ) { // BFP - Jump anim handling
( pm->cmd.forwardmove >= 0 ) ? PM_ForceLegsAnim( LEGS_JUMP ) : PM_ForceLegsAnim( LEGS_JUMPB );
}

Expand All @@ -225,7 +225,7 @@ static void PM_ForceJumpAnim() { // BFP - Jump anim handling
PM_ContinueFlyAnim
==================
*/
static void PM_ContinueFlyAnim() { // BFP - Continuous fly anim handling
static void PM_ContinueFlyAnim( void ) { // BFP - Continuous fly anim handling
if ( pm->cmd.forwardmove > 0 ) { PM_TorsoStatusAnim( TORSO_FLYA ); PM_ContinueLegsAnim( LEGS_FLYA ); }
else if ( pm->cmd.forwardmove < 0 ) { PM_TorsoStatusAnim( TORSO_FLYB ); PM_ContinueLegsAnim( LEGS_FLYB ); }
else { PM_TorsoStatusAnim( TORSO_STAND ); PM_ContinueLegsAnim( LEGS_FLYIDLE ); }
Expand Down Expand Up @@ -555,7 +555,6 @@ static qboolean PM_CheckJump( void ) {
pml.groundTrace = trace;

if ( trace.plane.normal[2] < 1 ) {
float scale = PM_CmdScale( &pm->cmd );
float fmove, smove;
int i;

Expand Down Expand Up @@ -1449,15 +1448,14 @@ static int PM_CorrectAllSolid( trace_t *trace ) {
PM_ControlJumpOnGround
=============
*/
static void PM_ControlJumpOnGround() { // BFP - A control to handle user movement intentions when jumping off the ground
static void PM_ControlJumpOnGround( void ) { // BFP - A control to handle user movement intentions when jumping off the ground
if ( !pml.walking // don't use on walking
&& pm->ps->weaponstate != WEAPON_STUN
&& pm->ps->groundEntityNum != ENTITYNUM_NONE
&& pm->ps->powerups[PW_FLIGHT] <= 0
&& ( pm->cmd.upmove > 0 || ( pm->ps->pm_flags & PMF_JUMP_HELD ) )
&& ( pm->cmd.forwardmove > 0 || pm->cmd.forwardmove < 0
|| pm->cmd.rightmove > 0 || pm->cmd.rightmove < 0 ) ) {
float scale = PM_CmdScale( &pm->cmd );
float fmove, smove;
float vel;
int i;
Expand Down Expand Up @@ -1604,7 +1602,7 @@ static void PM_GroundTrace( void ) {
if ( ( pm->cmd.upmove > 0 || ( pm->ps->pm_flags & PMF_JUMP_HELD ) )
&& !( pm->ps->pm_flags & PMF_BLOCK ) // BFP - Don't increase the speed when blocking
&& pm->ps->weaponstate != WEAPON_BEAMFIRING // BFP - Don't increase speed when beam firing
&& pm->ps->powerups[PW_HASTE] > 0 || ( pm->cmd.buttons & BUTTON_KI_USE ) ) {
&& ( pm->ps->powerups[PW_HASTE] > 0 || ( pm->cmd.buttons & BUTTON_KI_USE ) ) ) {
pm->ps->velocity[0] *= 5;
pm->ps->velocity[1] *= 5;
}
Expand Down Expand Up @@ -1813,7 +1811,7 @@ PM_Footsteps
===============
*/
static void PM_Footsteps( void ) {
float bobmove;
float bobmove = 0.0f;
int old;
qboolean footstep;

Expand Down Expand Up @@ -2118,7 +2116,6 @@ static void PM_TorsoAnimation( void ) {
// Control the player depending their moves
if ( pm->cmd.forwardmove > 0 || pm->cmd.forwardmove < 0
|| pm->cmd.rightmove > 0 || pm->cmd.rightmove < 0 ) {
float scale = PM_CmdScale( &pm->cmd );
float fmove, smove;
float vel;
int i;
Expand Down Expand Up @@ -2390,7 +2387,7 @@ static void PM_HitStunAnimation( void ) { // BFP - Hit stun
}

// When the player doesn't have more ki, play hit stun animation
if ( pm->ps->ammo[WP_KI] <= 0 && !( pm->ps->pm_flags & PMF_HITSTUN )
if ( ( pm->ps->ammo[WP_KI] <= 0 && !( pm->ps->pm_flags & PMF_HITSTUN ) )
|| ( pm->ps->powerups[PW_FLIGHT] > 0 && pm->ps->ammo[WP_KI] <= 24 ) // BFP - TODO: Apply some timer if used any ki, if flying and has less ki, then hit stun (also BFP does that)
|| ( ( pm->cmd.buttons & BUTTON_ATTACK ) && ( pm->ps->pm_flags & PMF_HITSTUN ) ) ) {
pm->ps->pm_time = 1000;
Expand Down Expand Up @@ -2472,7 +2469,8 @@ Generates weapon events and modifes the weapon counter
==============
*/
static void PM_Weapon( void ) {
int addTime;
// BFP - TODO: Unused variable, remove for the future?
// int addTime;

// BFP - Hit stun, avoid shooting if the player is in this status
if ( pm->ps->pm_flags & PMF_HITSTUN ) {
Expand Down
13 changes: 5 additions & 8 deletions source/game/g_active.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,15 @@ void P_WorldEffects( gentity_t *ent ) {

envirosuit = ent->client->ps.powerups[PW_BATTLESUIT] > level.time;

waterlevel = ent->waterlevel;

// BFP - No drowning
#if 0
if ( ent->client->noclip ) {
ent->client->airOutTime = level.time + 12000; // don't need air
return;
}

waterlevel = ent->waterlevel;


//
// check for drowning
//
Expand Down Expand Up @@ -491,8 +490,9 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
int i, j;
int event;
gclient_t *client;
int damage;
vec3_t dir;
// BFP - Unused variables
// int damage;
// vec3_t dir;
vec3_t origin, angles;
// qboolean fired;
gitem_t *item;
Expand Down Expand Up @@ -1479,15 +1479,12 @@ while a slow client may have multiple ClientEndFrame between ClientThink.
*/
void ClientEndFrame( gentity_t *ent ) {
int i;
clientPersistant_t *pers;

if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
SpectatorClientEndFrame( ent );
return;
}

pers = &ent->client->pers;

// turn off any expired powerups
for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {
// BFP - Flight and haste are skipped, these are treated for player status
Expand Down
9 changes: 2 additions & 7 deletions source/game/g_combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ LookAtKiller
*/
void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) {
vec3_t dir;
vec3_t angles;

if ( attacker && attacker != self ) {
VectorSubtract (attacker->s.pos.trBase, self->s.pos.trBase, dir);
Expand All @@ -145,10 +144,6 @@ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker )
}

self->client->ps.stats[STAT_DEAD_YAW] = vectoyaw ( dir );

angles[YAW] = vectoyaw ( dir );
angles[PITCH] = 0;
angles[ROLL] = 0;
}

/*
Expand All @@ -157,11 +152,11 @@ GibEntity
==================
*/
void GibEntity( gentity_t *self, int killer ) {
// BFP - No EF_KAMIKAZE flag
#if 0
gentity_t *ent;
int i;

// BFP - No EF_KAMIKAZE flag
#if 0
//if this entity still has kamikaze
if (self->s.eFlags & EF_KAMIKAZE) {
// check if there is a kamikaze timer around for this owner
Expand Down
2 changes: 1 addition & 1 deletion source/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm );
void G_AddEvent( gentity_t *ent, int event, int eventParm );
void G_SetOrigin( gentity_t *ent, vec3_t origin );
void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
const char *BuildShaderStateConfig();
const char *BuildShaderStateConfig( void );

//
// g_combat.c
Expand Down
Loading

0 comments on commit a91bfd4

Please sign in to comment.