1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +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; videopar vid;
#define DEFAULT_WALLMODE ISMOBILE ? 3 : 5
#define DEFAULT_MONMODE ISMOBILE ? 2 : 4
#if ISANDROID #if ISANDROID
#define ANDROID_SETTINGS settingsChanged = true; #define ANDROID_SETTINGS settingsChanged = true;
#else #else
@ -236,8 +239,8 @@ void initConfig() {
addsaver(vid.yshift, "Y shift", 0); addsaver(vid.yshift, "Y shift", 0);
addsaver(vid.camera_angle, "camera angle", 0); addsaver(vid.camera_angle, "camera angle", 0);
addsaver(vid.ballproj, "ballproj", 1); addsaver(vid.ballproj, "ballproj", 1);
addsaver(vid.monmode, "monster display mode", ISMOBILE ? 2 : 4); addsaver(vid.monmode, "monster display mode", DEFAULT_MONMODE);
addsaver(vid.wallmode, "wall display mode", ISMOBILE ? 3 : 5); addsaver(vid.wallmode, "wall display mode", DEFAULT_WALLMODE);
addsaver(geom3::depth, "3D depth"); addsaver(geom3::depth, "3D depth");
addsaver(geom3::camera, "3D camera level"); addsaver(geom3::camera, "3D camera level");
@ -317,21 +320,39 @@ void initConfig() {
#endif #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(); popAllGames();
firstland = laIce; vid.scfg.players = 1; firstland = laIce; vid.scfg.players = 1;
if(shmup::on) restartGame('s'); if(shmup::on != (leave == 's')) restartGame('s');
if(inv::on) restartGame('i'); if(inv::on != (leave == 'i')) restartGame('i');
if(chaosmode) restartGame('C'); if(chaosmode != (leave == 'C')) restartGame('C');
if(nontruncated) restartGame('7'); if(nontruncated != (leave == '7')) restartGame('7');
if(peace::on) restartGame('P'); if(peace::on != (leave == 'P')) restartGame('P');
#if CAP_TOUR #if CAP_TOUR
if(tour::on) restartGame('T'); if(tour::on != (leave == 'T')) restartGame('T');
#endif #endif
if(yendor::on) restartGame('y'); if(yendor::on != (leave == 'y')) restartGame('y');
if(tactic::on) restartGame('t'); if(tactic::on != (leave == 't')) restartGame('t');
if(randomPatternsMode) restartGame('r'); if(randomPatternsMode != (leave == 'r')) restartGame('r');
if(geometry != gNormal) { targetgeometry = gNormal; restartGame('g'); }
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 #if CAP_CONFIG

View File

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

View File

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