From 69e76b550c9b0a5268a0175c7ea82ae173f57737 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 29 May 2019 02:44:30 +0200 Subject: [PATCH] dual:: selectable from the menu --- achievement.cpp | 3 +++ hyper.h | 4 ++++ menus.cpp | 4 ++++ system.cpp | 25 +++++++++++++++++++++---- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/achievement.cpp b/achievement.cpp index 6872a647..d7170d14 100644 --- a/achievement.cpp +++ b/achievement.cpp @@ -90,6 +90,7 @@ bool wrongMode(char flags) { if(shmup::on != (flags == rg::shmup || flags == rg::racing)) return true; if(racing::on != (flags == rg::racing)) return true; + if((!!dual::state) != (flags == rg::dualmode)) return true; #if CAP_DAILY if(daily::on != (flags == rg::daily)) return true; #endif @@ -526,6 +527,7 @@ void achievement_score(int cat, int number) { else if(geometry) return; if(CHANGED_VARIATION) return; if(randomPatternsMode) return; + if(dual::state) return; if(shmup::on && cat != LB_PURE_TACTICS_SHMUP && cat != LB_PURE_TACTICS_COOP && cat != LB_RACING) return; if(yendor::on && cat != LB_YENDOR_CHALLENGE) return; if(tactic::on && cat != LB_PURE_TACTICS && cat != LB_PURE_TACTICS_SHMUP && cat != LB_PURE_TACTICS_COOP) @@ -615,6 +617,7 @@ void achievement_final(bool really_final) { if(randomPatternsMode) return; if(peace::on) return; if(yendor::on) return; + if(dual::state) return; if(tactic::on) { tactic::record(); diff --git a/hyper.h b/hyper.h index e37b26e9..7ba3daeb 100644 --- a/hyper.h +++ b/hyper.h @@ -752,6 +752,7 @@ namespace rg { static const char daily = 'd'; static const char daily_off = 'D'; static const char racing = 'R'; + static const char dualmode = 'U'; // wrongmode only -- marks 'global' achievements not related to the current mode static const char global = 'x'; @@ -5462,6 +5463,9 @@ namespace dual { bool check_side(eLand l); void assign_landsides(); + + void disable(); + void enable(); } } \ No newline at end of file diff --git a/menus.cpp b/menus.cpp index 0d486e74..62e73278 100644 --- a/menus.cpp +++ b/menus.cpp @@ -515,6 +515,10 @@ void showChangeMode() { #if CAP_RACING dialog::addBoolItem(XLAT("racing mode"), racing::on, 'R'); #endif +#if CAP_ARCM + dialog::addBoolItem(XLAT("dual geometry mode"), dual::state, 'D'); + dialog::add_action([] { dialog::do_if_confirmed([] { restart_game(rg::dualmode); }); }); +#endif #if CAP_DAILY dialog::addBoolItem(XLAT("Strange Challenge"), daily::on, 'z'); #endif diff --git a/system.cpp b/system.cpp index 0934936a..991bd140 100644 --- a/system.cpp +++ b/system.cpp @@ -1166,6 +1166,13 @@ void set_variation(eVariation target) { variation = target; } } + +void stop_tour() { + while(gamestack::pushed()) { + gamestack::pop(); + stop_game(); + } + } void switch_game_mode(char switchWhat) { DEBBI(DF_INIT, ("switch_game_mode ", switchWhat)); @@ -1177,6 +1184,14 @@ void switch_game_mode(char switchWhat) { racing::on = false; break; + case rg::dualmode: + stop_tour(); tour::on = false; + racing::on = false; + yendor::on = tactic::on = princess::challenge = false; + if(!dual::state) dual::enable(); + else dual::disable(); + break; + case rg::inv: inv::on = !inv::on; if(tactic::on) firstland = laIce; @@ -1195,12 +1210,10 @@ void switch_game_mode(char switchWhat) { #if CAP_TOUR case rg::tour: - while(gamestack::pushed()) { - gamestack::pop(); - stop_game(); - } + if(tour::on) stop_tour(); geometry = gNormal; yendor::on = tactic::on = princess::challenge = peace::on = inv::on = false; + dual::disable(); chaosmode = randomPatternsMode = false; variation = eVariation::bitruncated; #if CAP_GP @@ -1222,6 +1235,7 @@ void switch_game_mode(char switchWhat) { chaosmode = false; racing::on = false; if(!yendor::on) firstland = laIce; + dual::disable(); break; #if CAP_RACING @@ -1234,6 +1248,7 @@ void switch_game_mode(char switchWhat) { chaosmode = false; princess::challenge = false; if(bounded) set_geometry(gNormal); + dual::disable(); break; #endif @@ -1247,6 +1262,7 @@ void switch_game_mode(char switchWhat) { racing::on = false; chaosmode = false; if(!tactic::on) firstland = laIce; + dual::disable(); break; case rg::shmup: @@ -1273,6 +1289,7 @@ void switch_game_mode(char switchWhat) { chaosmode = false; inv::on = false; racing::on = false; + dual::disable(); break; #if CAP_DAILY