diff --git a/src/f_finale.c b/src/f_finale.c index 683b5c9cb..f968c183f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1168,7 +1168,6 @@ void F_GameEndTicker(void) void F_InitMenuPresValues(void) { menuanimtimer = 0; - M_ClearMenus(false); // TODO maybe call exit funcs here? but that triggers an infinite loop in replay hut... // Set defaults for presentation values strncpy(curbgname, "TITLESKY", 9); diff --git a/src/g_demo.c b/src/g_demo.c index dc326811d..00489ec34 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -2992,11 +2992,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } demobuf.p += 12; // DEMOHEADER @@ -3012,11 +3012,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } @@ -3030,11 +3030,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } @@ -3094,12 +3094,12 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out. + M_StartMessage(msg, NULL, MM_NOTHING); return; } } @@ -3138,11 +3138,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } @@ -3166,11 +3166,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } @@ -3217,11 +3217,11 @@ void G_DoPlayDemo(char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with %s, and is thus invalid.\n"), pdemoname, (bot ? "bots" : "spectators")); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } } @@ -3233,11 +3233,11 @@ 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); Z_Free(pdemoname); P_SaveBufferFree(&demobuf); demo.playback = false; demo.title = false; + M_StartMessage(msg, NULL, MM_NOTHING); return; } @@ -4019,7 +4019,7 @@ boolean G_CheckDemoStatus(void) G_StopDemo(); if (modeattacking) - M_EndModeAttackRun(); + M_ModeAttackEndGame(0); else D_AdvanceDemo(); } diff --git a/src/g_game.c b/src/g_game.c index 2edfb01e2..f88cedf51 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -646,7 +646,7 @@ void G_SetGameModified(boolean silent, boolean major) // If in record attack recording, cancel it. if (modeattacking) - M_EndModeAttackRun(); + M_ModeAttackEndGame(0); else if (marathonmode) Command_ExitGame_f(); } @@ -4062,7 +4062,7 @@ void G_AfterIntermission(void) if (modeattacking) // End the run. { - M_EndModeAttackRun(); + M_ModeAttackEndGame(0); return; } diff --git a/src/m_menu.c b/src/m_menu.c index 4784a3117..4a70c7a59 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1315,22 +1315,15 @@ boolean M_Responder(event_t *ev) //case KEY_JOY1 + 2: noFurtherInput = true; currentMenu->lastOn = itemOn; - if (menustack[0] == MN_SP_TIMEATTACK) + + //If we entered the game search menu, but didn't enter a game, + //make sure the game doesn't still think we're in a netgame. + if (!Playing() && netgame && multiplayer) { - // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. - D_StartTitle(); - } - else - { - //If we entered the game search menu, but didn't enter a game, - //make sure the game doesn't still think we're in a netgame. - if (!Playing() && netgame && multiplayer) - { - netgame = false; - multiplayer = false; - } - M_ExitMenu(); + netgame = false; + multiplayer = false; } + M_ExitMenu(); return true; @@ -1655,11 +1648,6 @@ void M_StartControlPanel(void) CON_ToggleOff(); // move away console } -void M_EndModeAttackRun(void) -{ - M_ModeAttackEndGame(0); -} - // // M_ClearMenus // @@ -1676,6 +1664,10 @@ void M_ClearMenus(boolean callexitmenufunc) memset(menustack, 0, sizeof(menustack)); currentMenu = NULL; hidetitlemap = false; + + // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. + if (gamestate == GS_TIMEATTACK) + D_StartTitle(); } // @@ -4004,8 +3996,7 @@ void M_QuitReplayHut(INT32 choice) { (void)choice; - // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. - D_StartTitle(); + M_ClearMenus(false); if (demolist) Z_Free(demolist); @@ -4302,11 +4293,14 @@ void M_PlaybackQuit(INT32 choice) M_ReplayHut(choice); else if (modeattacking) { - M_EndModeAttackRun(); + M_ModeAttackEndGame(0); S_ChangeMusicInternal("racent", true); } else + { + M_ClearMenus(true); D_StartTitle(); + } } void M_PandorasBox(INT32 choice) @@ -5842,7 +5836,6 @@ void M_HandleStaffReplay(INT32 choice) if (l == LUMPERROR) break; M_ClearMenus(true); - modeattacking = (levellistmode == LLM_ITEMBREAKER ? ATTACKING_ITEMBREAK : ATTACKING_TIME); demo.loadfiles = false; demo.ignorefiles = true; // Just assume that record attack replays have the files needed G_DoPlayDemo(va("%sS%02u",G_BuildMapName(cv_nextmap.value),cv_dummystaff.value)); break; @@ -5859,7 +5852,6 @@ void M_ReplayTimeAttack(INT32 choice) const char *which; const char *gamemode = (levellistmode == LLM_ITEMBREAKER) ? "IB" : "RA"; M_ClearMenus(true); - modeattacking = (levellistmode == LLM_ITEMBREAKER ? ATTACKING_ITEMBREAK : ATTACKING_TIME); // set modeattacking before G_DoPlayDemo so the map loader knows demo.loadfiles = false; demo.ignorefiles = true; // Just assume that record attack replays have the files needed switch(choice) { @@ -5976,13 +5968,8 @@ void M_ModeAttackEndGame(INT32 choice) if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING) Command_ExitGame_f(); - M_StartControlPanel(); - - if (modeattacking) - { - M_ClearMenus(true); - M_EnterMenu(MN_SP_TIMEATTACK, true); - } + M_ClearMenus(true); + M_EnterMenu(MN_SP_TIMEATTACK, true); G_SetGamestate(GS_TIMEATTACK); modeattacking = ATTACKING_NONE; diff --git a/src/m_menu.h b/src/m_menu.h index a1a155529..71a9164d1 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -120,9 +120,6 @@ void M_InitCharacterTables(void); // does nothing if menu is already up. void M_StartControlPanel(void); -// Called upon end of a mode attack run -void M_EndModeAttackRun(void); - // Called on new server add, or other reasons void M_SortServerList(void);