From e24ae3f71790883f8fda67ae734269bbab4e5b8e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 24 Mar 2018 16:00:13 +0100 Subject: [PATCH] shmup replaced with random special mode in start menu; use current settings in the start menu --- config.cpp | 28 +++++++++++- hyper.h | 2 + menus.cpp | 130 +++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 139 insertions(+), 21 deletions(-) diff --git a/config.cpp b/config.cpp index 397e5e77..73aec449 100644 --- a/config.cpp +++ b/config.cpp @@ -4,8 +4,8 @@ videopar vid; -#define DEFAULT_WALLMODE ISMOBILE ? 3 : 5 -#define DEFAULT_MONMODE ISMOBILE ? 2 : 4 +#define DEFAULT_WALLMODE (ISMOBILE ? 3 : 5) +#define DEFAULT_MONMODE (ISMOBILE ? 2 : 4) #if ISANDROID #define ANDROID_SETTINGS settingsChanged = true; @@ -359,6 +359,30 @@ bool inSpecialMode() { vid.wallmode != DEFAULT_WALLMODE; } +bool have_current_settings() { + int modecount = 0; + if(inv::on) modecount++; + if(shmup::on) modecount += 10; + if(tour::on) modecount += 10; + if(chaosmode) modecount += 10; + if(nonbitrunc) modecount += 10; + if(peace::on) modecount += 10; + if(yendor::on) modecount += 10; + if(tactic::on) modecount += 10; + if(randomPatternsMode) modecount += 10; + if(geometry != gNormal) modecount += 10; + + if(vid.xposition || vid.yposition || vid.alpha != 1 || vid.scale != 1) + return true; + if(pmodel != mdDisk || vid.monmode != DEFAULT_MONMODE || vid.wallmode != DEFAULT_WALLMODE) + return true; + if(firstland != laIce || vid.scfg.players != 1 || rug::rugged) + return true; + if(modecount > 1) + return true; + return false; + } + void resetModes(char leave) { popAllGames(); firstland = laIce; vid.scfg.players = 1; diff --git a/hyper.h b/hyper.h index bfaf6c2f..c39270b7 100644 --- a/hyper.h +++ b/hyper.h @@ -2870,3 +2870,5 @@ ld hypot2(const hyperpoint& h); transmatrix pushxto0(const hyperpoint& H); transmatrix rpushxto0(const hyperpoint& H); transmatrix spintox(const hyperpoint& H); + +extern int ewhichscreen; diff --git a/menus.cpp b/menus.cpp index cc81d8f8..ad20d18e 100644 --- a/menus.cpp +++ b/menus.cpp @@ -421,6 +421,15 @@ void switchHardcore() { if(pureHardcore()) popScreenAll(); } +void help_nochaos() { + gotoHelp( + "In the Chaos mode, lands change very often, and " + "there are no walls between them. " + "Some lands are incompatible with this." + "\n\nYou need to reach Crossroads IV to unlock the Chaos mode." + ); + } + void showChangeMode() { gamescreen(3); dialog::init(XLAT("special game modes")); @@ -509,12 +518,7 @@ void showChangeMode() { #endif else if(uni == 'C') { if(chaosUnlocked) restartGame('C'); - if(chaosmode) gotoHelp( - "In the Chaos mode, lands change very often, and " - "there are no walls between them. " - "Some lands are incompatible with this." - "\n\nYou need to reach Crossroads IV to unlock the Chaos mode." - ); + if(chaosmode) help_nochaos(); } else if(xuni == 'P') { if(!princess::everSaved) @@ -565,7 +569,15 @@ bool showHalloween() { return false; } +int daily; + void showStartMenu() { + if(!daily) { + daily = hrand(10) + 1; + if(showHalloween()) + daily = 20; + } + gamescreen(2); getcstat = ' '; @@ -585,31 +597,73 @@ void showStartMenu() { dialog::addInfo(XLAT("use your Orbs in tough situations")); #endif -#if CAP_SHMUP_GOOD - dialog::addBreak(100); - dialog::addBigItem(XLAT("shoot'em up mode"), 's'); - dialog::addInfo(XLAT("continuous spacetime")); -#if CAP_ACHIEVE - dialog::addInfo(XLAT("(most achievements are not available)")); -#endif -#endif - #if CAP_TOUR dialog::addBreak(100); dialog::addBigItem(XLAT("tutorial"), 't'); dialog::addInfo(XLAT("learn about hyperbolic geometry!")); #endif + switch(daily) { + case 1: + #if CAP_SHMUP_GOOD + dialog::addBreak(100); + dialog::addBigItem(XLAT("shoot'em up mode"), 's'); + dialog::addInfo(XLAT("continuous spacetime")); + #if CAP_ACHIEVE + dialog::addInfo(XLAT("(most achievements are not available)")); + #endif + #endif + break; + + case 2: + dialog::addBreak(100); + dialog::addBigItem(XLAT("heptagonal mode"), '7'); + dialog::addInfo(XLAT("more curvature")); + dialog::addInfo(XLAT("(most achievements are not available)")); + break; + + case 3: + dialog::addBreak(100); + dialog::addBigItem(XLAT("geometry experiments"), 'g'); + dialog::addInfo(XLAT("(most achievements are not available)")); + break; + + case 4: + if(chaosUnlocked) { + dialog::addBreak(100); + dialog::addBigItem(XLAT("Chaos mode"), 'C'); + dialog::addInfo(XLAT("(most achievements are not available)")); + } + break; + + case 5: + dialog::addBreak(100); + dialog::addBigItem(XLAT("hypersian rug mode"), 'M'); + dialog::addInfo(XLAT("see the true form")); + break; + + case 6: + dialog::addBreak(100); + dialog::addBigItem(XLAT("texture mode"), 'T'); + dialog::addInfo(XLAT("paint pictures")); + break; + + case 20: + dialog::addBreak(100); + dialog::addBigItem(XLAT1("Halloween"), 'z'); + dialog::addInfo(XLAT("Halloween mini-game")); + break; + } + #if CAP_ROGUEVIZ && CAP_TOUR dialog::addBreak(100); dialog::addBigItem(XLAT("RogueViz"), 'r'); dialog::addInfo(XLAT("see the visualizations")); #endif - if(showHalloween()) { + if(have_current_settings()) { dialog::addBreak(100); - dialog::addBigItem(XLAT1("Halloween"), 'z'); - dialog::addInfo(XLAT("Halloween mini-game")); + dialog::addBigItem(XLAT1("use current/saved settings"), SDLK_ESCAPE); } dialog::addBreak(100); @@ -635,7 +689,45 @@ void showStartMenu() { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); if(uni == 'o') uni = 'i'; - if(uni == 'c' || uni == 'i' || uni == 's') { + else if(uni == 'M') { + rug::init(); + popScreenAll(); + resetModes('c'); + clearMessages(); + welcomeMessage(); + vid.wallmode = 3; + vid.monmode = 2; + rug::model_distance *= 2; + rug::init(); + } + else if(uni == 'T') { + popScreenAll(); + resetModes('c'); + clearMessages(); + welcomeMessage(); + using namespace texture; + if(config.data.whitetexture() && config.data.loadTextureGL()) { + config.tstate = config.tstate_max = tsActive; + config.perform_mapping(); + config.finish_mapping(); + mapeditor::initdraw(cwt.c); + pushScreen(showMenu); + pushScreen(mapeditor::showDrawEditor); + } + } + else if(uni == 'g') { + popScreenAll(); + resetModes('c'); + clearMessages(); + welcomeMessage(); + pushScreen(showEuclideanMenu); + ewhichscreen = 2; + } + else if(uni == 'c' || uni == 'i' || uni == 's' || uni == 'C' || uni == '7') { + if(uni == 'C' && !chaosUnlocked) { + help_nochaos(); + return; + } popScreenAll(); resetModes(uni); clearMessages();