From 37c733b8c22be5d72daea1a7e6cfc7ea76e753d9 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 11 Mar 2020 07:37:33 +0100 Subject: [PATCH] More explicit var names for countdown and countdown2 --- src/dehacked.c | 4 ++-- src/doomstat.h | 2 +- src/g_game.c | 4 ++-- src/k_kart.c | 4 ++-- src/lua_baselib.c | 4 ++-- src/p_inter.c | 8 ++++---- src/p_saveg.c | 8 ++++---- src/p_setup.c | 2 +- src/p_tick.c | 12 ++++++------ src/p_user.c | 18 +++++++++--------- src/st_stuff.c | 4 ++-- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index d6d54b6f..05a8e1b1 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9931,10 +9931,10 @@ static inline int lib_getenum(lua_State *L) lua_pushinteger(L, cv_numlaps.value); return 1; } else if (fastcmp(word,"racecountdown")) { - lua_pushinteger(L, countdown); + lua_pushinteger(L, racecountdown); return 1; } else if (fastcmp(word,"exitcountdown")) { - lua_pushinteger(L, countdown2); // This name is pretty dumb. Hence why we'll prefer more descriptive names at least in Lua... + lua_pushinteger(L, exitcountdown); // This name is pretty dumb. Hence why we'll prefer more descriptive names at least in Lua... return 1; } return 0; diff --git a/src/doomstat.h b/src/doomstat.h index 1f855da2..b9488bc9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -448,7 +448,7 @@ extern UINT8 maxXtraLife; // Max extra lives from rings extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations // For racing -extern UINT32 countdown, countdown2; +extern tic_t racecountdown, exitcountdown; extern fixed_t gravity; extern fixed_t mapobjectscale; diff --git a/src/g_game.c b/src/g_game.c index b8a1a3bf..678633ce 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -233,7 +233,7 @@ mobj_t *hunt1; mobj_t *hunt2; mobj_t *hunt3; -UINT32 countdown, countdown2; // for racing +tic_t racecountdown, exitcountdown; // for racing fixed_t gravity; fixed_t mapobjectscale; @@ -4583,7 +4583,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool { // Clear a bunch of variables tokenlist = token = sstimer = redscore = bluescore = lastmap = 0; - countdown = countdown2 = mapreset = 0; + racecountdown = exitcountdown = mapreset = 0; for (i = 0; i < MAXPLAYERS; i++) { diff --git a/src/k_kart.c b/src/k_kart.c index 10d772ba..5a026285 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8910,9 +8910,9 @@ void K_drawKartHUD(void) if (leveltime >= starttime-(3*TICRATE) && leveltime < starttime+TICRATE) K_drawKartStartCountdown(); - else if (countdown && (!splitscreen || !stplyr->exiting)) + else if (racecountdown && (!splitscreen || !stplyr->exiting)) { - char *countstr = va("%d", countdown/TICRATE); + char *countstr = va("%d", racecountdown/TICRATE); if (splitscreen > 1) V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 672b4574..32cbbf4f 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2645,7 +2645,7 @@ static int lib_kGetItemPatch(lua_State *L) static int lib_kSetRaceCountdown(lua_State *L) { tic_t c = (tic_t)luaL_checkinteger(L, 1); - countdown = c; + racecountdown = c; return 0; } @@ -2654,7 +2654,7 @@ static int lib_kSetExitCountdown(lua_State *L) { tic_t c = (tic_t)luaL_checkinteger(L, 1); NOHUD - countdown2 = c; + exitcountdown = c; return 0; } diff --git a/src/p_inter.c b/src/p_inter.c index a910445d..abb12811 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2036,7 +2036,7 @@ boolean P_CheckRacers(void) if (i == MAXPLAYERS) // finished { - countdown = countdown2 = 0; + racecountdown = exitcountdown = 0; return true; } @@ -2063,13 +2063,13 @@ boolean P_CheckRacers(void) if (j == MAXPLAYERS) // finish anyways, force a time over { P_DoTimeOver(&players[i]); - countdown = countdown2 = 0; + racecountdown = exitcountdown = 0; return true; } } } - if (!countdown) // Check to see if the winners have finished, to set countdown. + if (!racecountdown) // Check to see if the winners have finished, to set countdown. { UINT8 numingame = 0, numexiting = 0; UINT8 winningpos = 1; @@ -2088,7 +2088,7 @@ boolean P_CheckRacers(void) winningpos++; if (numexiting >= winningpos) - countdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going! + racecountdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going! } return false; diff --git a/src/p_saveg.c b/src/p_saveg.c index 7d2e9a30..5bbba1f2 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3264,8 +3264,8 @@ static void P_NetArchiveMisc(void) WRITEINT16(save_p, scrambletotal); WRITEINT16(save_p, scramblecount); - WRITEUINT32(save_p, countdown); - WRITEUINT32(save_p, countdown2); + WRITEUINT32(save_p, racecountdown); + WRITEUINT32(save_p, exitcountdown); WRITEFIXED(save_p, gravity); WRITEFIXED(save_p, mapobjectscale); @@ -3373,8 +3373,8 @@ static inline boolean P_NetUnArchiveMisc(void) scrambletotal = READINT16(save_p); scramblecount = READINT16(save_p); - countdown = READUINT32(save_p); - countdown2 = READUINT32(save_p); + racecountdown = READUINT32(save_p); + exitcountdown = READUINT32(save_p); gravity = READFIXED(save_p); mapobjectscale = READFIXED(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index bf13971b..7814b02b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2344,7 +2344,7 @@ static void P_LevelInitStuff(void) players[i].lives = 1; // SRB2Kart #endif - players[i].realtime = countdown = countdown2 = 0; + players[i].realtime = racecountdown = exitcountdown = 0; curlap = bestlap = 0; // SRB2Kart players[i].gotcontinue = false; diff --git a/src/p_tick.c b/src/p_tick.c index 2502c721..0327091e 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -715,15 +715,15 @@ void P_Ticker(boolean run) } } - if (countdown > 1) - countdown--; + if (racecountdown > 1) + racecountdown--; - if (countdown2) - countdown2--; + if (exitcountdown > 1) + exitcountdown--; - if (indirectitemcooldown) + if (indirectitemcooldown > 1) indirectitemcooldown--; - if (hyubgone) + if (hyubgone > 1) hyubgone--; if (G_BattleGametype()) diff --git a/src/p_user.c b/src/p_user.c index ced8b2da..bf3deda2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1726,8 +1726,8 @@ void P_DoPlayerExit(player_t *player) P_EndingMusic(player); // SRB2kart 120217 - //if (!countdown2) - //countdown2 = countdown + 8*TICRATE; + //if (!exitcountdown) + //exitcountdown = racecountdown + 8*TICRATE; if (P_CheckRacers()) player->exiting = raceexittime+1; @@ -7087,7 +7087,7 @@ static void P_DeathThink(player_t *player) } // Keep time rolling - if (!(countdown2 && !countdown) && !(player->exiting || mapreset) && !(player->pflags & PF_TIMEOVER)) + if (!(exitcountdown && !racecountdown) && !(player->exiting || mapreset) && !(player->pflags & PF_TIMEOVER)) { if (leveltime >= starttime) { @@ -8057,8 +8057,8 @@ void P_DoTimeOver(player_t *player) P_EndingMusic(player); - if (!countdown2) - countdown2 = 5*TICRATE; + if (!exitcountdown) + exitcountdown = 5*TICRATE; } // @@ -8201,7 +8201,7 @@ void P_PlayerThink(player_t *player) // begin the drown music for countdown! // SRB2Kart: despite how perfect this is, it's disabled FOR A REASON - /*if (countdown == 11*TICRATE - 1) + /*if (racecountdown == 11*TICRATE - 1) { if (P_IsLocalPlayer(player)) S_ChangeMusicInternal("drown", false); @@ -8209,7 +8209,7 @@ void P_PlayerThink(player_t *player) // If you've hit the countdown and you haven't made // it to the exit, you're a goner! - else if (countdown == 1 && !player->exiting && !player->spectator && player->lives > 0) + else if (racecountdown == 1 && !player->exiting && !player->spectator && player->lives > 0) { P_DoTimeOver(player); @@ -8223,10 +8223,10 @@ void P_PlayerThink(player_t *player) if (player->exiting > 1 && (player->exiting < raceexittime+2 || !G_RaceGametype())) // SRB2kart - "&& player->exiting > 1" player->exiting--; - if (player->exiting && countdown2) + if (player->exiting && exitcountdown) player->exiting = 99; // SRB2kart - if (player->exiting == 2 || countdown2 == 2) + if (player->exiting == 2 || exitcountdown == 2) { if (cv_playersforexit.value) // Count to be sure everyone's exited { diff --git a/src/st_stuff.c b/src/st_stuff.c index 50bac3ee..76680133 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1834,7 +1834,7 @@ static void ST_overlayDrawer(void) { patch_t *p; - if (countdown == 1) + if (racecountdown == 1) p = timeover; else p = sboover; @@ -1954,7 +1954,7 @@ static void ST_overlayDrawer(void) if (!hu_showscores && netgame && !mapreset) { - /*if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1) + /*if (G_GametypeUsesLives() && stplyr->lives <= 0 && racecountdown != 1) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press Viewpoint Key to watch a player.")); else if (gametype == GT_HIDEANDSEEK && (!stplyr->spectator && !(stplyr->pflags & PF_TAGIT)) && (leveltime > hidetime * TICRATE))