added new, 3-state setup option to allow skipping levels (yes/no/ask)
authorHolger Schemel <info@artsoft.org>
Fri, 26 Apr 2024 13:46:28 +0000 (15:46 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 26 Apr 2024 13:46:32 +0000 (15:46 +0200)
This new setup option replaces the two previous setup options "Force
Solving Levels: yes/no" and "Allow Skipping Levels: yes/no" with a new
option "Allow Skipping Levels: yes/no/ask". This should simplify the
three (useful) combinations of the two previous setup options, as
follows:

- "Force Solving Levels: yes" and "Allow Skipping Levels: yes"
  => "Allow Skipping Levels: ask"

- "Force Solving Levels: yes" and "Allow Skipping Levels: no"
  => "Allow Skipping Levels: no"

- "Force Solving Levels: no" (and "Allow Skipping Levels: yes/no")
  => "Allow Skipping Levels: yes"

This hopefully makes configuring if (and how) unsolved levels may be
skipped or not easier to understand.

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

index 4e5e7c831d386fb453b4ebe34ee2e3ba7c92de7e..9db0402730767d7b9f6186b340769b207d80c59f 100644 (file)
@@ -10667,6 +10667,10 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH,
     &setup.skip_levels,                                "skip_levels"
   },
+  {
+    TYPE_SWITCH_3_STATES,
+    &setup.allow_skipping_levels,              "allow_skipping_levels"
+  },
   {
     TYPE_SWITCH,
     &setup.increment_levels,                   "increment_levels"
@@ -11625,6 +11629,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->team_mode = FALSE;
   si->handicap = TRUE;
   si->skip_levels = TRUE;
+  si->allow_skipping_levels = MODE_ASK;
   si->increment_levels = TRUE;
   si->auto_play_next_level = TRUE;
   si->count_score_after_game = TRUE;
index 42ae7bdc976e5bc53b703210e3b4361301c773c9..5a98416663902600a602bde8e92863a1b278b8ed 100644 (file)
@@ -2831,10 +2831,11 @@ SetupFileHash *loadSetupFileHash(char *filename)
 #define LEVELINFO_TOKEN_HANDICAP               29
 #define LEVELINFO_TOKEN_TIME_LIMIT             30
 #define LEVELINFO_TOKEN_SKIP_LEVELS            31
-#define LEVELINFO_TOKEN_USE_EMC_TILES          32
-#define LEVELINFO_TOKEN_INFO_SCREENS_FROM_MAIN 33
+#define LEVELINFO_TOKEN_ALLOW_SKIPPING_LEVELS  32
+#define LEVELINFO_TOKEN_USE_EMC_TILES          33
+#define LEVELINFO_TOKEN_INFO_SCREENS_FROM_MAIN 34
 
-#define NUM_LEVELINFO_TOKENS                   34
+#define NUM_LEVELINFO_TOKENS                   35
 
 static LevelDirTree ldi;
 
index 9cfab1706555053b244913f67fe909fb53890539..20989e68f2316a6291467dca5ca2b59a09aa75f4 100644 (file)
@@ -1497,6 +1497,7 @@ struct SetupInfo
   boolean team_mode;
   boolean handicap;
   boolean skip_levels;
+  boolean allow_skipping_levels;
   boolean increment_levels;
   boolean auto_play_next_level;
   boolean count_score_after_game;
index 85b91cdea2292b2db64fa0ec72bdad679fde04ac..14e6291c56de620255c1f48ac76d487c4f9fbfce 100644 (file)
@@ -1929,7 +1929,7 @@ void DrawMainMenu(void)
   SetAnimationFirstLevel(leveldir_current->first_level);
 
   // level_nr may have been set to value over handicap with level editor
-  if (setup.handicap && level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != TRUE && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
 
   LoadLevel(level_nr);
@@ -2286,13 +2286,14 @@ static void HandleMainMenu_SelectLevel(int step, int direction,
   if (new_level_nr > leveldir_current->last_level)
     new_level_nr = leveldir_current->last_level;
 
-  if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != TRUE && new_level_nr > leveldir_current->handicap_level)
   {
     // skipping levels is only allowed when trying to skip single level
     // (also, skipping BD style intermission levels is always possible)
     if (new_level_nr == old_level_nr + 1 &&
        (level.bd_intermission ||
-        (setup.skip_levels && Request("Level still unsolved! Skip it anyway?", REQ_ASK))))
+        (setup.allow_skipping_levels == MODE_ASK &&
+         Request("Level still unsolved! Skip it anyway?", REQ_ASK))))
     {
       leveldir_current->handicap_level++;
       SaveLevelSetup_SeriesInfo();
@@ -5719,7 +5720,7 @@ static void HandleHallOfFame_SelectLevel(int step, int direction)
   if (new_level_nr > leveldir_current->last_level)
     new_level_nr = leveldir_current->last_level;
 
-  if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != TRUE && new_level_nr > leveldir_current->handicap_level)
     new_level_nr = leveldir_current->handicap_level;
 
   if (new_level_nr != old_level_nr)
@@ -7945,8 +7946,12 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.multiple_users,          "Multiple Users/Teams:"         },
   { TYPE_YES_NO,       &setup.input_on_focus,          "Only Move Focussed Player:"    },
   { TYPE_SWITCH,       &setup.time_limit,              "Time Limit:"                   },
+#if 1
+  { TYPE_YES_NO_ASK,   &setup.allow_skipping_levels,   "Allow Skipping Levels:"        },
+#else
   { TYPE_SWITCH,       &setup.handicap,                "Force Solving Levels:"         },
   { TYPE_SWITCH,       &setup.skip_levels,             "Allow Skipping Levels:"        },
+#endif
   { TYPE_SWITCH,       &setup.increment_levels,        "Increment Solved Levels:"      },
   { TYPE_SWITCH,       &setup.auto_play_next_level,    "Auto-play Next Level:"         },
   { TYPE_SWITCH,       &setup.count_score_after_game,  "Count Score After Game:"       },