From 62d001b0fa209f259440e160503dc5ffe5bcaa8f Mon Sep 17 00:00:00 2001 From: Hop311 Date: Fri, 21 Jul 2023 00:26:31 +0100 Subject: Tidying: missing req comments, submodules, hotkeys --- game/src/Game/Menu/OptionMenu/OptionsMenu.gd | 9 +++++---- game/src/Game/Menu/OptionMenu/ResolutionSelector.gd | 11 +++++------ game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd | 1 + .../Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd | 4 ++-- game/src/Game/Menu/OptionMenu/SoundTab.gd | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) (limited to 'game/src/Game/Menu/OptionMenu') diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd index c74c458..93ef3e4 100644 --- a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd +++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd @@ -66,11 +66,12 @@ func _save_overrides() -> void: if override_path.is_empty(): override_path = ProjectSettings.get_setting(Events.Options.settings_file_path_setting, Events.Options.settings_file_path_default) var file := ConfigFile.new() - var err_ret := file.load(override_path) - if err_ret != OK: push_error("Failed to load overrides from %s" % override_path) + if FileAccess.file_exists(override_path): + if file.load(override_path) != OK: + push_error("Failed to load overrides from %s" % override_path) file.set_value("display", "window/size/mode", Resolution.get_current_window_mode()) var resolution : Vector2i = Resolution.get_current_resolution() file.set_value("display", "window/size/viewport_width", resolution.x) file.set_value("display", "window/size/viewport_height", resolution.y) - err_ret = file.save(override_path) - if err_ret != OK: push_error("Failed to save overrides to %s" % override_path) + if file.save(override_path) != OK: + push_error("Failed to save overrides to %s" % override_path) diff --git a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd index f843815..cb7a1fb 100644 --- a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd +++ b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd @@ -1,10 +1,7 @@ extends SettingRevertButton # REQUIREMENTS -# * UIFUN-21 -# * UIFUN-28 -# * UIFUN-301 -# * UIFUN-302 +# * UIFUN-21, UIFUN-28, UIFUN-301, UIFUN-302 @export var default_value : Vector2i = Resolution.error_resolution @@ -14,7 +11,7 @@ func _find_resolution_index_by_value(value : Vector2i) -> int: return item_index return -1 -func _sync_resolutions(value : Vector2i = Resolution.error_resolution) -> void: +func _sync_resolutions() -> void: clear() default_selected = -1 selected = -1 @@ -59,7 +56,7 @@ func _update_resolution_options_text() -> void: set_item_text(index, display_name) func _setup_button() -> void: - Resolution.resolution_added.connect(_sync_resolutions) + Resolution.resolution_added.connect(func (_value : Vector2i): _sync_resolutions()) if default_value.x <= 0: default_value.x = ProjectSettings.get_setting("display/window/size/viewport_width") if default_value.y <= 0: @@ -75,6 +72,8 @@ func _get_value_for_file(select_value : int) -> Variant: else: return null +# REQUIREMENTS: +# * SS-25 func _set_value_from_file(load_value) -> void: var target_resolution := Resolution.error_resolution match typeof(load_value): diff --git a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd index a1a26a0..cb7566f 100644 --- a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd +++ b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd @@ -1,6 +1,7 @@ extends SettingRevertButton # REQUIREMENTS +# * SS-26, SS-127, SS-128 # * UIFUN-42 enum ScreenMode { Unknown = -1, Fullscreen, Borderless, Windowed } diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd index c5a805e..079dd4d 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd @@ -57,9 +57,9 @@ func _ready(): item_selected.connect(func(index : int): option_selected.emit(index, true)) _setup_button() if not _valid_index(default_selected) or selected == -1: - var msg := "Failed to generate %s %s options." % [setting_name, section_name] + var msg := "Failed to generate any valid %s %s options." % [setting_name, section_name] push_error(msg) - OS.alert(msg, "%s Options Error" % section_name) + OS.alert(msg, "Options Error: %s / %s" % [section_name, setting_name]) get_tree().quit() func load_setting(file : ConfigFile) -> void: diff --git a/game/src/Game/Menu/OptionMenu/SoundTab.gd b/game/src/Game/Menu/OptionMenu/SoundTab.gd index e0d9bcf..d1daf3d 100644 --- a/game/src/Game/Menu/OptionMenu/SoundTab.gd +++ b/game/src/Game/Menu/OptionMenu/SoundTab.gd @@ -1,6 +1,6 @@ extends HBoxContainer -@export var _startup_music_button : Button +@export var _startup_music_button : SettingCheckBox func _ready(): - _startup_music_button.option_selected.connect(func (pressed : bool, by_user : bool): MusicConductor.set_startup_music(pressed)) + _startup_music_button.option_selected.connect(func (pressed : bool, _by_user : bool): MusicConductor.set_startup_music(pressed)) -- cgit v1.2.3-56-ga3b1