Merge branch 'retry-end-demo' into 'master'

Simpler solution to #1225: If a retry flag occurs in a demo, stop playback immediately!

See merge request KartKrew/Kart!2230
This commit is contained in:
Sal 2024-04-06 23:27:08 +00:00
commit 1ff321d375

View file

@ -1798,11 +1798,25 @@ void G_Ticker(boolean run)
P_MapStart();
if (gamestate == GS_LEVEL)
if (gamestate == GS_LEVEL && G_GetRetryFlag())
{
if (demo.playback == true)
{
// Stop playback!!
G_ClearRetryFlag();
// G_CheckDemoStatus() called here fails an I_Assert in g_party.cpp Console()!?
// I'm sure there's a completely logical explanation and an elegant solution
// where we can defer some sort of state change. However I'm tired, I've been
// looking after my niece, my arm hurts a bit when using mouse/keyboard, and
// we are ALMOST DONE. So I'm going to bodge this for the sake of release.
// The minimal set of calls to dump you back to the menu as soon as possible
// will have to do, so that everybody can have fun racing as rings. ~toast 050424
G_StopDemo();
Command_ExitGame_f();
}
else
{
// Or, alternatively, retry.
if (G_GetRetryFlag())
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
@ -3125,10 +3139,11 @@ void G_FinishExitLevel(void)
if (gamestate == GS_LEVEL)
{
const boolean worknetgame = (demo.playback ? demo.netgame : netgame);
if (g_exit.retry)
{
// Restart cup here whenever we do Online GP
if (!netgame)
if (!worknetgame)
{
// We have lives, just redo this one course.
G_SetRetryFlag();
@ -3137,11 +3152,18 @@ void G_FinishExitLevel(void)
}
else if (g_exit.losing)
{
// We were in a Special Stage.
// Were we in a Special Stage?
// We can still progress to the podium when we game over here.
const boolean special = grandprixinfo.gp == true && grandprixinfo.cup != NULL && grandprixinfo.eventmode == GPEVENT_SPECIAL;
if (!netgame && !special)
if (demo.playback && !worknetgame)
{
// Guarantee conclusion to Sealed Star replay
G_SetRetryFlag();
return;
}
if (!worknetgame && !special)
{
// Back to the menu with you.
G_HandleSaveLevel(true);