From 99d9d4452b6737c40d7fe303c289b870cb498d3c Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 20 Aug 2023 14:55:54 -0700 Subject: [PATCH] Offline: intermission doesn't move automatically, skip with A button - Press A button the first time to do the card flip. - Press A button a second time to end the intermission. - Will not end literally immediately, in order to let tally sounds finish and GP progression bar animate. --- src/y_inter.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 391d0861b..6c980a7ee 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -71,6 +71,7 @@ static patch_t *widebgpatch = NULL; static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK static patch_t *interpic = NULL; // custom picture defined in map header +#define INFINITE_TIMER (INT16_MAX) // just some arbitrarily large value that won't easily overflow static INT32 timer; static INT32 powertype = PWRLV_DISABLED; @@ -86,6 +87,16 @@ intertype_t intertype = int_none; static huddrawlist_h luahuddrawlist_intermission; +static boolean Y_CanSkipIntermission(void) +{ + if (!netgame) + { + return true; + } + + return false; +} + static void Y_UnloadData(void); // @@ -1533,6 +1544,17 @@ finalcounter: } } + if (Y_CanSkipIntermission()) + { + K_drawButton( + 2*FRACUNIT, + (BASEVIDHEIGHT - 16)*FRACUNIT, + 0, + kp_button_a[1], + M_MenuConfirmHeld(0) + ); + } + else { const INT32 tickDown = (timer + 1)/TICRATE; @@ -1578,6 +1600,46 @@ void Y_Ticker(void) LUA_HOOK(IntermissionThinker); + if (Y_CanSkipIntermission()) + { + if (M_MenuConfirmPressed(0)) + { + // If there is a roundqueue, make time for it. + // Else, end instantly on button press. + // Actually, give it a slight delay, so the "kaching" sound isn't cut off. + const tic_t end = roundqueue.size != 0 ? 3*TICRATE : TICRATE; + + if (intertic == -1) // card flip hasn't started + { + if (sorttic != -1) + { + intertic = sorttic; + } + else + { + intertic = 0; + timer = end; + } + } + else if (timer >= INFINITE_TIMER && intertic >= sorttic + 16) // card done flipping + { + const INT32 kaching = sorttic + 16 + (2*TICRATE); + + if (intertic < kaching) + { + intertic = kaching; // kaching immediately + } + + timer = end; + } + } + + if (intertic == -1) + { + return; + } + } + intertic++; // Team scramble code for team match and CTF. @@ -1590,7 +1652,7 @@ void Y_Ticker(void) P_DoTeamscrambling(); }*/ - if ((timer && !--timer) + if ((timer < INFINITE_TIMER && --timer <= 0) || (intertic == endtic)) { Y_EndIntermission(); @@ -1665,6 +1727,12 @@ void Y_Ticker(void) r++; data.jitter[data.num[q]] = 1; + // Player can skip the tally, kaching! + if (Y_CanSkipIntermission() && timer < INFINITE_TIMER) + { + data.increase[data.num[q]] = 0; + } + if (powertype != PWRLV_DISABLED) { // Power Levels @@ -1815,6 +1883,21 @@ void Y_StartIntermission(void) sorttic = max((timer/2) - 2*TICRATE, 2*TICRATE); } + // TODO: code's a mess, I'm just making it extra clear + // that this piece of code is supposed to take priority + // over the above. :) + if (Y_CanSkipIntermission()) + { + timer = INFINITE_TIMER; // doesn't count down + + if (sorttic != -1) + { + // Will start immediately, but must be triggered. + // Needs to be TICRATE to bypass a condition in Y_Ticker. + sorttic = TICRATE; + } + } + // We couldn't display the intermission even if we wanted to. // But we still need to give the players their score bonuses, dummy. //if (dedicated) return;