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

Pull the game.press_action conditional out of all the if-statements

No need to repeat yourself if you can just surround the whole thing in
an 'if (game.press_action)' block, which is much easier.
This commit is contained in:
Misa 2020-06-22 15:32:21 -07:00 committed by Ethan Lee
parent 13cc7b2a4b
commit 5717afaa37

View file

@ -1975,7 +1975,10 @@ void mapinput()
game.menupage++;
}
mapmenuactionpress();
if (game.press_action)
{
mapmenuactionpress();
}
if (game.menupage < 0) game.menupage = 3;
if (game.menupage > 3 && game.menupage < 9) game.menupage = 0;
@ -1993,7 +1996,7 @@ void mapinput()
void mapmenuactionpress()
{
if (game.menupage == 1 && obj.flags[67] && game.press_action && !game.insecretlab && !map.custommode)
if (game.menupage == 1 && obj.flags[67] && !game.insecretlab && !map.custommode)
{
//Warp back to the ship
graphics.resumegamemode = true;
@ -2017,7 +2020,7 @@ void mapmenuactionpress()
game.statedelay = 0;
}
if (game.menupage == 3 && !game.gamesaved && game.press_action && !game.intimetrial
if (game.menupage == 3 && !game.gamesaved && !game.intimetrial
&& !game.nodeathmode && !game.insecretlab && !game.inintermission)
{
game.flashlight = 5;
@ -2043,12 +2046,12 @@ void mapmenuactionpress()
}
}
if (game.menupage == 10 && game.press_action)
if (game.menupage == 10)
{
//return to game
graphics.resumegamemode = true;
}
if (game.menupage == 11 && game.press_action)
if (game.menupage == 11)
{
//quit to menu
@ -2062,12 +2065,12 @@ void mapmenuactionpress()
game.fadetomenudelay = 16;
}
if (game.menupage == 20 && game.press_action)
if (game.menupage == 20)
{
//return to game
graphics.resumegamemode = true;
}
if (game.menupage == 21 && game.press_action)
if (game.menupage == 21)
{
//quit to menu
game.swnmode = false;