From 6582801dc903b545a7e7b6ddd29cce084d8bc410 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 22 Jun 2020 17:23:56 -0700 Subject: [PATCH] Save current menu to temp variable when entering options from in-game This is to pre-emptively prevent piling up stack frames for what I'll be adding next, which is pressing Esc in the options menu in-game automatically moving you back to MAPMODE. --- desktop_version/src/Game.cpp | 1 + desktop_version/src/Game.h | 1 + desktop_version/src/Input.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 903a574e..604207b9 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -390,6 +390,7 @@ void Game::init(void) over30mode = false; ingame_titlemode = false; + kludge_ingametemp = Menu::mainmenu; /* Terry's Patrons... */ const char* superpatrons_arr[] = { diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 1cb4a549..ec2789c5 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -216,6 +216,7 @@ public: std::vector menuoptions; int currentmenuoption ; enum Menu::MenuName currentmenuname; + enum Menu::MenuName kludge_ingametemp; int current_credits_list_index; int menuxoff, menuyoff; std::vector menustack; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index f78ad935..d11aa832 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -375,15 +375,16 @@ void menuactionpress() default: //back music.playef(11); - game.returnmenu(); if (game.ingame_titlemode) { game.ingame_titlemode = false; + game.returntomenu(game.kludge_ingametemp); game.gamestate = MAPMODE; map.kludge_to_bg(); } else { + game.returnmenu(); map.nexttowercolour(); } break; @@ -590,15 +591,16 @@ void menuactionpress() { //back music.playef(11); - game.returnmenu(); if (game.ingame_titlemode) { game.ingame_titlemode = false; + game.returntomenu(game.kludge_ingametemp); game.gamestate = MAPMODE; map.kludge_to_bg(); } else { + game.returnmenu(); map.nexttowercolour(); } } @@ -2122,6 +2124,7 @@ void mapmenuactionpress() game.createmenu(Menu::options); } map.bg_to_kludge(); + game.kludge_ingametemp = game.currentmenuname; map.nexttowercolour(); map.scrolldir = 0;