1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

improvements to start menu: can be called from main menu; resets all special modes; selecting shmup allows you to configure keys immediately

This commit is contained in:
Zeno Rogue 2017-12-03 19:51:45 +01:00
parent cc97572654
commit 3e6baf4e21
3 changed files with 47 additions and 17 deletions

View File

@ -4,6 +4,9 @@
videopar vid;
#define DEFAULT_WALLMODE ISMOBILE ? 3 : 5
#define DEFAULT_MONMODE ISMOBILE ? 2 : 4
#if ISANDROID
#define ANDROID_SETTINGS settingsChanged = true;
#else
@ -236,8 +239,8 @@ void initConfig() {
addsaver(vid.yshift, "Y shift", 0);
addsaver(vid.camera_angle, "camera angle", 0);
addsaver(vid.ballproj, "ballproj", 1);
addsaver(vid.monmode, "monster display mode", ISMOBILE ? 2 : 4);
addsaver(vid.wallmode, "wall display mode", ISMOBILE ? 3 : 5);
addsaver(vid.monmode, "monster display mode", DEFAULT_MONMODE);
addsaver(vid.wallmode, "wall display mode", DEFAULT_WALLMODE);
addsaver(geom3::depth, "3D depth");
addsaver(geom3::camera, "3D camera level");
@ -317,21 +320,39 @@ void initConfig() {
#endif
}
void resetModes() {
bool inSpecialMode() {
return chaosmode || nontruncated || peace::on || tour::on ||
yendor::on || tactic::on || randomPatternsMode ||
geometry != gNormal || pmodel != mdDisk || vid.alpha != 1 || vid.scale != 1 ||
rug::rugged || vid.monmode != DEFAULT_MONMODE ||
vid.wallmode != DEFAULT_WALLMODE;
}
void resetModes(char leave = 'c') {
popAllGames();
firstland = laIce; vid.scfg.players = 1;
if(shmup::on) restartGame('s');
if(inv::on) restartGame('i');
if(chaosmode) restartGame('C');
if(nontruncated) restartGame('7');
if(peace::on) restartGame('P');
if(shmup::on != (leave == 's')) restartGame('s');
if(inv::on != (leave == 'i')) restartGame('i');
if(chaosmode != (leave == 'C')) restartGame('C');
if(nontruncated != (leave == '7')) restartGame('7');
if(peace::on != (leave == 'P')) restartGame('P');
#if CAP_TOUR
if(tour::on) restartGame('T');
if(tour::on != (leave == 'T')) restartGame('T');
#endif
if(yendor::on) restartGame('y');
if(tactic::on) restartGame('t');
if(randomPatternsMode) restartGame('r');
if(geometry != gNormal) { targetgeometry = gNormal; restartGame('g'); }
if(yendor::on != (leave == 'y')) restartGame('y');
if(tactic::on != (leave == 't')) restartGame('t');
if(randomPatternsMode != (leave == 'r')) restartGame('r');
if(geometry != gNormal && leave != 'g') {
targetgeometry = gNormal;
restartGame('g');
}
pmodel = mdDisk; vid.alpha = 1; vid.scale = 1;
if(rug::rugged) rug::close();
vid.monmode = DEFAULT_MONMODE;
vid.wallmode = DEFAULT_WALLMODE;
}
#if CAP_CONFIG

View File

@ -2279,3 +2279,4 @@ ld realradius();
void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch);
void glcolor2(int color);
void showStartMenu();

View File

@ -211,6 +211,8 @@ void showMainMenu() {
else dialog::addBreak(100);
dialog::addItem(XLAT("restart game"), 'r'); dialog::lastItem().keycaption += " / F5";
dialog::addItem(XLAT(inSpecialMode() ? "reset special modes" : "back to the start menu"), 'R');
string q;
#if ISMOBILE==1
dialog::addItem(XLAT("visit the website"), 'q');
@ -259,10 +261,12 @@ void showMainMenu() {
else if(sym == 'g') pushScreen(showGraphConfig);
else if(sym == 'd') pushScreen(showDisplayMode);
else if(sym == 'm') pushScreen(showChangeMode);
else if(uni == 'R')
popScreenAll(), pushScreen(showStartMenu);
#if CAP_SAVE
else if(sym == 't') scores::load();
#endif
else if(sym == 'r' || sym == SDLK_F5) {
else if(uni == 'r' || sym == SDLK_F5) {
restartGame();
}
else if(sym == 'q' || sym == SDLK_F10) {
@ -629,15 +633,18 @@ void showStartMenu() {
if(uni == 'o') uni = 'i';
if(uni == 'c' || uni == 'i' || uni == 's') {
popScreenAll();
if(inv::on != (uni == 'i')) restartGame('i');
if(shmup::on != (uni == 's')) restartGame('s');
resetModes(uni);
clearMessages();
welcomeMessage();
stampbase = ticks;
if(uni == 's') {
multi::shmupcfg = shmup::on;
pushScreen(multi::showShmupConfig);
}
}
else if(uni == 'z') {
popScreenAll();
resetModes();
resetModes('g');
stampbase = ticks;
if(!sphere) {
specialland = laHalloween;
@ -650,6 +657,7 @@ void showStartMenu() {
#if CAP_TOUR
else if(uni == 't') {
popScreenAll();
resetModes('c');
tour::start();
}
#endif