dual:: selectable from the menu

This commit is contained in:
Zeno Rogue 2019-05-29 02:44:30 +02:00
parent b7daf93f2e
commit 69e76b550c
4 changed files with 32 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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