mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Add being able to press Esc to return to previous menu
This is a small quality-of-life thing that makes it so you don't have to move your menu selection all the way over to the "return" button in order to return to the previous menu. You can just press Escape instead to return to the previous menu. The previous behavior of pressing Escape was to bring up the 'confirm quit' menu, or if you were in an options menu in-game, return to the pause menu. If you're on the main menu (and thus don't have any previous menu) and press Escape, the game will instead bring up the 'confirm quit' menu. For consistency, the "quit game" option on the main menu will also bring up the 'confirm quit' menu as well, instead of immediately closing the game. Pressing the controller button mapped to Escape will also work as well. The only menus that don't have return buttons are the 'countdown' menus - so the game will not let you press Escape if there's a menu countdown happening. Now that pressing Escape in the 'continue' menu will just bring you back to the 'play' menu, there's no need to specifically put map.nexttowercolour() first when canceling the 'confirm quit' menu.
This commit is contained in:
parent
61e5b819e4
commit
fc8c7d034d
2 changed files with 47 additions and 19 deletions
|
@ -261,10 +261,9 @@ static void menuactionpress(void)
|
||||||
#define MPOFFSET -2
|
#define MPOFFSET -2
|
||||||
#endif
|
#endif
|
||||||
case OFFSET+5:
|
case OFFSET+5:
|
||||||
//bye!
|
music.playef(11);
|
||||||
music.playef(2);
|
game.createmenu(Menu::youwannaquit);
|
||||||
game.mainmenu = 100;
|
map.nexttowercolour();
|
||||||
graphics.fademode = 2;
|
|
||||||
break;
|
break;
|
||||||
#undef OFFSET
|
#undef OFFSET
|
||||||
#undef NOCUSTOMSOFFSET
|
#undef NOCUSTOMSOFFSET
|
||||||
|
@ -477,8 +476,8 @@ static void menuactionpress(void)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
music.playef(11);
|
music.playef(11);
|
||||||
map.nexttowercolour(); //This goes first, otherwise mismatching continuemenu color is possible
|
|
||||||
game.returnmenu();
|
game.returnmenu();
|
||||||
|
map.nexttowercolour();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Menu::setinvincibility:
|
case Menu::setinvincibility:
|
||||||
|
@ -1610,28 +1609,40 @@ void titleinput(void)
|
||||||
if (key.isDown(KEYBOARD_ENTER)) game.press_map = true;
|
if (key.isDown(KEYBOARD_ENTER)) game.press_map = true;
|
||||||
|
|
||||||
//In the menu system, all keypresses are single taps rather than holds. Therefore this test has to be done for all presses
|
//In the menu system, all keypresses are single taps rather than holds. Therefore this test has to be done for all presses
|
||||||
if (!game.press_action && !game.press_left && !game.press_right) game.jumpheld = false;
|
if (!game.press_action && !game.press_left && !game.press_right && !key.isDown(27) && !key.isDown(game.controllerButton_esc)) game.jumpheld = false;
|
||||||
if (!game.press_map) game.mapheld = false;
|
if (!game.press_map) game.mapheld = false;
|
||||||
|
|
||||||
if (!game.jumpheld && graphics.fademode==0)
|
if (!game.jumpheld && graphics.fademode==0)
|
||||||
{
|
{
|
||||||
if (game.press_action || game.press_left || game.press_right || game.press_map)
|
if (game.press_action || game.press_left || game.press_right || game.press_map || key.isDown(27) || key.isDown(game.controllerButton_esc))
|
||||||
{
|
{
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.isDown(27) && game.currentmenuname != Menu::youwannaquit && game.menustart)
|
if (game.menustart
|
||||||
|
&& game.menucountdown <= 0
|
||||||
|
&& (key.isDown(27) || key.isDown(game.controllerButton_esc)))
|
||||||
{
|
{
|
||||||
music.playef(11);
|
music.playef(11);
|
||||||
if (game.ingame_titlemode)
|
if (game.currentmenuname == Menu::mainmenu)
|
||||||
{
|
{
|
||||||
game.returntopausemenu();
|
game.createmenu(Menu::youwannaquit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
game.createmenu(Menu::youwannaquit);
|
if (game.ingame_titlemode
|
||||||
map.nexttowercolour();
|
&& (game.currentmenuname == Menu::options
|
||||||
|
|| game.currentmenuname == Menu::graphicoptions))
|
||||||
|
{
|
||||||
|
game.returntopausemenu();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
game.returnmenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map.nexttowercolour();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(game.menustart)
|
if(game.menustart)
|
||||||
|
|
|
@ -3928,7 +3928,30 @@ void editorinput(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ed.settingsmod=!ed.settingsmod;
|
music.playef(11);
|
||||||
|
if (ed.settingsmod)
|
||||||
|
{
|
||||||
|
if (ed.scripteditmod)
|
||||||
|
{
|
||||||
|
ed.scripteditmod = false;
|
||||||
|
}
|
||||||
|
else if (ed.settingsmod)
|
||||||
|
{
|
||||||
|
if (game.currentmenuname == Menu::ed_settings)
|
||||||
|
{
|
||||||
|
ed.settingsmod = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
game.returnmenu();
|
||||||
|
map.nexttowercolour();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ed.settingsmod = true;
|
||||||
|
}
|
||||||
graphics.backgrounddrawn=false;
|
graphics.backgrounddrawn=false;
|
||||||
|
|
||||||
if (ed.settingsmod)
|
if (ed.settingsmod)
|
||||||
|
@ -4037,12 +4060,6 @@ void editorinput(void)
|
||||||
key.keybuffer=ed.sb[ed.pagey+ed.sby];
|
key.keybuffer=ed.sb[ed.pagey+ed.sby];
|
||||||
ed.sbx = utf8::unchecked::distance(ed.sb[ed.pagey+ed.sby].begin(), ed.sb[ed.pagey+ed.sby].end());
|
ed.sbx = utf8::unchecked::distance(ed.sb[ed.pagey+ed.sby].begin(), ed.sb[ed.pagey+ed.sby].end());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.isDown(27))
|
|
||||||
{
|
|
||||||
ed.scripteditmod=false;
|
|
||||||
ed.settingsmod=false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ed.scripthelppage==1)
|
else if(ed.scripthelppage==1)
|
||||||
|
|
Loading…
Reference in a new issue