From fda4e6542e033dadba293db0f34be28d56fc50bb Mon Sep 17 00:00:00 2001 From: skirlez Date: Mon, 20 Oct 2025 18:55:23 +0000 Subject: [PATCH] Save replay if map abruptly changes --- src/d_netcmd.c | 15 +++++++++++++++ src/g_demo.cpp | 1 + src/g_game.c | 3 +++ 3 files changed, 19 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index fe9cb5e7a..529fce0a9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3015,9 +3015,19 @@ static void Got_Mapcmd(const UINT8 **cp, INT32 playernum) CON_LogMessage(M_GetText("Speeding off to level...\n")); } + if (demo.playback && !demo.timing) precache = false; + + // Save demo in case map change happened after level finish + // (either manually with the map command, or with a redo vote) + // Isn't needed for time attack (and would also cause issues, as there + // G_RecordDemo (which sets demo.recording to true) is called before this runs) + if (demo.recording && modeattacking == ATTACKING_NONE) + G_CheckDemoStatus(); + + demo.willsave = (cv_recordmultiplayerdemos.value == 2); demo.savebutton = 0; @@ -5719,6 +5729,11 @@ static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum) memcpy(g_voteLevels, tempVoteLevels, sizeof(g_voteLevels)); + // admin can force vote state whenever + // so we have to save this replay if it needs to be saved + if (demo.recording) + G_CheckDemoStatus(); + G_SetGamestate(GS_VOTING); Y_StartVote(); } diff --git a/src/g_demo.cpp b/src/g_demo.cpp index f0df146b6..d3669d0ca 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -4212,6 +4212,7 @@ boolean G_CheckDemoStatus(void) if (modeattacking || demo.willsave) { + demo.willsave = false; if (demobuf.p) { G_SaveDemo(); diff --git a/src/g_game.c b/src/g_game.c index f3411f8e8..8faf2ad6b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5077,7 +5077,10 @@ void G_AfterIntermission(void) return; } else if (demo.recording && (modeattacking || demo.willsave)) + { + demo.willsave = false; G_SaveDemo(); + } else if (demo.recording) G_ResetDemoRecording();