From d8ad0b4eaaff2e10a4ba4075906d4942d67a4348 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 8 Nov 2019 15:47:12 +0000 Subject: [PATCH] STOP THE CLOCK linedef exectutor! * When activated, stops the timer in SP/MP. * Applies to the mapheader countdowntimer as well. * If you're playing Record Attack, also exits the level immediately. * It has no special modes, no linedef flags, no parameters, nothing. * Only not an innate property of A_BossDeath because people may want it to NOT happen sometimes, or make it happen with non-boss events too. Also, skip over calling P_DoPlayerExit if the player isn't in game. --- extras/conf/SRB2-22.cfg | 6 ++++++ src/p_enemy.c | 10 ++++++++++ src/p_mobj.h | 1 + src/p_saveg.c | 36 +++++++++++++++++++++++++----------- src/p_setup.c | 1 + src/p_spec.c | 23 +++++++++++++++++++++++ src/p_tick.c | 2 +- src/p_user.c | 4 ++-- src/st_stuff.c | 10 ++++++---- 9 files changed, 75 insertions(+), 18 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index de5b2ea6c..79d65054d 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -2182,6 +2182,12 @@ linedeftypes prefix = "(461)"; flags64text = "[6] Spawn inside a range"; } + + 462 + { + title = "Stop timer/exit stage in Record Attack"; + prefix = "(462)"; + } } linedefexecmisc diff --git a/src/p_enemy.c b/src/p_enemy.c index cc2d64e8b..0d696437a 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3910,10 +3910,16 @@ void A_BossDeath(mobj_t *mo) // victory! P_LinedefExecute(LE_ALLBOSSESDEAD, mo, NULL); + if (stoppedclock && modeattacking) // if you're just time attacking, skip making the capsule appear since you don't need to step on it anyways. + goto bossjustdie; if (mo->flags2 & MF2_BOSSNOTRAP) { for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; P_DoPlayerExit(&players[i]); + } } else { @@ -10414,7 +10420,11 @@ void A_ForceWin(mobj_t *actor) return; for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; P_DoPlayerExit(&players[i]); + } } // Function: A_SpikeRetract diff --git a/src/p_mobj.h b/src/p_mobj.h index 94fcc2987..e560a4a81 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -475,4 +475,5 @@ extern boolean runemeraldmanager; extern UINT16 emeraldspawndelay; extern INT32 numstarposts; extern UINT16 bossdisabled; +extern boolean stoppedclock; #endif diff --git a/src/p_saveg.c b/src/p_saveg.c index fb2365bf0..470d3096e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3981,7 +3981,6 @@ static inline void P_UnArchiveSPGame(INT16 mapoverride) static void P_NetArchiveMisc(void) { - UINT32 pig = 0; INT32 i; WRITEUINT32(save_p, ARCHIVEBLOCK_MISC); @@ -3989,9 +3988,12 @@ static void P_NetArchiveMisc(void) WRITEINT16(save_p, gamemap); WRITEINT16(save_p, gamestate); - for (i = 0; i < MAXPLAYERS; i++) - pig |= (playeringame[i] != 0)<= 4*TICRATE) && --countdowntimer <= 0) + if (countdowntimer && G_PlatformGametype() && (gametype == GT_COOP || leveltime >= 4*TICRATE) && !stoppedclock && --countdowntimer <= 0) { countdowntimer = 0; countdowntimeup = true; diff --git a/src/p_user.c b/src/p_user.c index 561183cd5..8b04596f3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9377,7 +9377,7 @@ static void P_DeathThink(player_t *player) if (gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame))) { // Keep time rolling in race mode - if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_GAMETYPEOVER)) + if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_GAMETYPEOVER) && !stoppedclock) { if (gametype == GT_RACE || gametype == GT_COMPETITION) { @@ -11333,7 +11333,7 @@ void P_PlayerThink(player_t *player) } // Synchronizes the "real" amount of time spent in the level. - if (!player->exiting) + if (!player->exiting && !stoppedclock) { if (gametype == GT_RACE || gametype == GT_COMPETITION) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 392cb1c03..737a1852f 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -707,7 +707,7 @@ static void ST_drawTime(void) { if (timelimitintics >= stplyr->realtime) { - tics = (timelimitintics - stplyr->realtime); + tics = (timelimitintics + (TICRATE-1) - stplyr->realtime); if (tics < 3*TICRATE) ST_drawRaceNum(tics); } @@ -740,10 +740,12 @@ static void ST_drawTime(void) if (F_GetPromptHideHud(hudinfo[HUD_TIME].y)) return; - // TIME: - ST_DrawPatchFromHud(HUD_TIME, ((downwards && (tics < 30*TICRATE) && (leveltime/5 & 1)) ? sboredtime : sbotime), V_HUDTRANS); + downwards = (downwards && (tics < 30*TICRATE) && (leveltime/5 & 1) && !stoppedclock); // overtime? - if (!tics && downwards && (leveltime/5 & 1)) // overtime! + // TIME: + ST_DrawPatchFromHud(HUD_TIME, (downwards ? sboredtime : sbotime), V_HUDTRANS); + + if (downwards) // overtime! return; if (cv_timetic.value == 3) // Tics only -- how simple is this?