From 266a590a14c410b6fa83cbb87192b930fd0d198d Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 31 Mar 2019 19:26:53 -0500 Subject: [PATCH] Return to replay hut after watching a replay --- src/g_game.c | 7 ++++++- src/g_game.h | 1 + src/m_menu.c | 13 ++++++------- src/m_menu.h | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e56362b6..bf28425c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3856,7 +3856,12 @@ void G_AfterIntermission(void) if (demo.playback) { G_StopDemo(); - D_StartTitle(); + + if (demo.inreplayhut) + M_ReplayHut(0); + else + D_StartTitle(); + return; } else if (demo.recording && demo.savemode != DSM_NOTSAVING) diff --git a/src/g_game.h b/src/g_game.h index af85bd02..324af06b 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -46,6 +46,7 @@ struct demovars_s { boolean loadfiles, ignorefiles; // Demo file loading options boolean fromtitle; // SRB2Kart: Don't stop the music + boolean inreplayhut; // Go back to replayhut after demos boolean quitafterplaying; // quit after playing a demo from cmdline boolean deferstart; // don't start playing demo right away diff --git a/src/m_menu.c b/src/m_menu.c index 7e8c3638..0942f1ee 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -338,7 +338,6 @@ static patch_t *addonsp[NUM_EXT+5]; // Replay hut menu_t MISC_ReplayHutDef; -static void M_ReplayHut(INT32 choice); static void M_HandleReplayHutList(INT32 choice); static void M_DrawReplayHut(void); static void M_DrawReplayStartMenu(void); @@ -5065,7 +5064,6 @@ menudemo_t *demolist; #define DF_ENCORE 0x40 static INT16 replayScrollTitle = 0; static INT8 replayScrollDelay = TICRATE, replayScrollDir = 1; -static boolean inreplayhut = false; static void PrepReplayList(void) { @@ -5097,11 +5095,11 @@ static void PrepReplayList(void) } } -static void M_ReplayHut(INT32 choice) +void M_ReplayHut(INT32 choice) { (void)choice; - if (!inreplayhut) + if (!demo.inreplayhut) { snprintf(menupath, 1024, "%s"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home); menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath); @@ -5111,12 +5109,13 @@ static void M_ReplayHut(INT32 choice) M_StartMessage("No replays found.\n\n(Press a key)\n", NULL, MM_NOTHING); return; } - else if (!inreplayhut) + else if (!demo.inreplayhut) dir_on[menudepthleft] = 0; - inreplayhut = true; + demo.inreplayhut = true; PrepReplayList(); + menuactive = true; M_SetupNextMenu(&MISC_ReplayHutDef); G_SetGamestate(GS_TIMEATTACK); @@ -5505,7 +5504,7 @@ static boolean M_QuitReplayHut(void) Z_Free(demolist); demolist = NULL; - inreplayhut = false; + demo.inreplayhut = false; return true; } diff --git a/src/m_menu.h b/src/m_menu.h index 33dc1e40..f49c6ca6 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -235,6 +235,8 @@ void Screenshot_option_Onchange(void); // Addons menu updating void Addons_option_Onchange(void); +void M_ReplayHut(INT32 choice); + INT32 HU_GetHighlightColor(void); // These defines make it a little easier to make menus