re-added setup options and variables not used anymore
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 17:18:12 +0000 (19:18 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 17:55:56 +0000 (19:55 +0200)
For easier tests with old game versions. This reverts commit 4af6f4c2
and adds some backwards compatibility code.

src/files.c
src/libgame/system.h
src/screens.c

index 50abce3a73d2931011226e86ce2d95b75819d73d..5faf5f363b3383d9c7f7d87338dd82b4b613d5c4 100644 (file)
@@ -10819,6 +10819,14 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH,
     &setup.team_mode,                          "team_mode"
   },
+  {
+    TYPE_SWITCH,
+    &setup.handicap,                           "handicap"
+  },
+  {
+    TYPE_SWITCH,
+    &setup.skip_levels,                                "skip_levels"
+  },
   {
     TYPE_SWITCH_3_STATES,
     &setup.allow_skipping_levels,              "allow_skipping_levels"
@@ -11787,7 +11795,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->show_titlescreen = TRUE;
   si->quick_doors = FALSE;
   si->team_mode = FALSE;
-  si->allow_skipping_levels = STATE_ASK;
+  si->handicap = TRUE;
+  si->skip_levels = TRUE;
+  si->allow_skipping_levels = ARG_UNDEFINED_VALUE;
   si->increment_levels = TRUE;
   si->auto_play_next_level = TRUE;
   si->count_score_after_game = TRUE;
@@ -12372,6 +12382,13 @@ static void LoadSetup_SpecialPostProcessing(void)
   // make sure that scroll delay value stays inside valid range
   setup.scroll_delay_value =
     MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY);
+
+  if (setup.allow_skipping_levels == ARG_UNDEFINED_VALUE)
+  {
+    // if undefined, set from previously used setup options for same purpose
+    setup.allow_skipping_levels = (setup.handicap && setup.skip_levels ? STATE_ASK :
+                                   setup.handicap ? STATE_FALSE : STATE_TRUE);
+  }
 }
 
 void LoadSetup_Default(void)
index a5ec4ec009ad87c425ea17e66699b6055ce1d727..1c1b50be7bd6c82a91adb54dc46e0fa312cf4b2c 100644 (file)
@@ -1500,6 +1500,8 @@ struct SetupInfo
   boolean show_titlescreen;
   boolean quick_doors;
   boolean team_mode;
+  boolean handicap;
+  boolean skip_levels;
   boolean allow_skipping_levels;
   boolean increment_levels;
   boolean auto_play_next_level;
index d6a58fba5051b16c39402682e811fe3155a48757..5e7bd315b7b7395e747e7c686cee545bbc1655b4 100644 (file)
@@ -7743,6 +7743,15 @@ static void ToggleUseApiServerIfNeeded(void)
   }
 }
 
+static void UpdateHandicapAndSkipLevels(void)
+{
+  // these setup options are obsolete and not used anymore;
+  // update them anyway for testing with older game versions
+
+  setup.handicap    = (setup.allow_skipping_levels != STATE_TRUE);
+  setup.skip_levels = (setup.allow_skipping_levels != STATE_FALSE);
+}
+
 static void ModifyGameSpeedIfNeeded(void)
 {
   if (strEqual(setup.vsync_mode, STR_VSYNC_MODE_OFF) ||
@@ -8599,6 +8608,10 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
   if (si->value == &setup.sound_simple ||
       si->value == &setup.sound_loops)
     ToggleMenuSoundsIfNeeded();
+
+  // update old setup options from new setup options
+  if (si->value == &setup.allow_skipping_levels)
+    UpdateHandicapAndSkipLevels();
 }
 
 static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)