1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-20 11:54:48 +00:00

unified the Quest screen and Main menu.

This commit is contained in:
Zeno Rogue 2022-06-16 23:54:47 +02:00
parent f196d706a6
commit e6d0c0c803
5 changed files with 67 additions and 135 deletions

View File

@ -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();
}
}

View File

@ -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;

119
menus.cpp
View File

@ -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);

View File

@ -826,7 +826,7 @@ EX void handleInput(int delta) {
#endif
if(actionspressed[58] && !lactionpressed[58])
pushScreen(showMainMenu);
pushScreen(showGameMenu);
panx *= d;
pany *= d;

View File

@ -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)