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

Improve quit-to-menu menu handling

This stabilizes the code that handles the menu that you land on if you
press Esc and quit to the menu.

Instead of using Game::returnmenu(), we now use the new function
Game::returntomenu() to clearly express intent that we want to return to
a specific menu. So I've added another kludge variable
Game::wasinintermission for the was-in-intermission case.

Also, I made it so that if you didn't have a main game telesave or
quicksave, you just get brought back to the main menu. Because you
shouldn't be able to go to the play menu without a quicksave or
telesave.
This commit is contained in:
Misa 2020-04-25 19:21:23 -07:00 committed by Ethan Lee
parent 536184f394
commit 9fca3e111f
4 changed files with 22 additions and 6 deletions

View file

@ -1345,11 +1345,28 @@ void Game::updatestate()
//or "who do you want to play the level with?" //or "who do you want to play the level with?"
//or "do you want cutscenes?" //or "do you want cutscenes?"
//or the confirm-load-quicksave menu //or the confirm-load-quicksave menu
if ((!wasintimetrial && !wasincustommode) || currentmenuname == Menu::quickloadlevel) if (wasintimetrial)
{ {
returnmenu(); returntomenu(Menu::timetrials);
}
else if (wasinintermission)
{
returntomenu(Menu::intermissionmenu);
}
else if (wasincustommode)
{
returntomenu(Menu::levellist);
}
else if (game.telesummary != "" || game.quicksummary != "")
{
returntomenu(Menu::play);
}
else
{
createmenu(Menu::mainmenu);
} }
wasintimetrial = false; wasintimetrial = false;
wasinintermission = false;
wasincustommode = false; wasincustommode = false;
state = 0; state = 0;
break; break;

View file

@ -236,6 +236,7 @@ public:
//Menu kludge... //Menu kludge...
bool wasintimetrial; bool wasintimetrial;
bool wasinintermission;
bool wasincustommode; bool wasincustommode;

View file

@ -1961,6 +1961,7 @@ void mapinput()
FillRect(graphics.tempBuffer, 0x000000); FillRect(graphics.tempBuffer, 0x000000);
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true; if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
game.wasintimetrial = game.intimetrial; game.wasintimetrial = game.intimetrial;
game.wasinintermission = game.inintermission;
game.wasincustommode = map.custommode; game.wasincustommode = map.custommode;
script.hardreset(); script.hardreset();
if(graphics.setflipmode) graphics.flipmode = true; if(graphics.setflipmode) graphics.flipmode = true;

View file

@ -3471,10 +3471,7 @@ void editorlogic()
map.nexttowercolour(); map.nexttowercolour();
ed.settingsmod=false; ed.settingsmod=false;
graphics.backgrounddrawn=false; graphics.backgrounddrawn=false;
//Do returnmenu twice because we have two menus: game.returntomenu(Menu::playerworlds);
//the main editor menu and the confirm save&quit menu
game.returnmenu();
game.returnmenu();
} }
} }