From: Holger Schemel Date: Sat, 5 Oct 2024 17:18:12 +0000 (+0200) Subject: re-added setup options and variables not used anymore X-Git-Tag: 4.4.0.0-test-4~166 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=aafb9f59c3ac694c5ed7278b67e1e6ad7fbc4905;p=rocksndiamonds.git re-added setup options and variables not used anymore For easier tests with old game versions. This reverts commit 4af6f4c2 and adds some backwards compatibility code. --- diff --git a/src/files.c b/src/files.c index 50abce3a..5faf5f36 100644 --- a/src/files.c +++ b/src/files.c @@ -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) diff --git a/src/libgame/system.h b/src/libgame/system.h index a5ec4ec0..1c1b50be 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -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; diff --git a/src/screens.c b/src/screens.c index d6a58fba..5e7bd315 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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)