diff --git a/complex2.cpp b/complex2.cpp index 1a954970..c7f35c6f 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -526,7 +526,7 @@ EX void count_status() { for(cell *c: currentmap->allcells()) if(among(c->wall, waMineMine, waMineUnknown) && mine::marked_mine(c)) kills[moTameBomberbird]++; if(last && !kills[moBomberbird]) { mine::victory_time = getgametime(); - pushScreen(showMission); + showMissionScreen(); } } diff --git a/control.cpp b/control.cpp index b124bf54..61fa1301 100644 --- a/control.cpp +++ b/control.cpp @@ -558,7 +558,7 @@ EX void handleKeyNormal(int sym, int uni) { else #endif if(needConfirmation()) - pushScreen(showMission); + pushScreen(showGameMenu); else restart_game(); } @@ -574,7 +574,7 @@ EX void handleKeyNormal(int sym, int uni) { if(daily::on) daily::handleQuit(2); else #endif - if(needConfirmation()) pushScreen(showMission); + if(needConfirmation()) pushScreen(showGameMenu); else quitmainloop = true; } @@ -592,10 +592,10 @@ EX void handleKeyNormal(int sym, int uni) { } if(sym == 'v' && DEFAULTNOR(sym)) - pushScreen(showMainMenu); + showMissionScreen(); if(sym == PSEUDOKEY_MENU) - pushScreen(showMainMenu); + showMissionScreen(); if(sym == PSEUDOKEY_NOHINT) no_find_player = true; diff --git a/menus.cpp b/menus.cpp index be14c85a..04429bac 100644 --- a/menus.cpp +++ b/menus.cpp @@ -207,121 +207,6 @@ EX void showOverview() { }; } -// -- main menu -- - -EX void showMainMenu() { - cancel(); cancel = noaction; - gamescreen(2); - - getcstat = ' '; - - dialog::init(XLAT("HyperRogue %1", VER), 0xC00000, 200, 100); - - dialog::addItem(XLAT("settings"), 's'); - dialog::add_action_push(showSettings); - dialog::addItem(XLAT("special modes"), 'm'); - -#if CAP_SAVE - dialog::addItem(XLAT("local highscores"), 't'); -#endif - dialog::addHelp(); - if(cheater) - dialog::addItem(XLAT("cheats"), 'c'); - else dialog::addBreak(100); - dialog::addItem(XLAT("restart game"), 'r'); - - dialog::addItem(inSpecialMode() ? XLAT("reset special modes") : XLAT("back to the start menu"), 'R'); - - string q; - #if ISMOBILE - dialog::addItem(XLAT("visit the website"), 'q'); - #else - q = quitsaves() ? XLAT("save the game") : XLAT("quit the game"); - dialog::addItem(q, 'q'); - #endif - - if(canmove) - q = XLAT("review your quest"); - else - q = XLAT("game over screen"); - dialog::addItem(q, SDLK_ESCAPE); - dialog::addItem(get_o_key().first, 'o'); - - if(inv::on) - dialog::addItem(XLAT("inventory"), 'i'); - -#if ISMOBILE -#if CAP_ACHIEVE - dialog::addItem(XLAT("leaderboards/achievements"), '3'); -#endif -#endif - -#if CAP_ANDROIDSHARE - dialog::addItem("SHARE", 's'-96); -#endif - - if(!canmove) q = XLAT("review the scene"); - else if(turncount > 0) q = XLAT("continue game"); - else q = XLAT("play the game!"); - - dialog::addItem(q, ' '); - dialog::display(); - - keyhandler = [] (int sym, int uni) { - dialog::handleNavigation(sym, uni); - if(sym == SDLK_F1 || uni == 'h') gotoHelp("@"); - else if(uni == 'c' && cheater) pushScreen(showCheatMenu); - else if(uni == 'm') pushScreen(showChangeMode); - else if(uni == 'R') dialog::do_if_confirmed([] { - #if CAP_STARTANIM - startanims::pick(); - #endif - popScreenAll(), pushScreen(showStartMenu); - }); - #if CAP_SAVE - else if(uni == 't') scores::load(); - #endif - else if(uni == 'r' || sym == SDLK_F5) dialog::do_if_confirmed([] { - restart_game(); - }); - else if(uni == 'q' || sym == SDLK_F10) { - if(needConfirmation()) dialog::do_if_confirmed([] { -#if ISMOBILE - extern void openURL(); - openURL(); -#else - quitmainloop = true; -#endif - }); - else quitmainloop = true; - } - else if(uni == 'o') { - clearMessages(); - get_o_key().second(); - } -#if CAP_INV - else if(uni == 'i') { - clearMessages(); - pushScreen(inv::show); - } -#endif - else if(sym == SDLK_ESCAPE) - showMissionScreen(); - #if ISMOBILE - #ifdef HAVE_ACHIEVEMENTS - else if(NUMBERKEY == '3') { - achievement_final(false); - pushScreen(leader::showMenu); - } - #endif - #endif - else if(doexiton(sym, uni)) { - popScreenAll(); - msgs.clear(); - } - }; - } - // -- display modes -- EX void editScale() { @@ -1094,7 +979,7 @@ EX void showStartMenu() { #endif else if(uni == 'm') { popScreen(); - pushScreen(showMainMenu); + pushScreen(showGameMenu); } else if(sym == SDLK_F10) quitmainloop = true; @@ -1262,7 +1147,7 @@ int read_menu_args() { PHASEFROM(2); launch_dialog(showOverview); } else if(argis("-d:main")) { - PHASEFROM(2); launch_dialog(showMainMenu); + PHASEFROM(2); launch_dialog(showGameMenu); } else if(argis("-d:mode")) { PHASEFROM(2); launch_dialog(showChangeMode); diff --git a/multi.cpp b/multi.cpp index 2ceef174..85a1b904 100644 --- a/multi.cpp +++ b/multi.cpp @@ -826,7 +826,7 @@ EX void handleInput(int delta) { #endif if(actionspressed[58] && !lactionpressed[58]) - pushScreen(showMainMenu); + pushScreen(showGameMenu); panx *= d; pany *= d; diff --git a/quit.cpp b/quit.cpp index d6712d9d..c22579be 100644 --- a/quit.cpp +++ b/quit.cpp @@ -313,10 +313,11 @@ eLand nextHyperstone() { return laCrossroads; } -EX void showMission() { +EX void showGameMenu() { cmode = sm::DOTOUR | sm::MISSION | sm::CENTER; gamescreen(1); drawStats(); + getcstat = SDLK_ESCAPE; dialog::init( #if CAP_TOUR @@ -329,8 +330,7 @@ EX void showMission() { XLAT("GAME OVER"), 0xC00000, 200, 100 ); - keyhandler = handleKeyQuit; - + #if CAP_COMPLEX2 bool sweeper = mine::in_minesweeper(); #else @@ -490,21 +490,25 @@ EX void showMission() { } else dialog::addBreak(200); - dialog::addItem(XLAT("main menu"), 'v'); dialog::addItem("continue", SDLK_ESCAPE); #endif } else { dialog::addItem(contstr(), SDLK_ESCAPE); - dialog::addItem(XLAT("main menu"), 'v'); - dialog::addItem(XLAT("restart"), SDLK_F5); - if(inv::on && items[itInventory]) + dialog::addItem(get_o_key().first, 'o'); + dialog::add_action([] { + clearMessages(); + get_o_key().second(); + }); + if(inv::on && items[itInventory]) { dialog::addItem(XLAT("inventory"), 'i'); + dialog::add_action([] { + clearMessages(); + pushScreen(inv::show); + }); + } if(racing::on) dialog::addItem(XLAT("racing menu"), 'o'); -#if !ISMOBILE - dialog::addItem(quitsaves() ? XLAT("save") : XLAT("quit"), SDLK_F10); -#endif if(casual || ISMOBILE) { if(savecount) dialog::addItem(XLAT("load (%1 turns passed)", its(turncount - save_turns)), SDLK_F9); @@ -517,6 +521,50 @@ EX void showMission() { } dialog::addItem(XLAT("message log"), 'l'); + if(cheater) { + dialog::addItem(XLAT("cheats"), 'c'); + dialog::add_action_push(showCheatMenu); + } + dialog::addItem(XLAT("settings"), 's'); + dialog::add_action_push(showSettings); + dialog::addItem(XLAT("special modes"), 'm'); + dialog::add_action_push(showChangeMode); +#if CAP_SAVE + dialog::addItem(XLAT("local highscores"), 't'); + dialog::add_action([] { scores::load(); }); +#endif + #if ISMOBILE + dialog::addItem(XLAT("visit the website"), 'q'); + dialog::add_action([] { + extern void openURL(); + openURL(); + }); + #endif +#if ISMOBILE +#if CAP_ACHIEVE + dialog::addItem(XLAT("leaderboards/achievements"), '3'); + dialog::add_action([] { + achievement_final(false); + pushScreen(leader::showMenu); + }); +#endif +#endif + dialog::addHelp(); + dialog::addItem(XLAT("restart"), SDLK_F5); + dialog::addItem(inSpecialMode() ? XLAT("reset special modes") : XLAT("back to the start menu"), 'R'); + dialog::add_action([] { + dialog::do_if_confirmed([] { + #if CAP_STARTANIM + startanims::pick(); + #endif + popScreenAll(), pushScreen(showStartMenu); + }); + }); +#if !ISMOBILE + dialog::addItem(quitsaves() ? XLAT("save") : XLAT("quit"), SDLK_F10); +#endif + + keyhandler = handleKeyQuit; dialog::display(); } @@ -558,7 +606,6 @@ EX void handleKeyQuit(int sym, int uni) { restart_game(rg::nothing); msgs.clear(); }); - else if(uni == 'v') popScreenAll(), pushScreen(showMainMenu); else if(uni == 'l') popScreenAll(), pushScreen(showMessageLog), messagelogpos = isize(gamelog); else if(uni == 'z') hints[hinttoshow].action(); #if CAP_SAVE @@ -611,7 +658,7 @@ EX void showMissionScreen() { #endif } else - pushScreen(showMission); + pushScreen(showGameMenu); #if CAP_TOUR if(!tour::on)