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)
This commit is contained in:
James R 2024-03-12 05:28:58 -07:00
parent 29ba47459c
commit ed4c4d8363
3 changed files with 19 additions and 6 deletions

View file

@ -3958,6 +3958,7 @@ void G_StopDemo(void)
demobuf.buffer = NULL; demobuf.buffer = NULL;
demo.playback = false; demo.playback = false;
demo.timing = false; demo.timing = false;
demo.waitingfortally = false;
g_singletics = false; g_singletics = false;
{ {
@ -3989,7 +3990,13 @@ boolean G_CheckDemoStatus(void)
if (demo.quitafterplaying) if (demo.quitafterplaying)
I_Quit(); 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(); G_FinishExitLevel();
else else
{ {
@ -4024,6 +4031,7 @@ boolean G_CheckDemoStatus(void)
Z_Free(demobuf.buffer); Z_Free(demobuf.buffer);
demo.recording = false; demo.recording = false;
demo.waitingfortally = false;
return false; return false;
} }

View file

@ -90,6 +90,7 @@ struct demovars_s {
boolean quitafterplaying; // quit after playing a demo from cmdline boolean quitafterplaying; // quit after playing a demo from cmdline
boolean deferstart; // don't start playing demo right away boolean deferstart; // don't start playing demo right away
boolean netgame; // multiplayer netgame 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 tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going
boolean willsave; boolean willsave;

View file

@ -904,7 +904,7 @@ void P_Ticker(boolean run)
if (playeringame[i]) if (playeringame[i])
G_WriteDemoTiccmd(&players[i].cmd, i); G_WriteDemoTiccmd(&players[i].cmd, i);
} }
if (demo.playback) if (demo.playback && !demo.waitingfortally)
{ {
G_ReadDemoExtraData(); G_ReadDemoExtraData();
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
@ -1150,9 +1150,12 @@ void P_Ticker(boolean run)
exitcountdown--; 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) if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime)
G_CheckDemoTitleEntry(); 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(); G_ConsAllGhostTics();
} }
if (modeattacking) if (modeattacking)
{ {
G_GhostTicker(); if (!demo.waitingfortally)
G_GhostTicker();
if (!demo.playback) if (!demo.playback)
G_TickTimeStickerMedals(); G_TickTimeStickerMedals();
} }