1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

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.
This commit is contained in:
Misa 2020-06-22 17:23:56 -07:00 committed by Ethan Lee
parent 75326ca2ee
commit 6582801dc9
3 changed files with 7 additions and 2 deletions

View file

@ -390,6 +390,7 @@ void Game::init(void)
over30mode = false; over30mode = false;
ingame_titlemode = false; ingame_titlemode = false;
kludge_ingametemp = Menu::mainmenu;
/* Terry's Patrons... */ /* Terry's Patrons... */
const char* superpatrons_arr[] = { const char* superpatrons_arr[] = {

View file

@ -216,6 +216,7 @@ public:
std::vector<MenuOption> menuoptions; std::vector<MenuOption> menuoptions;
int currentmenuoption ; int currentmenuoption ;
enum Menu::MenuName currentmenuname; enum Menu::MenuName currentmenuname;
enum Menu::MenuName kludge_ingametemp;
int current_credits_list_index; int current_credits_list_index;
int menuxoff, menuyoff; int menuxoff, menuyoff;
std::vector<MenuStackFrame> menustack; std::vector<MenuStackFrame> menustack;

View file

@ -375,15 +375,16 @@ void menuactionpress()
default: default:
//back //back
music.playef(11); music.playef(11);
game.returnmenu();
if (game.ingame_titlemode) if (game.ingame_titlemode)
{ {
game.ingame_titlemode = false; game.ingame_titlemode = false;
game.returntomenu(game.kludge_ingametemp);
game.gamestate = MAPMODE; game.gamestate = MAPMODE;
map.kludge_to_bg(); map.kludge_to_bg();
} }
else else
{ {
game.returnmenu();
map.nexttowercolour(); map.nexttowercolour();
} }
break; break;
@ -590,15 +591,16 @@ void menuactionpress()
{ {
//back //back
music.playef(11); music.playef(11);
game.returnmenu();
if (game.ingame_titlemode) if (game.ingame_titlemode)
{ {
game.ingame_titlemode = false; game.ingame_titlemode = false;
game.returntomenu(game.kludge_ingametemp);
game.gamestate = MAPMODE; game.gamestate = MAPMODE;
map.kludge_to_bg(); map.kludge_to_bg();
} }
else else
{ {
game.returnmenu();
map.nexttowercolour(); map.nexttowercolour();
} }
} }
@ -2122,6 +2124,7 @@ void mapmenuactionpress()
game.createmenu(Menu::options); game.createmenu(Menu::options);
} }
map.bg_to_kludge(); map.bg_to_kludge();
game.kludge_ingametemp = game.currentmenuname;
map.nexttowercolour(); map.nexttowercolour();
map.scrolldir = 0; map.scrolldir = 0;