Skip to content

Commit 264b9f9

Browse files
committed
Minor code cleanup with variables
1 parent d3c4702 commit 264b9f9

6 files changed

Lines changed: 14 additions & 13 deletions

File tree

code/cgame/cg_draw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,6 @@ static void CG_DrawObits(void)
16981698
static float textHeight, spaceWidth;
16991699
const float textScale = 0.15f;
17001700
altObit_t *p;
1701-
int i = 0;
17021701

17031702
if (!cg.snap)
17041703
return;
@@ -1711,7 +1710,7 @@ static void CG_DrawObits(void)
17111710

17121711
y = cg_killFeedY.value;
17131712

1714-
for (i = 0, p = cg.obits; p < cg.obits + cg.numObits; i++, p++) {
1713+
for (p = cg.obits; p < cg.obits + cg.numObits; p++) {
17151714
const char *modstr = CG_GetObitString(p->mod);
17161715

17171716
if (p->victim >= MAX_CLIENTS)

code/cgame/cg_localents.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,15 +969,16 @@ void CG_MatchPredictedEnt(centity_t* cent) {
969969
localEntity_t* match = NULL;
970970
float best = SQR(32);
971971
vec3_t diff;
972+
int i;
972973

973974
// Can only match entities we own.
974975
if (!CG_PredictedMissilesEnabled() ||
975976
cent->currentState.clientNum != cg.snap->ps.clientNum)
976977
return;
977978

978-
for (int i = 0; i < num_predicted_ents; i++) {
979+
for (i = 0; i < num_predicted_ents; i++) {
979980
localEntity_t* le = predicted_ents[i];
980-
float len;
981+
float len = SQR(64);
981982

982983
if (cent->currentState.eType == ET_MISSILE) {
983984
VectorSubtract(cent->lerpOrigin, le->lerp.trBase, diff);
@@ -1007,8 +1008,9 @@ void CG_MatchPredictedEnt(centity_t* cent) {
10071008

10081009
void CG_UpdateLocalPredictedEnts(void) {
10091010
float now = cg.time + 1000 / cgs.sv_fps;
1011+
int i;
10101012

1011-
for (int i = 0; i < num_predicted_ents; i++) {
1013+
for (i = 0; i < num_predicted_ents; i++) {
10121014
localEntity_t* le = predicted_ents[i];
10131015
vec3_t next;
10141016
trace_t trace;
@@ -1235,5 +1237,3 @@ void CG_AddLocalEntities( void ) {
12351237
// CG_PositionSunflares();
12361238
//}
12371239
}
1238-
1239-

code/cgame/cg_newdraw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,6 +3252,7 @@ void CG_Q3F_DrawHUDIcons(rectDef_t *rect, float tscale, vec4_t color, int textSt
32523252
Com_sprintf(buf, sizeof(buf), "%d", (int)t/1000);
32533253
y += (h - CG_Text_Height(buf, tscale, 0, font)) / 2;
32543254

3255+
// TODO put the reverse'd text on left hand side of the icon as well
32553256
CG_Text_Paint(x + text_x + (w/2) + 7, y + text_y + 2, tscale, colorWhite, buf, 0, 0, textStyle, font, textalignment);
32563257
}
32573258
}

code/cgame/cg_q3f_flare.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void CG_RenderSunflares( void ) {
522522
*gFlareFadeTime = cg.time;
523523

524524
// fade it in a bit
525-
if( *gFlareFadeValue < 1 ) {
525+
if( gFlareFadeValue && *gFlareFadeValue < 1 ) {
526526
fadeValue = cg.time - *gFlareFadeTime;
527527
fadeValue *= (float)FLARE_FADE_SPEED;
528528
*gFlareFadeValue += fadeValue;
@@ -535,7 +535,7 @@ void CG_RenderSunflares( void ) {
535535
*gFlareFadeTime = -1 * cg.time;
536536

537537
// fade it out a bit
538-
if( *gFlareFadeValue > 0 ) {
538+
if( gFlareFadeValue && *gFlareFadeValue > 0 ) {
539539
fadeValue = cg.time + *gFlareFadeTime; // add because time is negative
540540
fadeValue *= (float)FLARE_FADE_SPEED;
541541
*gFlareFadeValue -= fadeValue;

code/game/g_active.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ void ClientTimerActions( gentity_t *ent ) {
549549
const char *dataptr;
550550
gentity_t *other;
551551
int data;
552+
int i;
552553

553554
client = ent->client;
554555

@@ -770,7 +771,7 @@ void ClientTimerActions( gentity_t *ent ) {
770771
G_Q3F_Check_Maladies(ent);
771772

772773
// turn off any expired powerups
773-
for (int i = 0 ; i < MAX_POWERUPS ; i++ ) {
774+
for (i = 0 ; i < MAX_POWERUPS ; i++ ) {
774775
if ( ent->client->ps.powerups[ i ] && ent->client->ps.powerups[ i ] < level.time ) {
775776
switch( i )
776777
{
@@ -1107,7 +1108,7 @@ void ClientThink_real( gentity_t *ent ) {
11071108
if ( ucmd->serverTime < level.time - 1000 ) {
11081109
ucmd->serverTime = level.time - 1000;
11091110
// G_Printf("serverTime >>>>>\n" );
1110-
}
1111+
}
11111112

11121113
// frameOffset should be about the number of milliseconds into a frame
11131114
// this command packet was received, depending on how fast the server

code/game/g_q3f_eventlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ static void Q_FSWriteJSON( cJSON *object, fileHandle_t f ) {
111111

112112
// TODO implement the milliseconds from qwtf-live
113113
//
114-
static const char *ISOTimemills(void) {
114+
/*static const char *ISOTimemills(void) {
115115
static char timeuse[64] = { 0 };
116116
qtime_t now;
117117
trap_RealTime( &now );
118118
Com_sprintf(timeuse, sizeof(timeuse), "%d-%02d-%02dT%02d:%02d:%02d.%dZ", now.tm_year + 1900, now.tm_mon + 1, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec, 100);
119119
return timeuse;
120-
}
120+
}*/
121121

122122
void G_EventLog_PlayerStart( gentity_t *player ) {
123123
cJSON *root;

0 commit comments

Comments
 (0)