From ff38cfe1798e8713366bbbf56a950dec991e2748 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 Aug 2020 22:41:32 +0200 Subject: [PATCH] - open the in-game menu only when really inside a game and actually playing. Fixes #182 This isn't foolproof but it's probably the best that can be done. --- source/core/menu/menu.cpp | 9 +-------- source/games/duke/src/d_menu.cpp | 9 ++------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/source/core/menu/menu.cpp b/source/core/menu/menu.cpp index 0124f0313..d656f1724 100644 --- a/source/core/menu/menu.cpp +++ b/source/core/menu/menu.cpp @@ -1084,14 +1084,7 @@ CCMD(reset2saved) CCMD(menu_main) { M_StartControlPanel(true); - M_SetMenu(NAME_Mainmenu, -1); -} - -CCMD(openmainmenu) -{ - //gi->ClearSoundLocks(); - M_StartControlPanel(true); - M_SetMenu(NAME_IngameMenu); + M_SetMenu(gi->CanSave() ? NAME_IngameMenu : NAME_Mainmenu, -1); } CCMD(openhelpmenu) diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index ce5c42453..3570cdee5 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -269,15 +269,10 @@ void GameInterface::MenuClosed() bool GameInterface::CanSave() { - if (ud.recstat == 2) return false; + if (ud.recstat == 2 || gamestate != GS_LEVEL) return false; auto &myplayer = ps[myconnectindex]; - if (sprite[myplayer.i].extra <= 0) - { - //P_DoQuote(QUOTE_SAVE_DEAD, &myplayer); // handled by the menu. - return false; + return (sprite[myplayer.i].extra > 0); } - return true; -} void GameInterface::StartGame(FNewGameStartup& gs) {