From a3ac352389ad4a27a69cf0413eaabccc9eeedd9e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 26 Apr 2024 15:46:28 +0200 Subject: [PATCH] added new, 3-state setup option to allow skipping levels (yes/no/ask) 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 | 5 +++++ src/libgame/setup.c | 7 ++++--- src/libgame/system.h | 1 + src/screens.c | 13 +++++++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/files.c b/src/files.c index 4e5e7c83..9db04027 100644 --- a/src/files.c +++ b/src/files.c @@ -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; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 42ae7bdc..5a984166 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -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; diff --git a/src/libgame/system.h b/src/libgame/system.h index 9cfab170..20989e68 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -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; diff --git a/src/screens.c b/src/screens.c index 85b91cde..14e6291c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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:" }, -- 2.34.1