Merge branch 'allow-replay-saving-map-change' into 'master'

Save replay if map abruptly changes

Closes #316, #276, and #242

See merge request kart-krew-dev/ring-racers!63
This commit is contained in:
Eidolon 2025-10-20 13:55:23 -05:00
commit 303401aea5
3 changed files with 19 additions and 0 deletions

View file

@ -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();
}

View file

@ -4212,6 +4212,7 @@ boolean G_CheckDemoStatus(void)
if (modeattacking || demo.willsave)
{
demo.willsave = false;
if (demobuf.p)
{
G_SaveDemo();

View file

@ -5079,7 +5079,10 @@ void G_AfterIntermission(void)
return;
}
else if (demo.recording && (modeattacking || demo.willsave))
{
demo.willsave = false;
G_SaveDemo();
}
else if (demo.recording)
G_ResetDemoRecording();