From ed4c4d83633bd5e9a9d8905f7ee783fded457d55 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 12 Mar 2024 05:28:58 -0700 Subject: [PATCH] Time Attack replays: let tally finish even if replay data ends during tally - If tally is skipped, the replay will be cut short - Just stop reading the demo if this happened after the tally started - It's okay to let the level continue without any input because the player already finished (we know the result) --- src/g_demo.cpp | 10 +++++++++- src/g_demo.h | 1 + src/p_tick.c | 14 +++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/g_demo.cpp b/src/g_demo.cpp index e1cf7c2d0..e9c089a56 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -3958,6 +3958,7 @@ void G_StopDemo(void) demobuf.buffer = NULL; demo.playback = false; demo.timing = false; + demo.waitingfortally = false; g_singletics = false; { @@ -3989,7 +3990,13 @@ boolean G_CheckDemoStatus(void) if (demo.quitafterplaying) I_Quit(); - if (!demo.attract) + // When this replay was recorded, the player skipped + // the Tally and ended the demo early. + // Keep the demo open and don't boot to intermission + // YET, pause demo playback. + if (!demo.waitingfortally && modeattacking && exitcountdown) + demo.waitingfortally = true; + else if (!demo.attract) G_FinishExitLevel(); else { @@ -4024,6 +4031,7 @@ boolean G_CheckDemoStatus(void) Z_Free(demobuf.buffer); demo.recording = false; + demo.waitingfortally = false; return false; } diff --git a/src/g_demo.h b/src/g_demo.h index 7a43d33c0..a7f99b241 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -90,6 +90,7 @@ struct demovars_s { boolean quitafterplaying; // quit after playing a demo from cmdline boolean deferstart; // don't start playing demo right away boolean netgame; // multiplayer netgame + boolean waitingfortally; // demo ended but we're keeping the level open for the tally to finish tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going boolean willsave; diff --git a/src/p_tick.c b/src/p_tick.c index c797e70df..55d051709 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -904,7 +904,7 @@ void P_Ticker(boolean run) if (playeringame[i]) G_WriteDemoTiccmd(&players[i].cmd, i); } - if (demo.playback) + if (demo.playback && !demo.waitingfortally) { G_ReadDemoExtraData(); for (i = 0; i < MAXPLAYERS; i++) @@ -1150,9 +1150,12 @@ void P_Ticker(boolean run) exitcountdown--; } - if (server && exitcountdown == 1) + if (exitcountdown == 1) { - SendNetXCmd(XD_EXITLEVEL, NULL, 0); + if (demo.playback) + G_FinishExitLevel(); + else if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); } } } @@ -1204,14 +1207,15 @@ void P_Ticker(boolean run) if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) G_CheckDemoTitleEntry(); } - else if (demo.playback) // Use Ghost data for consistency checks. + else if (demo.playback && !demo.waitingfortally) // Use Ghost data for consistency checks. { G_ConsAllGhostTics(); } if (modeattacking) { - G_GhostTicker(); + if (!demo.waitingfortally) + G_GhostTicker(); if (!demo.playback) G_TickTimeStickerMedals(); }