From 9b1db55fb3f8b8348acafb6353bb396f3579ad8a Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 1 Dec 2025 21:02:35 +0100 Subject: [PATCH] properly throw player back to titlescreen from replay error fixes the game becoming stuck in limbo state if replay fails to start --- src/g_demo.c | 26 +++++++++++++------------- src/m_menu.c | 10 ++++++++++ src/m_menu.h | 1 + 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/g_demo.c b/src/g_demo.c index 54732b3bc..7cc8c4c77 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -2603,7 +2603,7 @@ void G_DoPlayDemo(char *defdemoname) snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname); CONS_Alert(CONS_ERROR, "%s", msg); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); return; } @@ -2615,7 +2615,7 @@ void G_DoPlayDemo(char *defdemoname) snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname); CONS_Alert(CONS_ERROR, "%s", msg); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); return; } else // it's an internal demo @@ -2635,7 +2635,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2661,7 +2661,7 @@ void G_DoPlayDemo(char *defdemoname) default: snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2672,7 +2672,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2689,7 +2689,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2747,7 +2747,7 @@ void G_DoPlayDemo(char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out. - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; @@ -2812,7 +2812,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2822,7 +2822,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2845,7 +2845,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2883,7 +2883,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2932,7 +2932,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } @@ -2944,7 +2944,7 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); G_ResetDemoPlayback(); return; } diff --git a/src/m_menu.c b/src/m_menu.c index 8655f69d3..2ca071905 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4827,6 +4827,16 @@ static boolean M_QuitReplayHut(void) return true; } +// same as M_QuitReplayHut, but calls M_StopMessage +void M_ReturnToTitleFromError(void) +{ + M_StopMessage(0); + // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. + menuactive = false; + D_StartTitle(); + M_ResetDemoList(); +} + static void M_HutStartReplay(INT32 choice) { (void)choice; diff --git a/src/m_menu.h b/src/m_menu.h index 552e09107..a0f15629e 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -312,6 +312,7 @@ void M_UpdateOGLMenu(void); void M_ResetDemoList(void); void M_ReplayHut(INT32 choice); +void M_ReturnToTitleFromError(void); void M_SetPlaybackMenuPointer(void); void Nextmap_OnChange(void);