aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/Game')
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentOption.gd60
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentParser.gd267
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentParser.tscn32
-rw-r--r--game/src/Game/Autoload/Events.gd45
-rw-r--r--game/src/Game/Autoload/Events/GameDebug.gd21
-rw-r--r--game/src/Game/Autoload/Events/Localisation.gd30
-rw-r--r--game/src/Game/Autoload/Events/Options.gd30
-rw-r--r--game/src/Game/Autoload/Events/ShaderManager.gd48
-rw-r--r--game/src/Game/Autoload/GuiScale.gd62
-rw-r--r--game/src/Game/Autoload/Resolution.gd101
-rw-r--r--game/src/Game/Autoload/SaveManager.gd55
-rw-r--r--game/src/Game/Autoload/SoundManager.gd42
-rw-r--r--game/src/Game/GameMenu.gd47
-rw-r--r--game/src/Game/GameMenu.tscn53
-rw-r--r--game/src/Game/GameSession/GameSession.gd16
-rw-r--r--game/src/Game/GameSession/GameSession.tscn95
-rw-r--r--game/src/Game/GameSession/GameSessionMenu.gd80
-rw-r--r--game/src/Game/GameSession/GameSessionMenu.tscn91
-rw-r--r--game/src/Game/GameSession/GameSpeedPanel.gd37
-rw-r--r--game/src/Game/GameSession/GameSpeedPanel.tscn38
-rw-r--r--game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd57
-rw-r--r--game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn107
-rw-r--r--game/src/Game/GameSession/MapControlPanel/Minimap.gd105
-rw-r--r--game/src/Game/GameSession/MapControlPanel/Minimap.gdshader18
-rw-r--r--game/src/Game/GameSession/MapView.gd242
-rw-r--r--game/src/Game/GameSession/MapView.tscn30
-rw-r--r--game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc18
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd122
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn86
-rw-r--r--game/src/Game/GameSession/TerrainMap.gdshader50
-rw-r--r--game/src/Game/GameStart.tscn52
-rw-r--r--game/src/Game/LocaleButton.gd80
-rw-r--r--game/src/Game/LocaleButton.tscn12
-rw-r--r--game/src/Game/Menu/CreditsMenu/CreditsMenu.gd200
-rw-r--r--game/src/Game/Menu/CreditsMenu/CreditsMenu.tscn50
-rw-r--r--game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd4
-rw-r--r--game/src/Game/Menu/CreditsMenu/GodotEngineButton.tscn20
-rw-r--r--game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg1
-rw-r--r--game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg.import37
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyMenu.gd165
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyMenu.tscn138
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd102
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyPanelButton.tscn31
-rw-r--r--game/src/Game/Menu/MainMenu/MainMenu.gd50
-rw-r--r--game/src/Game/Menu/MainMenu/MainMenu.tscn150
-rw-r--r--game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd41
-rw-r--r--game/src/Game/Menu/MainMenu/ReleaseInfoBox.tscn38
-rw-r--r--game/src/Game/Menu/OptionMenu/AutosaveIntervalSelector.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/ControlsTab.tscn14
-rw-r--r--game/src/Game/Menu/OptionMenu/GeneralTab.gd9
-rw-r--r--game/src/Game/Menu/OptionMenu/GeneralTab.tscn81
-rw-r--r--game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd64
-rw-r--r--game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd18
-rw-r--r--game/src/Game/Menu/OptionMenu/OptionsMenu.gd68
-rw-r--r--game/src/Game/Menu/OptionMenu/OptionsMenu.tscn52
-rw-r--r--game/src/Game/Menu/OptionMenu/OtherTab.tscn18
-rw-r--r--game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd4
-rw-r--r--game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd5
-rw-r--r--game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd35
-rw-r--r--game/src/Game/Menu/OptionMenu/ResolutionSelector.gd91
-rw-r--r--game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd48
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd41
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd77
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd27
-rw-r--r--game/src/Game/Menu/OptionMenu/SoundTab.gd4
-rw-r--r--game/src/Game/Menu/OptionMenu/SoundTab.tscn34
-rw-r--r--game/src/Game/Menu/OptionMenu/VideoTab.gd9
-rw-r--r--game/src/Game/Menu/OptionMenu/VideoTab.tscn181
-rw-r--r--game/src/Game/Menu/OptionMenu/VolumeGrid.gd70
-rw-r--r--game/src/Game/Menu/OptionMenu/VolumeGrid.tscn8
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.gd123
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn109
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd41
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SavePanelButton.tscn58
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SaveResource.gd59
-rw-r--r--game/src/Game/MusicConductor/MusicConductor.gd77
-rw-r--r--game/src/Game/MusicConductor/MusicConductor.tscn13
-rw-r--r--game/src/Game/MusicConductor/MusicPlayer.gd73
-rw-r--r--game/src/Game/MusicConductor/MusicPlayer.tscn63
-rw-r--r--game/src/Game/MusicConductor/SongInfo.gd11
-rw-r--r--game/src/Game/SplashContainer.gd30
-rw-r--r--game/src/Game/Theme/StyleBoxCombinedTexture.gd47
-rw-r--r--game/src/Game/Theme/StyleBoxWithSound.gd34
-rw-r--r--game/src/Game/Theme/TextureSetting.gd123
84 files changed, 5077 insertions, 0 deletions
diff --git a/game/src/Game/Autoload/Argument/ArgumentOption.gd b/game/src/Game/Autoload/Argument/ArgumentOption.gd
new file mode 100644
index 0000000..f14cef0
--- /dev/null
+++ b/game/src/Game/Autoload/Argument/ArgumentOption.gd
@@ -0,0 +1,60 @@
+@tool
+class_name ArgumentOption
+extends Resource
+
+@export var name : StringName
+@export var aliases : Array[StringName] = []
+@export var type : Variant.Type :
+ get: return type
+ set(v):
+ type = v
+ match v:
+ TYPE_BOOL: default_value = false
+ TYPE_INT: default_value = 0
+ TYPE_FLOAT: default_value = 0.0
+ TYPE_STRING: default_value = ""
+ TYPE_STRING_NAME: default_value = &""
+ TYPE_COLOR: default_value = Color()
+ _: default_value = null
+ notify_property_list_changed()
+var default_value
+@export var description : String
+
+func _init(_name = "", _type = TYPE_NIL, _description = "", default = null):
+ name = _name
+ type = _type
+ if default != null and typeof(default) == type:
+ default_value = default
+ description = _description
+
+func add_alias(alias : StringName) -> ArgumentOption:
+ aliases.append(alias)
+ return self
+
+func get_type_string() -> StringName:
+ match type:
+ TYPE_NIL: return "null"
+ TYPE_BOOL: return "boolean"
+ TYPE_INT: return "integer"
+ TYPE_FLOAT: return "float"
+ TYPE_STRING, TYPE_STRING_NAME: return "string"
+ TYPE_COLOR: return "color"
+ return "<invalid type>"
+
+func _get(property):
+ if property == "default_value": return default_value
+
+func _set(property, value):
+ if property == "default_value":
+ default_value = value
+ return true
+
+func _get_property_list():
+ var properties := []
+
+ properties.append({
+ "name": "default_value",
+ "type": type
+ })
+
+ return properties
diff --git a/game/src/Game/Autoload/Argument/ArgumentParser.gd b/game/src/Game/Autoload/Argument/ArgumentParser.gd
new file mode 100644
index 0000000..ce89dd8
--- /dev/null
+++ b/game/src/Game/Autoload/Argument/ArgumentParser.gd
@@ -0,0 +1,267 @@
+@tool
+extends Node
+
+const argument_setting_path := &"openvic/data/arguments"
+
+@export var option_array : Array[ArgumentOption] = [
+ ArgumentOption.new(
+ "help",
+ TYPE_BOOL,
+ "Displays help and quits.",
+ false
+ ).add_alias(&"h")
+]
+
+const color_name_array : PackedStringArray =[
+ "aliceblue", "antiquewhite", "aqua", "aquamarine",
+ "azure", "beige", "bisque", "black", "blanchedalmond",
+ "blue", "blueviolet", "brown", "burlywood", "cadetblue",
+ "chartreuse", "chocolate", "coral", "cornflower", "cornsilk",
+ "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
+ "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
+ "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
+ "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
+ "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
+ "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
+ "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew",
+ "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
+ "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
+ "lightcyan", "lightgoldenrod", "lightgray", "lightgreen", "lightpink",
+ "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
+ "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
+ "maroon", "mediumaquamarine", "mediumblue", "mediumorchid",
+ "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen",
+ "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
+ "mistyrose", "moccasin", "navajowhite", "navyblue", "oldlace", "olive",
+ "olivedrab", "orange", "orangered", "orchid", "palegoldenrod",
+ "palegreen", "paleturquoise", "palevioletred", "papayawhip",
+ "peachpuff", "peru", "pink", "plum", "powderblue", "purple",
+ "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
+ "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver",
+ "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue",
+ "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "violet",
+ "webgray", "webgreen", "webmaroon", "webpurple", "wheat", "white",
+ "whitesmoke", "yellow", "yellowgreen"
+]
+
+func _parse_value(arg_name : StringName, value_string : String, type : Variant.Type) -> Variant:
+ match type:
+ TYPE_NIL: return null
+ TYPE_BOOL:
+ value_string = value_string.to_lower()
+ if value_string == "true" or value_string == "t" or value_string == "yes" or value_string == "y":
+ return true
+ if value_string == "false" or value_string == "f" or value_string == "no" or value_string == "n":
+ return false
+ push_error("'%s' must be a valid boolean, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ TYPE_INT:
+ if value_string.is_valid_int():
+ return value_string.to_int()
+ push_error("'%s' must be a valid integer, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ TYPE_FLOAT:
+ if value_string.is_valid_float():
+ return value_string.to_float()
+ push_error("'%s' must be a valid float, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ TYPE_STRING, TYPE_STRING_NAME:
+ return value_string
+ TYPE_COLOR:
+ if Color.html_is_valid(value_string) or value_string.to_lower() in color_name_array:
+ return Color.from_string(value_string, Color())
+ push_error("'%s' must be an html Color or Color name, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ # Unsupported types
+ TYPE_VECTOR2, \
+ TYPE_VECTOR2I, \
+ TYPE_VECTOR3, \
+ TYPE_VECTOR3I, \
+ TYPE_VECTOR4, \
+ TYPE_VECTOR4I, \
+ TYPE_RECT2, \
+ TYPE_RECT2I:
+ push_warning("Value type '%s' may not be supported." % type)
+ var data_array = value_string.lstrip("(").rstrip(")").split(",", false)
+ for index in range(data_array.size()):
+ data_array[index] = " " + data_array[index].strip_edges()
+ match type:
+ TYPE_VECTOR2:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector2, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector2(%s )" % ",".join(data_array))
+ TYPE_VECTOR2I:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector2i, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector2i(%s )" % ",".join(data_array))
+ TYPE_VECTOR3:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector3, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector3(%s )" % ",".join(data_array))
+ TYPE_VECTOR3I:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector3i, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector3i(%s )" % ",".join(data_array))
+ TYPE_VECTOR4:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector4, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector4(%s )" % ",".join(data_array))
+ TYPE_VECTOR4I:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Vector4i, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Vector4i(%s )" % ",".join(data_array))
+ TYPE_RECT2:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Rect2, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Rect2(%s )" % ",".join(data_array))
+ TYPE_RECT2I:
+ if data_array.size() != 2:
+ push_error("'%s' value must be a Rect2i, '%s' is an invalid value." % [arg_name, value_string])
+ return null
+ return str_to_var("Rect2i(%s )" % ",".join(data_array))
+ _:
+ push_error("'%s' value of type '%s' requested but could not be parsed." % [arg_name, type])
+ return null
+
+ return null
+
+# Missing types
+# TYPE_TRANSFORM2D = 11
+# TYPE_VECTOR4 = 12
+# TYPE_VECTOR4I = 13
+# TYPE_PLANE = 14
+# TYPE_QUATERNION = 15
+# TYPE_AABB = 16
+# TYPE_BASIS = 17
+# TYPE_TRANSFORM3D = 18
+# TYPE_PROJECTION = 19
+# TYPE_NODE_PATH = 22
+# TYPE_RID = 23
+# TYPE_OBJECT = 24
+# TYPE_CALLABLE = 25
+# TYPE_SIGNAL = 26
+# TYPE_DICTIONARY = 27
+# TYPE_ARRAY = 28
+# TYPE_PACKED_BYTE_ARRAY = 29
+# TYPE_PACKED_INT32_ARRAY = 30
+# TYPE_PACKED_INT64_ARRAY = 31
+# TYPE_PACKED_FLOAT32_ARRAY = 32
+# TYPE_PACKED_FLOAT64_ARRAY = 33
+# TYPE_PACKED_STRING_ARRAY = 34
+# TYPE_PACKED_VECTOR2_ARRAY = 35
+# TYPE_PACKED_VECTOR3_ARRAY = 36
+# TYPE_PACKED_COLOR_ARRAY = 37
+
+func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray) -> Dictionary:
+ var current_key : String = ""
+ var current_option : ArgumentOption = null
+ for arg in arg_list:
+ if current_option != null and not arg.begins_with("-"):
+ var result = _parse_value(current_key, arg, current_option.type)
+ if result != null:
+ dictionary[current_option.name] = result
+ current_option = null
+ continue
+
+ if current_option != null:
+ push_warning("Valid argument '%s' was not set as a value, skipping." % current_key)
+
+ if arg.begins_with("-"):
+ current_option = null
+ arg = arg.substr(1)
+ var key := &""
+ var value := &""
+
+ # Support for Unix shorthand of multiple boolean arguments
+ # eg: "-abc" means a == true, b == true, c == true
+ if arg.length() > 1 and arg[0] != "-" and arg[1] != "=":
+ for c in arg:
+ for o in option_array:
+ if o.aliases.any(func(v): return c == v):
+ dictionary[o.name] = true
+ continue
+
+ # Support for = key/value split
+ # eg: "-v=5" and "--value=5" means v == 5 and value == 5
+ var first_equal := arg.find("=")
+ if first_equal > -1:
+ key = arg.substr(0, first_equal - 1)
+ value = arg.substr(first_equal + 1)
+ else:
+ key = arg
+
+ # Removes - for full name arguments
+ if key.begins_with("-"):
+ key = key.substr(1)
+
+ for o in option_array:
+ if key == o.name or o.aliases.any(func(v): return key == v):
+ current_option = o
+ break
+
+ if current_option == null:
+ push_warning("Invalid argument '%s' found, skipping." % key)
+ continue
+
+ current_key = key
+ if first_equal > -1:
+ var arg_result = _parse_value(key, value, current_option.type)
+ if arg_result != null:
+ dictionary[current_option.name] = arg_result
+ current_option = null
+
+ return dictionary
+
+func _print_help():
+ var project_name : StringName = ProjectSettings.get_setting_with_override(&"application/config/name")
+ var project_version : String = _GIT_INFO_.tag
+ var project_hash : String = _GIT_INFO_.short_hash
+ var project_website : String = "https://openvic.com"
+ var project_description : String = ProjectSettings.get_setting_with_override(&"application/config/description")
+ print_rich(
+"""
+%s - %s - %s - %s
+%s
+
+%s
+
+Options:
+"""
+ % [
+ project_name,
+ project_version,
+ project_hash,
+ project_website,
+ project_description,
+ "usage: %s [options]" % OS.get_executable_path().get_file()
+ ]
+ )
+ for option in option_array:
+ print_rich(" --%s%s%s" % [
+ (option.name + (",-%s" % (",-".join(option.aliases)) if option.aliases.size() > 0 else "")).rpad(45),
+ ("Type: %s - Default Value: %s" % [option.get_type_string(), option.default_value]).rpad(45),
+ option.description
+ ])
+func _ready():
+ if Engine.is_editor_hint(): return
+
+ var argument_dictionary : Dictionary = {}
+ if ProjectSettings.has_setting(argument_setting_path):
+ argument_dictionary = ProjectSettings.get_setting_with_override(argument_setting_path)
+ for option in option_array:
+ argument_dictionary[option.name] = option.default_value
+
+ _parse_argument_list(argument_dictionary, OS.get_cmdline_args())
+ _parse_argument_list(argument_dictionary, OS.get_cmdline_user_args())
+
+ ProjectSettings.set_setting(argument_setting_path, argument_dictionary)
+ if argument_dictionary[&"help"]:
+ _print_help()
+ get_tree().quit()
diff --git a/game/src/Game/Autoload/Argument/ArgumentParser.tscn b/game/src/Game/Autoload/Argument/ArgumentParser.tscn
new file mode 100644
index 0000000..8fda8f1
--- /dev/null
+++ b/game/src/Game/Autoload/Argument/ArgumentParser.tscn
@@ -0,0 +1,32 @@
+[gd_scene load_steps=6 format=3 uid="uid://dayjmgc34tqo6"]
+
+[ext_resource type="Script" path="res://src/Autoload/Arguments/ArgumentParser.gd" id="1_pc7xr"]
+[ext_resource type="Script" path="res://src/Autoload/Arguments/ArgumentOption.gd" id="2_4hguj"]
+
+[sub_resource type="Resource" id="Resource_tq3y4"]
+script = ExtResource("2_4hguj")
+name = &"help"
+aliases = Array[StringName]([&"h"])
+type = 1
+description = "Displays help and quits."
+default_value = false
+
+[sub_resource type="Resource" id="Resource_j1to4"]
+script = ExtResource("2_4hguj")
+name = &"game-debug"
+aliases = Array[StringName]([&"d", &"-debug", &"-debug-mode"])
+type = 1
+description = "Start in debug mode."
+default_value = false
+
+[sub_resource type="Resource" id="Resource_tiax1"]
+script = ExtResource("2_4hguj")
+name = &"compatibility-mode"
+aliases = Array[StringName]([&"-compat"])
+type = 4
+description = "Load Victoria 2 assets from this path."
+default_value = ""
+
+[node name="ArgumentParser" type="Node"]
+script = ExtResource("1_pc7xr")
+option_array = Array[ExtResource("2_4hguj")]([SubResource("Resource_tq3y4"), SubResource("Resource_j1to4"), SubResource("Resource_tiax1")])
diff --git a/game/src/Game/Autoload/Events.gd b/game/src/Game/Autoload/Events.gd
new file mode 100644
index 0000000..4387cc7
--- /dev/null
+++ b/game/src/Game/Autoload/Events.gd
@@ -0,0 +1,45 @@
+extends Node
+
+var GameDebug = preload("Events/GameDebug.gd").new()
+var Options = preload("Events/Options.gd").new()
+var Localisation = preload("Events/Localisation.gd").new()
+var ShaderManager = preload("Events/ShaderManager.gd").new()
+
+var _define_filepaths_dict : Dictionary = {
+ GameSingleton.get_province_identifier_file_key(): "res://common/map/provinces.json",
+ GameSingleton.get_water_province_file_key(): "res://common/map/water.json",
+ GameSingleton.get_region_file_key(): "res://common/map/regions.json",
+ GameSingleton.get_terrain_variant_file_key(): "res://common/map/terrain.json",
+ GameSingleton.get_terrain_texture_dir_key(): "res://art/terrain/",
+ GameSingleton.get_province_image_file_key(): "res://common/map/provinces.png",
+ GameSingleton.get_terrain_image_file_key(): "res://common/map/terrain.png",
+ GameSingleton.get_goods_file_key(): "res://common/goods.json",
+ GameSingleton.get_good_icons_dir_key(): "res://art/economy/goods"
+}
+
+# REQUIREMENTS
+# * FS-333, FS-334, FS-335, FS-341
+func _ready():
+ GameSingleton.setup_logger()
+
+ # Set this to your Vic2 install dir or a mod's dir to enable compatibility mode
+ # (this won't work for mods which rely on vanilla map assets, copy missing assets
+ # into the mod's dir for a temporary fix)
+ # Usage: OpenVic --compatibility-mode <path>
+
+ var compatibility_mode_path : String
+ if ProjectSettings.has_setting(ArgumentParser.argument_setting_path):
+ var arg_dictionary : Dictionary = ProjectSettings.get_setting(ArgumentParser.argument_setting_path)
+ compatibility_mode_path = arg_dictionary.get(&"compatibility-mode", compatibility_mode_path)
+
+ var start := Time.get_ticks_usec()
+
+ if compatibility_mode_path:
+ if GameSingleton.load_defines_compatibility_mode(compatibility_mode_path) != OK:
+ push_error("Errors loading game defines!")
+ else:
+ if GameSingleton.load_defines(_define_filepaths_dict) != OK:
+ push_error("Errors loading game defines!")
+
+ var end := Time.get_ticks_usec()
+ print("Loading took ", float(end - start) / 1000000, " seconds")
diff --git a/game/src/Game/Autoload/Events/GameDebug.gd b/game/src/Game/Autoload/Events/GameDebug.gd
new file mode 100644
index 0000000..df7a23a
--- /dev/null
+++ b/game/src/Game/Autoload/Events/GameDebug.gd
@@ -0,0 +1,21 @@
+extends RefCounted
+
+# REQUIREMENTS:
+# * SS-56
+func _init():
+ for engine_args in OS.get_cmdline_args():
+ match(engine_args):
+ "--game-debug":
+ set_debug_mode(true)
+
+ for engine_args in OS.get_cmdline_user_args():
+ match(engine_args):
+ "--game-debug", "-d", "--debug", "--debug-mode":
+ set_debug_mode(true)
+
+func set_debug_mode(value : bool) -> void:
+ ProjectSettings.set_setting("openvic/debug/enabled", value)
+ print("Set debug mode to: ", value)
+
+func is_debug_mode() -> bool:
+ return ProjectSettings.get_setting("openvic/debug/enabled", false)
diff --git a/game/src/Game/Autoload/Events/Localisation.gd b/game/src/Game/Autoload/Events/Localisation.gd
new file mode 100644
index 0000000..eda7e51
--- /dev/null
+++ b/game/src/Game/Autoload/Events/Localisation.gd
@@ -0,0 +1,30 @@
+extends RefCounted
+
+# REQUIREMENTS
+# * SS-59, SS-60, SS-61
+func get_default_locale() -> String:
+ var locales := TranslationServer.get_loaded_locales()
+ var default_locale := OS.get_locale()
+ if default_locale in locales:
+ return default_locale
+ var default_language := OS.get_locale_language()
+ for locale in locales:
+ if locale.begins_with(default_language):
+ return default_language
+ return ProjectSettings.get_setting("internationalization/locale/fallback", "en_GB")
+
+func load_localisation(dir_path : String) -> void:
+ if LoadLocalisation.load_localisation_dir(dir_path) == OK:
+ print("loaded locales: ", TranslationServer.get_loaded_locales())
+ else:
+ push_error("Failed to load localisation directory: ", dir_path)
+
+# REQUIREMENTS
+# * SS-57
+# * FS-17
+func _init():
+ var localisation_dir_path : String = ProjectSettings.get_setting("internationalization/locale/localisation_path", "")
+ if localisation_dir_path.is_empty():
+ push_error("Missing localisation_path setting!")
+ else:
+ load_localisation(localisation_dir_path)
diff --git a/game/src/Game/Autoload/Events/Options.gd b/game/src/Game/Autoload/Events/Options.gd
new file mode 100644
index 0000000..fbeccef
--- /dev/null
+++ b/game/src/Game/Autoload/Events/Options.gd
@@ -0,0 +1,30 @@
+extends RefCounted
+
+signal save_settings(save_file: ConfigFile)
+signal load_settings(load_file: ConfigFile)
+signal reset_settings()
+
+func load_settings_from_file() -> void:
+ load_settings.emit(_settings_file)
+
+# REQUIREMENTS
+# * SS-11
+func save_settings_to_file() -> void:
+ save_settings.emit(_settings_file)
+ _settings_file.save(_settings_file_path)
+
+func try_reset_settings() -> void:
+ reset_settings.emit()
+
+const settings_file_path_setting : String = "openvic/settings/settings_file_path"
+const settings_file_path_default : String = "user://settings.cfg"
+
+var _settings_file_path : String = ProjectSettings.get_setting(settings_file_path_setting, settings_file_path_default)
+var _settings_file := ConfigFile.new()
+
+# REQUIREMENTS
+# * SS-9
+# * UIFUN-7
+func _init():
+ if FileAccess.file_exists(_settings_file_path):
+ _settings_file.load(_settings_file_path)
diff --git a/game/src/Game/Autoload/Events/ShaderManager.gd b/game/src/Game/Autoload/Events/ShaderManager.gd
new file mode 100644
index 0000000..a503c52
--- /dev/null
+++ b/game/src/Game/Autoload/Events/ShaderManager.gd
@@ -0,0 +1,48 @@
+extends RefCounted
+
+const param_province_shape_tex : StringName = &"province_shape_tex"
+const param_province_shape_subdivisions : StringName = &"province_shape_subdivisions"
+const param_province_colour_tex : StringName = &"province_colour_tex"
+const param_hover_index : StringName = &"hover_index"
+const param_selected_index : StringName = &"selected_index"
+const param_terrain_tex : StringName = &"terrain_tex"
+const param_terrain_tile_factor : StringName = &"terrain_tile_factor"
+
+func set_up_shader(material : Material, add_cosmetic_textures : bool) -> Error:
+ # Shader Material
+ if material == null:
+ push_error("material is null!")
+ return FAILED
+ if not material is ShaderMaterial:
+ push_error("Invalid map mesh material class: ", material.get_class())
+ return FAILED
+ var shader_material : ShaderMaterial = material
+
+ # Province shape texture
+ var province_shape_texture := GameSingleton.get_province_shape_texture()
+ if province_shape_texture == null:
+ push_error("Failed to get province shape texture!")
+ return FAILED
+ shader_material.set_shader_parameter(param_province_shape_tex, province_shape_texture)
+ var subdivisions := GameSingleton.get_province_shape_image_subdivisions()
+ if subdivisions.x < 1 or subdivisions.y < 1:
+ push_error("Invalid province shape image subdivision: ", subdivisions.x, "x", subdivisions.y)
+ return FAILED
+ shader_material.set_shader_parameter(param_province_shape_subdivisions, Vector2(subdivisions))
+
+ if add_cosmetic_textures:
+ # Province colour texture
+ var map_province_colour_texture := GameSingleton.get_province_colour_texture()
+ if map_province_colour_texture == null:
+ push_error("Failed to get province colour image!")
+ return FAILED
+ shader_material.set_shader_parameter(param_province_colour_tex, map_province_colour_texture)
+
+ # Terrain texture
+ var terrain_texture := GameSingleton.get_terrain_texture()
+ if terrain_texture == null:
+ push_error("Failed to get terrain texture!")
+ return FAILED
+ shader_material.set_shader_parameter(param_terrain_tex, terrain_texture)
+
+ return OK
diff --git a/game/src/Game/Autoload/GuiScale.gd b/game/src/Game/Autoload/GuiScale.gd
new file mode 100644
index 0000000..afd73df
--- /dev/null
+++ b/game/src/Game/Autoload/GuiScale.gd
@@ -0,0 +1,62 @@
+extends Node
+
+const error_guiscale : float = -1.0
+
+@export
+var minimum_guiscale : float = 0.1
+
+const _starting_guiscales : Dictionary = {
+ float(0.5) : &"0.5x",
+ float(0.75): &"0.75x",
+ float(1) : &"1x",
+ float(1.5) : &"1.5x",
+ float(2) : &"2x",
+}
+
+var _guiscales: Dictionary
+
+#Similar to Resolution.gd, but we don't bother checking for strings from files
+#and we have floats instead of vector2 integers
+
+func _ready():
+ assert(minimum_guiscale > 0, "Minimum gui scale must be positive")
+ for guiscale_value in _starting_guiscales:
+ add_guiscale(guiscale_value, _starting_guiscales[guiscale_value])
+ assert(not _guiscales.is_empty(), "No valid starting gui scales!")
+
+func has_guiscale(guiscale_value : float) -> bool:
+ return guiscale_value in _guiscales
+
+func add_guiscale(guiscale_value: float, guiscale_name: StringName=&"") -> bool:
+ if has_guiscale(guiscale_value): return true
+ var scale_dict := { value = guiscale_value }
+ if not guiscale_name.is_empty():
+ scale_dict.display_name = guiscale_name
+ else:
+ scale_dict.display_name = StringName("%sx" % guiscale_value)
+ if guiscale_value < minimum_guiscale:
+ push_error("GUI scale %s is smaller than the minimum %s" % [scale_dict.display_name, minimum_guiscale])
+ return false
+ _guiscales[guiscale_value] = scale_dict
+ return true
+
+#returns floats
+func get_guiscale_value_list() -> Array:
+ var list := _guiscales.keys()
+ list.sort_custom(func(a, b): return a > b)
+ return list
+
+func get_guiscale_display_name(guiscale_value : float) -> StringName:
+ return _guiscales.get(guiscale_value, {display_name = &"unknown gui scale"}).display_name
+
+func get_current_guiscale() -> float:
+ return get_tree().root.content_scale_factor
+
+func set_guiscale(guiscale:float) -> void:
+ print("New GUI scale: %f" % guiscale)
+ if not has_guiscale(guiscale):
+ push_warning("Setting GUI Scale to non-standard value %sx" % [guiscale])
+ get_tree().root.content_scale_factor = guiscale
+
+func reset_guiscale() -> void:
+ set_guiscale(get_current_guiscale())
diff --git a/game/src/Game/Autoload/Resolution.gd b/game/src/Game/Autoload/Resolution.gd
new file mode 100644
index 0000000..c973ba9
--- /dev/null
+++ b/game/src/Game/Autoload/Resolution.gd
@@ -0,0 +1,101 @@
+extends Node
+
+signal resolution_added(value : Vector2i, name : StringName, display_name : StringName)
+signal resolution_changed(value : Vector2i)
+signal window_mode_changed(value : Window.Mode)
+
+const error_resolution : Vector2i = Vector2i(-1,-1)
+
+@export
+var minimum_resolution : Vector2i = Vector2i(1,1)
+
+const _starting_resolutions : Dictionary = {
+ Vector2i(3840,2160): &"4K",
+ Vector2i(2560,1080): &"UW1080p",
+ Vector2i(1920,1080): &"1080p",
+ Vector2i(1366,768) : &"",
+ Vector2i(1536,864) : &"",
+ Vector2i(1280,720) : &"720p",
+ Vector2i(1440,900) : &"",
+ Vector2i(1600,900) : &"",
+ Vector2i(1024,600) : &"",
+ Vector2i(800,600) : &""
+}
+
+var _resolutions : Dictionary
+
+const _regex_pattern : String = "(\\d+)\\s*[xX,]\\s*(\\d+)"
+var _regex : RegEx
+
+func _ready():
+ assert(minimum_resolution.x > 0 and minimum_resolution.y > 0, "Minimum resolution must be positive!")
+ for resolution_value in _starting_resolutions:
+ add_resolution(resolution_value, _starting_resolutions[resolution_value])
+ assert(not _resolutions.is_empty(), "No valid starting resolutions!")
+
+ _regex = RegEx.new()
+ var err := _regex.compile(_regex_pattern)
+ assert(err == OK, "Resolution RegEx failed to compile!")
+
+
+func has_resolution(resolution_value : Vector2i) -> bool:
+ return resolution_value in _resolutions
+
+func add_resolution(resolution_value : Vector2i, resolution_name : StringName = &"") -> bool:
+ if has_resolution(resolution_value): return true
+ var res_dict := { value = resolution_value, name = &"" }
+ var display_name := "%sx%s" % [resolution_value.x, resolution_value.y]
+ if not resolution_name.is_empty():
+ res_dict.name = resolution_name
+ display_name = "%s (%s)" % [display_name, resolution_name]
+ res_dict.display_name = StringName(display_name)
+ if resolution_value.x < minimum_resolution.x or resolution_value.y < minimum_resolution.y:
+ push_error("Resolution %s is smaller than minimum (%sx%s)" % [res_dict.display_name, minimum_resolution.x, minimum_resolution.y])
+ return false
+ resolution_added.emit(resolution_value, resolution_name, display_name)
+ _resolutions[resolution_value] = res_dict
+ return true
+
+func get_resolution_value_list() -> Array:
+ var list := _resolutions.keys()
+ list.sort_custom(func(a, b): return a > b)
+ return list
+
+func get_resolution_name(resolution_value : Vector2i) -> StringName:
+ return _resolutions.get(resolution_value, { name = &"unknown resolution" }).name
+
+func get_resolution_display_name(resolution_value : Vector2i) -> StringName:
+ return _resolutions.get(resolution_value, { display_name = &"unknown resolution" }).display_name
+
+func get_resolution_value_from_string(resolution_string : String) -> Vector2i:
+ if not resolution_string.is_empty():
+ for resolution in _resolutions.values():
+ if resolution_string == resolution.name or resolution_string == resolution.display_name:
+ return resolution.value
+ var result := _regex.search(resolution_string)
+ if result: return Vector2i(result.get_string(1).to_int(), result.get_string(2).to_int())
+ return error_resolution
+
+func get_current_resolution() -> Vector2i:
+ var window := get_viewport().get_window()
+ match window.mode:
+ Window.MODE_EXCLUSIVE_FULLSCREEN, Window.MODE_FULLSCREEN:
+ return window.content_scale_size
+ _:
+ return window.size
+
+func set_resolution(resolution : Vector2i) -> void:
+ if not has_resolution(resolution):
+ push_warning("Setting resolution to non-standard value %sx%s" % [resolution.x, resolution.y])
+ var window := get_viewport().get_window()
+ if get_current_resolution() != resolution:
+ resolution_changed.emit(resolution)
+ match window.mode:
+ Window.MODE_EXCLUSIVE_FULLSCREEN, Window.MODE_FULLSCREEN:
+ window.content_scale_size = resolution
+ _:
+ window.size = resolution
+ window.content_scale_size = Vector2i(0,0)
+
+func reset_resolution() -> void:
+ set_resolution(get_current_resolution())
diff --git a/game/src/Game/Autoload/SaveManager.gd b/game/src/Game/Autoload/SaveManager.gd
new file mode 100644
index 0000000..fb7806b
--- /dev/null
+++ b/game/src/Game/Autoload/SaveManager.gd
@@ -0,0 +1,55 @@
+extends Node
+
+# Requirements
+# * FS-28
+const save_directory_setting := &"openvic/data/saves_directory"
+
+var current_save : SaveResource
+var current_session_tag : StringName
+
+var _save_dictionary : Dictionary = {}
+var _dirty_save : SaveResource
+
+func _ready():
+ var saves_dir_path : String = ProjectSettings.get_setting_with_override(save_directory_setting)
+ assert(saves_dir_path != null, "'%s' setting could not be found." % save_directory_setting)
+
+ DirAccess.make_dir_recursive_absolute(saves_dir_path)
+ var saves_dir := DirAccess.open(saves_dir_path)
+ for file in saves_dir.get_files():
+ var save := SaveResource.new()
+ save.load_save(saves_dir_path.path_join(file))
+ add_or_replace_save(save, true)
+
+func get_save_file_name(save_name : StringName, session_tag : StringName = current_session_tag) -> StringName:
+ return ("%s - %s" % [save_name, session_tag]).validate_filename()
+
+func make_new_save(save_name : String, session_tag : StringName = current_session_tag) -> SaveResource:
+ var file_name := get_save_file_name(save_name, session_tag) + ".tres"
+ var new_save := SaveResource.new()
+ new_save.set_file_path(save_name, ProjectSettings.get_setting_with_override(save_directory_setting).path_join(file_name))
+ print(new_save.file_path)
+ new_save.session_tag = session_tag
+ return new_save
+
+func has_save(save_name : StringName, session_tag : StringName = current_session_tag) -> bool:
+ return _save_dictionary.has(get_save_file_name(save_name, session_tag))
+
+func add_or_replace_save(save : SaveResource, ignore_dirty : bool = false) -> void:
+ var binded_func := _on_save_deleted_or_moved.bind(save)
+ save.deleted.connect(binded_func)
+ save.trash_moved.connect(binded_func)
+ _save_dictionary[get_save_file_name(save.save_name, save.session_tag)] = save
+ if not ignore_dirty:
+ _dirty_save = save
+
+func delete_save(save : SaveResource) -> void:
+ save.delete()
+
+func flush_save() -> void:
+ if _dirty_save == null: return
+ _dirty_save.flush_save()
+ _dirty_save = null
+
+func _on_save_deleted_or_moved(save : SaveResource) -> void:
+ _save_dictionary.erase(get_save_file_name(save.save_name, save.session_tag))
diff --git a/game/src/Game/Autoload/SoundManager.gd b/game/src/Game/Autoload/SoundManager.gd
new file mode 100644
index 0000000..c58ce1a
--- /dev/null
+++ b/game/src/Game/Autoload/SoundManager.gd
@@ -0,0 +1,42 @@
+extends Node
+
+# REQUIREMENTS:
+# * SS-68
+
+const _audio_directory_path : StringName = &"res://audio/sfx/"
+
+var _loaded_sound : Dictionary = {}
+
+var _bus_to_stream_player : Dictionary = {}
+
+# REQUIREMENTS:
+# * SND-10
+func _ready():
+ var dir = DirAccess.open(_audio_directory_path)
+ for fname in dir.get_files():
+ match fname.get_extension():
+ "ogg", "wav", "mp3":
+ _loaded_sound[fname.get_basename()] = load(_audio_directory_path.path_join(fname)) # SND-10
+
+func play_stream(sound : AudioStream, bus_type : String) -> void:
+ var player : AudioStreamPlayer = _bus_to_stream_player.get(bus_type)
+ if player == null:
+ player = AudioStreamPlayer.new()
+ player.bus = bus_type
+ player.stream = AudioStreamPolyphonic.new()
+ _bus_to_stream_player[bus_type] = player
+ add_child(player)
+ player.play()
+ var poly_playback : AudioStreamPlaybackPolyphonic = player.get_stream_playback()
+ poly_playback.play_stream(sound)
+
+func play(sound : String, bus_type : String) -> void:
+ play_stream(_loaded_sound[sound], bus_type)
+
+# REQUIREMENTS:
+# * SND-7
+func play_effect_stream(sound : AudioStream) -> void:
+ play_stream(sound, "SFX")
+
+func play_effect(sound : String) -> void:
+ play(sound, "SFX")
diff --git a/game/src/Game/GameMenu.gd b/game/src/Game/GameMenu.gd
new file mode 100644
index 0000000..4b589f9
--- /dev/null
+++ b/game/src/Game/GameMenu.gd
@@ -0,0 +1,47 @@
+extends Control
+
+@export var _main_menu : Control
+@export var _options_menu : Control
+@export var _lobby_menu : Control
+@export var _credits_menu : Control
+
+# REQUIREMENTS
+# * SS-10
+func _ready():
+ Events.Options.load_settings_from_file()
+
+func _on_main_menu_new_game_button_pressed():
+ _lobby_menu.show()
+ _main_menu.hide()
+
+# REQUIREMENTS
+# * SS-6
+# * UIFUN-5
+func _on_main_menu_options_button_pressed():
+ _options_menu.show()
+ _main_menu.hide()
+
+
+func _on_options_menu_back_button_pressed():
+ _main_menu.show()
+ _options_menu.hide()
+
+
+func _on_lobby_menu_back_button_pressed():
+ _main_menu.show()
+ _lobby_menu.hide()
+
+
+func _on_credits_back_button_pressed():
+ _credits_menu.hide()
+ _main_menu.show()
+
+
+func _on_main_menu_credits_button_pressed():
+ _credits_menu.show()
+ _main_menu.hide()
+
+
+
+func _on_splash_container_splash_end():
+ show()
diff --git a/game/src/Game/GameMenu.tscn b/game/src/Game/GameMenu.tscn
new file mode 100644
index 0000000..224ae2e
--- /dev/null
+++ b/game/src/Game/GameMenu.tscn
@@ -0,0 +1,53 @@
+[gd_scene load_steps=7 format=3 uid="uid://o4u142w4qkln"]
+
+[ext_resource type="Script" path="res://src/GameMenu.gd" id="1_cafwe"]
+[ext_resource type="PackedScene" uid="uid://bp5n3mlu45ygw" path="res://src/MainMenu/MainMenu.tscn" id="2_2jbkh"]
+[ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="3_111lv"]
+[ext_resource type="PackedScene" uid="uid://c8knthxkwj1uj" path="res://src/CreditsMenu/CreditsMenu.tscn" id="4_n0hoo"]
+[ext_resource type="PackedScene" uid="uid://do60kx0d3nrh4" path="res://src/LobbyMenu/LobbyMenu.tscn" id="4_nofk1"]
+[ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/MusicConductor/MusicPlayer.tscn" id="6_lts1m"]
+
+[node name="GameMenu" type="Control" node_paths=PackedStringArray("_main_menu", "_options_menu", "_lobby_menu", "_credits_menu")]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+script = ExtResource("1_cafwe")
+_main_menu = NodePath("MainMenu")
+_options_menu = NodePath("OptionsMenu")
+_lobby_menu = NodePath("LobbyMenu")
+_credits_menu = NodePath("CreditsMenu")
+
+[node name="MainMenu" parent="." instance=ExtResource("2_2jbkh")]
+layout_mode = 1
+metadata/_edit_vertical_guides_ = [251.0, 269.0, 504.0, 523.0, 15.0, 759.0, 777.0]
+
+[node name="OptionsMenu" parent="." instance=ExtResource("3_111lv")]
+visible = false
+layout_mode = 1
+
+[node name="LobbyMenu" parent="." instance=ExtResource("4_nofk1")]
+visible = false
+layout_mode = 1
+
+[node name="CreditsMenu" parent="." instance=ExtResource("4_n0hoo")]
+visible = false
+layout_mode = 1
+
+[node name="MusicPlayer" parent="." instance=ExtResource("6_lts1m")]
+layout_mode = 1
+anchors_preset = 1
+anchor_left = 1.0
+anchor_right = 1.0
+offset_left = -184.0
+offset_right = -34.0
+grow_horizontal = 0
+
+[connection signal="credits_button_pressed" from="MainMenu" to="." method="_on_main_menu_credits_button_pressed"]
+[connection signal="new_game_button_pressed" from="MainMenu" to="." method="_on_main_menu_new_game_button_pressed"]
+[connection signal="options_button_pressed" from="MainMenu" to="." method="_on_main_menu_options_button_pressed"]
+[connection signal="back_button_pressed" from="OptionsMenu" to="." method="_on_options_menu_back_button_pressed"]
+[connection signal="back_button_pressed" from="LobbyMenu" to="." method="_on_lobby_menu_back_button_pressed"]
+[connection signal="back_button_pressed" from="CreditsMenu" to="." method="_on_credits_back_button_pressed"]
diff --git a/game/src/Game/GameSession/GameSession.gd b/game/src/Game/GameSession/GameSession.gd
new file mode 100644
index 0000000..5bb1c2f
--- /dev/null
+++ b/game/src/Game/GameSession/GameSession.gd
@@ -0,0 +1,16 @@
+extends Control
+
+@export var _game_session_menu : Control
+
+func _ready():
+ Events.Options.load_settings_from_file()
+ if GameSingleton.setup_game() != OK:
+ push_error("Failed to setup game")
+
+func _process(delta : float):
+ GameSingleton.try_tick()
+
+# REQUIREMENTS:
+# * SS-42
+func _on_game_session_menu_button_pressed() -> void:
+ _game_session_menu.visible = !_game_session_menu.visible
diff --git a/game/src/Game/GameSession/GameSession.tscn b/game/src/Game/GameSession/GameSession.tscn
new file mode 100644
index 0000000..188ccde
--- /dev/null
+++ b/game/src/Game/GameSession/GameSession.tscn
@@ -0,0 +1,95 @@
+[gd_scene load_steps=10 format=3 uid="uid://bgnupcshe1m7r"]
+
+[ext_resource type="Script" path="res://src/GameSession/GameSession.gd" id="1_eklvp"]
+[ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/MusicConductor/MusicPlayer.tscn" id="2_kt6aa"]
+[ext_resource type="PackedScene" uid="uid://g524p8lr574w" path="res://src/GameSession/MapControlPanel/MapControlPanel.tscn" id="3_afh6d"]
+[ext_resource type="PackedScene" uid="uid://dvdynl6eir40o" path="res://src/GameSession/GameSessionMenu.tscn" id="3_bvmqh"]
+[ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/GameSession/MapView.tscn" id="4_xkg5j"]
+[ext_resource type="PackedScene" uid="uid://byq323jbel48u" path="res://src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn" id="5_osjnn"]
+[ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="6_p5mnx"]
+[ext_resource type="PackedScene" uid="uid://dd8k3p7r3huwc" path="res://src/GameSession/GameSpeedPanel.tscn" id="7_myy4q"]
+[ext_resource type="PackedScene" uid="uid://d3g6wbvwflmyk" path="res://src/SaveLoadMenu/SaveLoadMenu.tscn" id="8_4g7ko"]
+
+[node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")]
+editor_description = "SS-102, UI-546"
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+script = ExtResource("1_eklvp")
+_game_session_menu = NodePath("GameSessionMenu")
+
+[node name="MapView" parent="." instance=ExtResource("4_xkg5j")]
+
+[node name="MapControlPanel" parent="." instance=ExtResource("3_afh6d")]
+layout_mode = 1
+anchors_preset = 3
+anchor_left = 1.0
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 0
+grow_vertical = 0
+
+[node name="ProvinceOverviewPanel" parent="." instance=ExtResource("5_osjnn")]
+layout_mode = 1
+
+[node name="GameSpeedPanel" parent="." instance=ExtResource("7_myy4q")]
+layout_mode = 0
+offset_right = 302.0
+offset_bottom = 31.0
+
+[node name="GameSessionMenu" parent="." instance=ExtResource("3_bvmqh")]
+visible = false
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -159.0
+offset_top = -165.0
+offset_right = 159.0
+offset_bottom = 165.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="OptionsMenu" parent="." instance=ExtResource("6_p5mnx")]
+visible = false
+layout_mode = 1
+
+[node name="SaveLoadMenu" parent="." instance=ExtResource("8_4g7ko")]
+visible = false
+layout_mode = 1
+anchors_preset = -1
+anchor_left = 0.5
+anchor_right = 0.5
+offset_left = -640.0
+offset_right = 640.0
+
+[node name="MusicPlayer" parent="." instance=ExtResource("2_kt6aa")]
+layout_mode = 1
+anchors_preset = 1
+anchor_left = 1.0
+anchor_right = 1.0
+offset_left = -150.0
+offset_right = 0.0
+grow_horizontal = 0
+
+[connection signal="map_view_camera_changed" from="MapView" to="MapControlPanel" method="_on_map_view_camera_changed"]
+[connection signal="game_session_menu_button_pressed" from="MapControlPanel" to="." method="_on_game_session_menu_button_pressed"]
+[connection signal="minimap_clicked" from="MapControlPanel" to="MapView" method="_on_minimap_clicked"]
+[connection signal="mouse_entered" from="MapControlPanel" to="MapView" method="_on_mouse_exited_viewport"]
+[connection signal="mouse_exited" from="MapControlPanel" to="MapView" method="_on_mouse_entered_viewport"]
+[connection signal="zoom_in_button_pressed" from="MapControlPanel" to="MapView" method="zoom_in"]
+[connection signal="zoom_out_button_pressed" from="MapControlPanel" to="MapView" method="zoom_out"]
+[connection signal="mouse_entered" from="ProvinceOverviewPanel" to="MapView" method="_on_mouse_exited_viewport"]
+[connection signal="mouse_exited" from="ProvinceOverviewPanel" to="MapView" method="_on_mouse_entered_viewport"]
+[connection signal="load_button_pressed" from="GameSessionMenu" to="SaveLoadMenu" method="show_for_load"]
+[connection signal="options_button_pressed" from="GameSessionMenu" to="OptionsMenu" method="show"]
+[connection signal="save_button_pressed" from="GameSessionMenu" to="SaveLoadMenu" method="show_for_save"]
+[connection signal="back_button_pressed" from="OptionsMenu" to="MapView" method="enable_processing"]
+[connection signal="back_button_pressed" from="OptionsMenu" to="OptionsMenu" method="hide"]
diff --git a/game/src/Game/GameSession/GameSessionMenu.gd b/game/src/Game/GameSession/GameSessionMenu.gd
new file mode 100644
index 0000000..23ef2ef
--- /dev/null
+++ b/game/src/Game/GameSession/GameSessionMenu.gd
@@ -0,0 +1,80 @@
+extends PanelContainer
+
+@export var _main_menu_scene : PackedScene
+
+@export var _main_menu_dialog : AcceptDialog
+@export var _quit_dialog : AcceptDialog
+
+var _main_menu_save_button : Button
+var _main_menu_save_separator : Control
+var _quit_save_button : Button
+var _quit_save_separator : Control
+
+signal save_button_pressed
+signal load_button_pressed
+signal options_button_pressed
+
+func _ready() -> void:
+ _main_menu_save_button = _main_menu_dialog.add_button("DIALOG_SAVE_AND_RESIGN", true, &"save_and_main_menu")
+ _quit_save_button = _quit_dialog.add_button("DIALOG_SAVE_AND_QUIT", true, &"save_and_quit")
+
+ # Neccessary to center the save buttons and preserve the reference to the separator elements
+ var dialog_hbox : HBoxContainer = _main_menu_dialog.get_child(2, true)
+ var index := _main_menu_save_button.get_index(true)
+ dialog_hbox.move_child(_main_menu_save_button, _main_menu_dialog.get_ok_button().get_index(true))
+ dialog_hbox.move_child(_main_menu_dialog.get_ok_button(), index)
+ _main_menu_save_separator = dialog_hbox.get_child(_main_menu_save_button.get_index(true) - 1)
+
+ dialog_hbox = _quit_dialog.get_child(2, true)
+ index = _quit_save_button.get_index(true)
+ dialog_hbox.move_child(_quit_save_button, _quit_dialog.get_ok_button().get_index(true))
+ dialog_hbox.move_child(_quit_dialog.get_ok_button(), index)
+ _quit_save_separator = dialog_hbox.get_child(_quit_save_button.get_index(true) - 1)
+
+func hide_save_dialog_button() -> void:
+ _main_menu_save_button.hide()
+ _main_menu_save_separator.hide()
+ _quit_save_button.hide()
+ _quit_save_separator.hide()
+
+func show_save_dialog_button() -> void:
+ _main_menu_save_button.show()
+ _main_menu_save_separator.show()
+ _quit_save_button.show()
+ _quit_save_separator.show()
+
+# REQUIREMENTS:
+# * SS-47
+# * UIFUN-69
+func _on_main_menu_confirmed() -> void:
+ SaveManager.current_session_tag = ""
+ SaveManager.current_save = null
+ get_tree().change_scene_to_packed(_main_menu_scene)
+
+# REQUIREMENTS:
+# * SS-48
+# * UIFUN-70
+func _on_quit_confirmed() -> void:
+ get_tree().quit()
+
+# REQUIREMENTS:
+# * SS-7, SS-46
+# * UIFUN-11
+func _on_options_button_pressed() -> void:
+ options_button_pressed.emit()
+
+func _on_main_menu_dialog_custom_action(action) -> void:
+ match action:
+ &"save_and_main_menu":
+ _on_main_menu_confirmed()
+
+func _on_quit_dialog_custom_action(action : StringName) -> void:
+ match action:
+ &"save_and_quit":
+ _on_quit_confirmed()
+
+func _on_save_button_pressed():
+ save_button_pressed.emit()
+
+func _on_load_button_pressed():
+ load_button_pressed.emit()
diff --git a/game/src/Game/GameSession/GameSessionMenu.tscn b/game/src/Game/GameSession/GameSessionMenu.tscn
new file mode 100644
index 0000000..025ef3b
--- /dev/null
+++ b/game/src/Game/GameSession/GameSessionMenu.tscn
@@ -0,0 +1,91 @@
+[gd_scene load_steps=4 format=3 uid="uid://dvdynl6eir40o"]
+
+[ext_resource type="Theme" uid="uid://cqrfmjt5yeti7" path="res://theme/game_session_menu.tres" id="1_2onog"]
+[ext_resource type="Script" path="res://src/GameSession/GameSessionMenu.gd" id="1_usq6o"]
+[ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="2_xi6a4"]
+
+[node name="GameSessionMenu" type="PanelContainer" node_paths=PackedStringArray("_main_menu_dialog", "_quit_dialog")]
+process_mode = 3
+editor_description = "UI-68"
+theme = ExtResource("1_2onog")
+theme_type_variation = &"SessionPanel"
+script = ExtResource("1_usq6o")
+_main_menu_scene = ExtResource("2_xi6a4")
+_main_menu_dialog = NodePath("MainMenuDialog")
+_quit_dialog = NodePath("QuitDialog")
+
+[node name="ButtonListMargin" type="MarginContainer" parent="."]
+layout_mode = 2
+theme_override_constants/margin_left = 10
+theme_override_constants/margin_top = 10
+theme_override_constants/margin_right = 10
+theme_override_constants/margin_bottom = 10
+
+[node name="ButtonList" type="VBoxContainer" parent="ButtonListMargin"]
+layout_mode = 2
+
+[node name="SaveButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "UI-69"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_SAVE"
+
+[node name="LoadButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "UI-70"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_LOAD"
+
+[node name="OptionsButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "UI-10"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_OPTIONS"
+
+[node name="MainMenuButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "UI-71"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_MAINMENU"
+
+[node name="QuitButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "UI-72"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_QUIT"
+
+[node name="CloseSeparator" type="HSeparator" parent="ButtonListMargin/ButtonList"]
+layout_mode = 2
+theme_type_variation = &"SessionSeparator"
+
+[node name="CloseButton" type="Button" parent="ButtonListMargin/ButtonList"]
+editor_description = "SS-64, UI-80, UIFUN-79"
+layout_mode = 2
+theme_type_variation = &"SessionButton"
+text = "GAMESESSIONMENU_CLOSE"
+
+[node name="MainMenuDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "GAMESESSIONMENU_MAINMENU_DIALOG_TITLE"
+size = Vector2i(384, 100)
+ok_button_text = "DIALOG_OK"
+dialog_text = "GAMESESSIONMENU_MAINMENU_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[node name="QuitDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "GAMESESSIONMENU_QUIT_DIALOG_TITLE"
+ok_button_text = "DIALOG_OK"
+dialog_text = "GAMESESSIONMENU_QUIT_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[connection signal="pressed" from="ButtonListMargin/ButtonList/SaveButton" to="." method="_on_save_button_pressed"]
+[connection signal="pressed" from="ButtonListMargin/ButtonList/LoadButton" to="." method="_on_load_button_pressed"]
+[connection signal="pressed" from="ButtonListMargin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"]
+[connection signal="pressed" from="ButtonListMargin/ButtonList/MainMenuButton" to="MainMenuDialog" method="popup_centered"]
+[connection signal="pressed" from="ButtonListMargin/ButtonList/QuitButton" to="QuitDialog" method="popup_centered"]
+[connection signal="pressed" from="ButtonListMargin/ButtonList/CloseButton" to="." method="hide"]
+[connection signal="confirmed" from="MainMenuDialog" to="." method="_on_main_menu_confirmed"]
+[connection signal="custom_action" from="MainMenuDialog" to="." method="_on_main_menu_dialog_custom_action"]
+[connection signal="confirmed" from="QuitDialog" to="." method="_on_quit_confirmed"]
+[connection signal="custom_action" from="QuitDialog" to="." method="_on_quit_dialog_custom_action"]
diff --git a/game/src/Game/GameSession/GameSpeedPanel.gd b/game/src/Game/GameSession/GameSpeedPanel.gd
new file mode 100644
index 0000000..80708b1
--- /dev/null
+++ b/game/src/Game/GameSession/GameSpeedPanel.gd
@@ -0,0 +1,37 @@
+extends PanelContainer
+
+#UI-74 UI-75 UI-76 UI-77
+
+@export var _longform_date_button : Button
+@export var _play_pause_display_button : Button
+@export var _decrease_speed_button : Button
+@export var _increase_speed_button : Button
+
+func _ready():
+ GameSingleton.state_updated.connect(_update_buttons)
+ _update_buttons()
+
+func _update_buttons():
+ _play_pause_display_button.text = "⏸ " if GameSingleton.is_paused() else "▶"
+
+ _increase_speed_button.disabled = not GameSingleton.can_increase_speed()
+ _decrease_speed_button.disabled = not GameSingleton.can_decrease_speed()
+
+ _longform_date_button.text = GameSingleton.get_longform_date()
+
+
+func _on_decrease_speed_button_pressed():
+ GameSingleton.decrease_speed()
+ _update_buttons()
+
+func _on_increase_speed_button_pressed():
+ GameSingleton.increase_speed()
+ _update_buttons()
+
+func _on_play_pause_display_button_pressed():
+ GameSingleton.toggle_paused()
+ _update_buttons()
+
+func _on_longform_date_label_pressed():
+ GameSingleton.toggle_paused()
+ _update_buttons()
diff --git a/game/src/Game/GameSession/GameSpeedPanel.tscn b/game/src/Game/GameSession/GameSpeedPanel.tscn
new file mode 100644
index 0000000..8a37565
--- /dev/null
+++ b/game/src/Game/GameSession/GameSpeedPanel.tscn
@@ -0,0 +1,38 @@
+[gd_scene load_steps=2 format=3 uid="uid://dd8k3p7r3huwc"]
+
+[ext_resource type="Script" path="res://src/GameSession/GameSpeedPanel.gd" id="1_pfs8t"]
+
+[node name="GameSpeedPanel" type="PanelContainer" node_paths=PackedStringArray("_longform_date_button", "_play_pause_display_button", "_decrease_speed_button", "_increase_speed_button")]
+script = ExtResource("1_pfs8t")
+_longform_date_button = NodePath("ButtonList/LongformDateButton")
+_play_pause_display_button = NodePath("ButtonList/PlayPauseDisplayButton")
+_decrease_speed_button = NodePath("ButtonList/DecreaseSpeedButton")
+_increase_speed_button = NodePath("ButtonList/IncreaseSpeedButton")
+
+[node name="ButtonList" type="HBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="LongformDateButton" type="Button" parent="ButtonList"]
+custom_minimum_size = Vector2(200, 0)
+layout_mode = 2
+text = "LONGFORM DATE"
+
+[node name="PlayPauseDisplayButton" type="Button" parent="ButtonList"]
+custom_minimum_size = Vector2(30, 0)
+layout_mode = 2
+text = "⏸ "
+
+[node name="DecreaseSpeedButton" type="Button" parent="ButtonList"]
+custom_minimum_size = Vector2(30, 0)
+layout_mode = 2
+text = "-"
+
+[node name="IncreaseSpeedButton" type="Button" parent="ButtonList"]
+custom_minimum_size = Vector2(30, 0)
+layout_mode = 2
+text = "+"
+
+[connection signal="pressed" from="ButtonList/LongformDateButton" to="." method="_on_longform_date_label_pressed"]
+[connection signal="pressed" from="ButtonList/PlayPauseDisplayButton" to="." method="_on_play_pause_display_button_pressed"]
+[connection signal="pressed" from="ButtonList/DecreaseSpeedButton" to="." method="_on_decrease_speed_button_pressed"]
+[connection signal="pressed" from="ButtonList/IncreaseSpeedButton" to="." method="_on_increase_speed_button_pressed"]
diff --git a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
new file mode 100644
index 0000000..0cef057
--- /dev/null
+++ b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
@@ -0,0 +1,57 @@
+extends PanelContainer
+
+signal game_session_menu_button_pressed
+signal map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2)
+signal minimap_clicked(pos_clicked : Vector2)
+signal zoom_in_button_pressed
+signal zoom_out_button_pressed
+
+@export var _mapmodes_grid : GridContainer
+
+var _mapmode_button_group : ButtonGroup
+
+# REQUIREMENTS:
+# * UI-550, UI-552, UI-554, UI-561
+func _add_mapmode_button(identifier : String) -> void:
+ var button := Button.new()
+ button.text = identifier
+ button.tooltip_text = identifier
+ button.toggle_mode = true
+ button.button_group = _mapmode_button_group
+ button.mouse_filter = MOUSE_FILTER_PASS
+ _mapmodes_grid.add_child(button)
+ if _mapmode_button_group.get_pressed_button() == null:
+ button.button_pressed = true
+
+func _ready():
+ _mapmode_button_group = ButtonGroup.new()
+ _mapmode_button_group.pressed.connect(_mapmode_pressed)
+ for index in GameSingleton.get_mapmode_count():
+ _add_mapmode_button(GameSingleton.get_mapmode_identifier(index))
+
+# REQUIREMENTS:
+# * UIFUN-10
+func _on_game_session_menu_button_pressed() -> void:
+ game_session_menu_button_pressed.emit()
+
+# REQUIREMENTS:
+# * SS-76
+# * UIFUN-129, UIFUN-131, UIFUN-133
+func _mapmode_pressed(button : BaseButton) -> void:
+ GameSingleton.set_mapmode(button.tooltip_text)
+
+func _on_map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2) -> void:
+ map_view_camera_changed.emit(near_left, far_left, far_right, near_right)
+
+func _on_minimap_clicked(pos_clicked : Vector2) -> void:
+ minimap_clicked.emit(pos_clicked)
+
+# REQUIREMENTS:
+# * UIFUN-269
+func _on_zoom_in_button_pressed() -> void:
+ zoom_in_button_pressed.emit()
+
+# REQUIREMENTS:
+# * UIFUN-270
+func _on_zoom_out_button_pressed() -> void:
+ zoom_out_button_pressed.emit()
diff --git a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn
new file mode 100644
index 0000000..bd4a010
--- /dev/null
+++ b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn
@@ -0,0 +1,107 @@
+[gd_scene load_steps=7 format=3 uid="uid://g524p8lr574w"]
+
+[ext_resource type="Script" path="res://src/GameSession/MapControlPanel/MapControlPanel.gd" id="1_ign64"]
+[ext_resource type="Shader" path="res://src/GameSession/MapControlPanel/Minimap.gdshader" id="2_rinsg"]
+[ext_resource type="Script" path="res://src/GameSession/MapControlPanel/Minimap.gd" id="3_s4dml"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_bhuqb"]
+shader = ExtResource("2_rinsg")
+shader_parameter/province_shape_subdivisions = null
+shader_parameter/selected_index = null
+
+[sub_resource type="InputEventAction" id="InputEventAction_5nck3"]
+action = &"ui_cancel"
+
+[sub_resource type="Shortcut" id="Shortcut_fc1tk"]
+events = [SubResource("InputEventAction_5nck3")]
+
+[node name="MapControlPanel" type="PanelContainer" node_paths=PackedStringArray("_mapmodes_grid")]
+editor_description = "SS-103, UI-548"
+mouse_filter = 1
+script = ExtResource("1_ign64")
+_mapmodes_grid = NodePath("MapPanelMargin/MapPanelList/MapDisplayList/MapmodesGrid")
+
+[node name="MapPanelMargin" type="MarginContainer" parent="."]
+layout_mode = 2
+theme_override_constants/margin_left = 5
+theme_override_constants/margin_top = 5
+theme_override_constants/margin_right = 5
+theme_override_constants/margin_bottom = 5
+
+[node name="MapPanelList" type="HBoxContainer" parent="MapPanelMargin"]
+layout_mode = 2
+theme_override_constants/separation = 6
+alignment = 1
+
+[node name="MapDisplayList" type="VBoxContainer" parent="MapPanelMargin/MapPanelList"]
+layout_mode = 2
+alignment = 1
+
+[node name="MapmodesGrid" type="GridContainer" parent="MapPanelMargin/MapPanelList/MapDisplayList"]
+editor_description = "UI-750"
+layout_mode = 2
+columns = 11
+
+[node name="Minimap" type="PanelContainer" parent="MapPanelMargin/MapPanelList/MapDisplayList"]
+editor_description = "UI-549"
+layout_mode = 2
+size_flags_horizontal = 4
+size_flags_vertical = 4
+mouse_filter = 1
+
+[node name="MinimapTexture" type="ColorRect" parent="MapPanelMargin/MapPanelList/MapDisplayList/Minimap"]
+editor_description = "UI-751, FS-338"
+material = SubResource("ShaderMaterial_bhuqb")
+layout_mode = 2
+color = Color(0.921569, 0.835294, 0.701961, 1)
+
+[node name="ViewportQuad" type="Control" parent="MapPanelMargin/MapPanelList/MapDisplayList/Minimap" node_paths=PackedStringArray("_minimap_texture")]
+layout_mode = 2
+mouse_filter = 1
+script = ExtResource("3_s4dml")
+_minimap_texture = NodePath("../MinimapTexture")
+
+[node name="AuxiliaryPanel" type="VBoxContainer" parent="MapPanelMargin/MapPanelList"]
+editor_description = "UI-761"
+layout_mode = 2
+
+[node name="GameSessionMenuButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
+editor_description = "UI-9"
+layout_mode = 2
+mouse_filter = 1
+shortcut = SubResource("Shortcut_fc1tk")
+text = "ESC"
+
+[node name="LedgerButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
+editor_description = "UI-860"
+layout_mode = 2
+mouse_filter = 1
+text = "L"
+
+[node name="FindButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
+editor_description = "UI-861"
+layout_mode = 2
+mouse_filter = 1
+text = "F"
+
+[node name="ZoomButtonsContainer" type="HBoxContainer" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
+layout_mode = 2
+alignment = 1
+
+[node name="ZoomInButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"]
+editor_description = "UI-862"
+layout_mode = 2
+mouse_filter = 1
+text = "+"
+
+[node name="ZoomOutButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"]
+editor_description = "UI-863"
+layout_mode = 2
+mouse_filter = 1
+text = "-"
+
+[connection signal="map_view_camera_changed" from="." to="MapPanelMargin/MapPanelList/MapDisplayList/Minimap/ViewportQuad" method="_on_map_view_camera_changed"]
+[connection signal="minimap_clicked" from="MapPanelMargin/MapPanelList/MapDisplayList/Minimap/ViewportQuad" to="." method="_on_minimap_clicked"]
+[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/GameSessionMenuButton" to="." method="_on_game_session_menu_button_pressed"]
+[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer/ZoomInButton" to="." method="_on_zoom_in_button_pressed"]
+[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer/ZoomOutButton" to="." method="_on_zoom_out_button_pressed"]
diff --git a/game/src/Game/GameSession/MapControlPanel/Minimap.gd b/game/src/Game/GameSession/MapControlPanel/Minimap.gd
new file mode 100644
index 0000000..1f9b75e
--- /dev/null
+++ b/game/src/Game/GameSession/MapControlPanel/Minimap.gd
@@ -0,0 +1,105 @@
+extends Control
+
+signal minimap_clicked(pos_clicked : Vector2)
+
+const _action_click : StringName = &"map_click"
+
+@export var _minimap_texture : Control
+var _minimap_shader : ShaderMaterial
+
+var _viewport_points : PackedVector2Array
+
+func _ready():
+ _minimap_texture.custom_minimum_size = Vector2(GameSingleton.get_aspect_ratio(), 1.0) * 150
+ var minimap_material := _minimap_texture.get_material()
+ if Events.ShaderManager.set_up_shader(minimap_material, false) != OK:
+ push_error("Failed to set up minimap shader")
+ else:
+ _minimap_shader = minimap_material
+ GameSingleton.province_selected.connect(_on_province_selected)
+
+func _on_province_selected(index : int) -> void:
+ if _minimap_shader != null:
+ _minimap_shader.set_shader_parameter(Events.ShaderManager.param_selected_index, index)
+
+# REQUIREMENTS
+# * SS-80
+# * UI-752
+func _draw() -> void:
+ if _viewport_points.size() > 1:
+ draw_multiline(_viewport_points, Color.WHITE, -1)
+
+# REQUIREMENTS
+# * SS-81
+# * UIFUN-127
+func _unhandled_input(event : InputEvent):
+ if event is InputEventMouse and Input.is_action_pressed(_action_click):
+ var pos_clicked := get_local_mouse_position() / size - Vector2(0.5, 0.5)
+ if abs(pos_clicked.x) < 0.5 and abs(pos_clicked.y) < 0.5:
+ minimap_clicked.emit(pos_clicked)
+
+# Returns the point on the line going through p and q with the specific x coord
+func _intersect_x(p : Vector2, q : Vector2, x : float) -> Vector2:
+ if p.x == q.x:
+ return Vector2(x, 0.5 * (p.y + q.y))
+ var t := (x - q.x) / (p.x - q.x)
+ return q + t * (p - q)
+
+# Returns the point on the line going through p and q with the specific y coord
+func _intersect_y(p : Vector2, q : Vector2, y : float) -> Vector2:
+ if p.y == q.y:
+ return Vector2(0.5 * (p.x + q.x), y)
+ var t := (y - q.y) / (p.y - q.y)
+ return q + t * (p - q)
+
+const _one_x := Vector2(1, 0)
+
+func _add_line_looped_over_x(left : Vector2, right : Vector2) -> void:
+ if left.x < 0:
+ if right.x < 0:
+ _viewport_points.push_back(left + _one_x)
+ _viewport_points.push_back(right + _one_x)
+ else:
+ var mid_point := _intersect_x(left, right, 0)
+ _viewport_points.push_back(mid_point)
+ _viewport_points.push_back(right)
+ mid_point.x = 1
+ _viewport_points.push_back(left + _one_x)
+ _viewport_points.push_back(mid_point)
+ elif right.x > 1:
+ if left.x > 1:
+ _viewport_points.push_back(left - _one_x)
+ _viewport_points.push_back(right - _one_x)
+ else:
+ var mid_point := _intersect_x(left, right, 1)
+ _viewport_points.push_back(left)
+ _viewport_points.push_back(mid_point)
+ mid_point.x = 0
+ _viewport_points.push_back(mid_point)
+ _viewport_points.push_back(right - _one_x)
+ else:
+ _viewport_points.push_back(left)
+ _viewport_points.push_back(right)
+
+# This can break if the viewport is rotated too far!
+func _on_map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2) -> void:
+ # Bound far y coords
+ if far_left.y < 0:
+ far_left = _intersect_y(near_left, far_left, 0)
+ if far_right.y < 0:
+ far_right = _intersect_y(near_right, far_right, 0)
+ # Bound near y coords
+ if near_left.y > 1:
+ near_left = _intersect_y(near_left, far_left, 1)
+ if near_right.y > 1:
+ near_right = _intersect_y(near_right, far_right, 1)
+
+ _viewport_points.clear()
+ _add_line_looped_over_x(near_left, near_right)
+ _add_line_looped_over_x(far_left, far_right)
+ _add_line_looped_over_x(far_left, near_left)
+ _add_line_looped_over_x(near_right, far_right)
+
+ for i in _viewport_points.size():
+ _viewport_points[i] *= size
+ queue_redraw()
diff --git a/game/src/Game/GameSession/MapControlPanel/Minimap.gdshader b/game/src/Game/GameSession/MapControlPanel/Minimap.gdshader
new file mode 100644
index 0000000..608abe2
--- /dev/null
+++ b/game/src/Game/GameSession/MapControlPanel/Minimap.gdshader
@@ -0,0 +1,18 @@
+shader_type canvas_item;
+
+#include "res://src/GameSession/ProvinceIndexSampler.gdshaderinc"
+
+// Index of the currently selected province
+uniform uint selected_index;
+
+const vec3 land_colour = vec3(0.5);
+const vec3 selected_colour = vec3(1.0, 1.0, 0.0);
+
+void fragment() {
+ uvec3 data = read_uvec3(UV);
+ uint index = uvec2_to_uint(data.rg);
+ float is_land = float(data.b != 0u);
+ float is_selected = float(index == selected_index);
+ COLOR.rgb = mix(COLOR.rgb, land_colour, is_land);
+ COLOR.rgb = mix(COLOR.rgb, selected_colour, is_selected);
+}
diff --git a/game/src/Game/GameSession/MapView.gd b/game/src/Game/GameSession/MapView.gd
new file mode 100644
index 0000000..ced8bb7
--- /dev/null
+++ b/game/src/Game/GameSession/MapView.gd
@@ -0,0 +1,242 @@
+extends Node3D
+
+signal map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2)
+
+const _action_north : StringName = &"map_north"
+const _action_east : StringName = &"map_east"
+const _action_south : StringName = &"map_south"
+const _action_west : StringName = &"map_west"
+const _action_zoom_in : StringName = &"map_zoom_in"
+const _action_zoom_out : StringName = &"map_zoom_out"
+const _action_drag : StringName = &"map_drag"
+const _action_click : StringName = &"map_click"
+
+@export var _camera : Camera3D
+
+@export var _cardinal_move_speed : float = 1.0
+@export var _edge_move_threshold: float = 0.01
+@export var _edge_move_speed: float = 2.5
+var _drag_anchor : Vector2
+var _drag_active : bool = false
+
+var _mouse_over_viewport : bool = true
+
+@export var _zoom_target_min : float = 0.05
+@export var _zoom_target_max : float = 5.0
+@export var _zoom_target_step : float = 0.1
+@export var _zoom_epsilon : float = _zoom_target_step * 0.1
+@export var _zoom_speed : float = 5.0
+@export var _zoom_target : float = 1.0:
+ get: return _zoom_target
+ set(v): _zoom_target = clamp(v, _zoom_target_min, _zoom_target_max)
+
+@export var _map_mesh_instance : MeshInstance3D
+var _map_mesh : MapMesh
+var _map_shader_material : ShaderMaterial
+var _map_mesh_corner : Vector2
+var _map_mesh_dims : Vector2
+
+var _mouse_pos_viewport : Vector2 = Vector2(0.5, 0.5)
+var _mouse_pos_map : Vector2 = Vector2(0.5, 0.5)
+var _viewport_dims : Vector2 = Vector2(1, 1)
+
+# ??? Strange Godot/GDExtension Bug ???
+# Upon first opening a clone of this repo with the Godot Editor,
+# if GameSingleton.get_province_index_image is called before MapMesh
+# is referenced in the script below, then the editor will crash due
+# to a failed HashMap lookup. I'm not sure if this is a bug in the
+# editor, GDExtension, my own extension, or a combination of them.
+# This was an absolute pain to track down. --- hop311
+func _ready():
+ if _camera == null:
+ push_error("MapView's _camera variable hasn't been set!")
+ return
+ _zoom_target = _camera.position.y
+ if _map_mesh_instance == null:
+ push_error("MapView's _map_mesh variable hasn't been set!")
+ return
+
+ # Shader Material
+ var map_material := _map_mesh_instance.get_active_material(0)
+ if Events.ShaderManager.set_up_shader(map_material, true) != OK:
+ push_error("Failed to set up map shader")
+ return
+ _map_shader_material = map_material
+
+ if not _map_mesh_instance.mesh is MapMesh:
+ push_error("Invalid map mesh class: ", _map_mesh_instance.mesh.get_class(), "(expected MapMesh)")
+ return
+ _map_mesh = _map_mesh_instance.mesh
+
+ # Set map mesh size and get bounds
+ const pixels_per_terrain_tile : float = 32.0
+ _map_shader_material.set_shader_parameter(Events.ShaderManager.param_terrain_tile_factor,
+ float(GameSingleton.get_height()) / pixels_per_terrain_tile)
+ var map_mesh_aabb := _map_mesh.get_core_aabb() * _map_mesh_instance.transform
+ _map_mesh_corner = Vector2(
+ min(map_mesh_aabb.position.x, map_mesh_aabb.end.x),
+ min(map_mesh_aabb.position.z, map_mesh_aabb.end.z)
+ )
+ _map_mesh_dims = abs(Vector2(
+ map_mesh_aabb.position.x - map_mesh_aabb.end.x,
+ map_mesh_aabb.position.z - map_mesh_aabb.end.z
+ ))
+
+ GameSingleton.province_selected.connect(_on_province_selected)
+
+func _notification(what : int):
+ match what:
+ NOTIFICATION_WM_MOUSE_ENTER: # Mouse inside window
+ _on_mouse_entered_viewport()
+ NOTIFICATION_WM_MOUSE_EXIT: # Mouse out of window
+ _on_mouse_exited_viewport()
+
+func _world_to_map_coords(pos : Vector3) -> Vector2:
+ return (Vector2(pos.x, pos.z) - _map_mesh_corner) / _map_mesh_dims
+
+func _viewport_to_map_coords(pos_viewport : Vector2) -> Vector2:
+ var ray_origin := _camera.project_ray_origin(pos_viewport)
+ var ray_normal := _camera.project_ray_normal(pos_viewport)
+ # Plane with normal (0,1,0) facing upwards, at a distance 0 from the origin
+ var intersection = Plane(0, 1, 0, 0).intersects_ray(ray_origin, ray_normal)
+ if typeof(intersection) == TYPE_VECTOR3:
+ return _world_to_map_coords(intersection as Vector3)
+ else:
+ # Normals parallel to the xz-plane could cause null intersections,
+ # but the camera's orientation should prevent such normals
+ push_error("Invalid intersection: ", intersection)
+ return Vector2(0.5, 0.5)
+
+func zoom_in() -> void:
+ _zoom_target -= _zoom_target_step
+
+func zoom_out() -> void:
+ _zoom_target += _zoom_target_step
+
+func _on_province_selected(index : int) -> void:
+ _map_shader_material.set_shader_parameter(Events.ShaderManager.param_selected_index, index)
+
+# REQUIREMENTS
+# * SS-31
+func _unhandled_input(event : InputEvent):
+ if _mouse_over_viewport and event.is_action_pressed(_action_click):
+ # Check if the mouse is outside of bounds
+ if _map_mesh.is_valid_uv_coord(_mouse_pos_map):
+ GameSingleton.set_selected_province(GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map))
+ else:
+ print("Clicked outside the map!")
+ elif event.is_action_pressed(_action_drag):
+ if _drag_active:
+ push_warning("Drag being activated while already active!")
+ _drag_active = true
+ _drag_anchor = _mouse_pos_map
+ elif event.is_action_released(_action_drag):
+ if not _drag_active:
+ push_warning("Drag being deactivated while already not active!")
+ _drag_active = false
+ elif event.is_action_pressed(_action_zoom_in, true):
+ zoom_in()
+ elif event.is_action_pressed(_action_zoom_out, true):
+ zoom_out()
+
+func _physics_process(delta : float):
+ _mouse_pos_viewport = get_viewport().get_mouse_position()
+ _viewport_dims = Vector2(Resolution.get_current_resolution())
+ # Process movement
+ _movement_process(delta)
+ # Keep within map bounds
+ _clamp_over_map()
+ # Process zooming
+ _zoom_process(delta)
+ # Orient based on height
+ _update_orientation()
+ # Update viewport on minimap
+ _update_minimap_viewport()
+ # Calculate where the mouse lies on the map
+ _update_mouse_map_position()
+
+# REQUIREMENTS
+# * UIFUN-124
+func _movement_process(delta : float) -> void:
+ var direction : Vector2
+ if _drag_active:
+ direction = (_drag_anchor - _mouse_pos_map) * _map_mesh_dims
+ else:
+ direction = _edge_scrolling_vector() + _cardinal_movement_vector()
+ # Scale movement speed with height
+ direction *= _camera.position.y * delta
+ _camera.position += Vector3(direction.x, 0, direction.y)
+
+# REQUIREMENTS
+# * UIFUN-125
+func _edge_scrolling_vector() -> Vector2:
+ if not _mouse_over_viewport:
+ return Vector2()
+ var mouse_vector := _mouse_pos_viewport * GuiScale.get_current_guiscale() / _viewport_dims - Vector2(0.5, 0.5)
+ if abs(mouse_vector.x) < 0.5 - _edge_move_threshold and abs(mouse_vector.y) < 0.5 - _edge_move_threshold:
+ mouse_vector *= 0
+ return mouse_vector * _edge_move_speed
+
+# REQUIREMENTS
+# * SS-75
+func _cardinal_movement_vector() -> Vector2:
+ var move := Vector2(
+ float(Input.is_action_pressed(_action_east)) - float(Input.is_action_pressed(_action_west)),
+ float(Input.is_action_pressed(_action_south)) - float(Input.is_action_pressed(_action_north))
+ )
+ return move * _cardinal_move_speed
+
+func _clamp_over_map() -> void:
+ _camera.position.x = _map_mesh_corner.x + fposmod(_camera.position.x - _map_mesh_corner.x, _map_mesh_dims.x)
+ _camera.position.z = clamp(_camera.position.z, _map_mesh_corner.y, _map_mesh_corner.y + _map_mesh_dims.y)
+
+# REQUIREMENTS
+# * SS-74
+# * UIFUN-123
+func _zoom_process(delta : float) -> void:
+ var height := _camera.position.y
+ var zoom := _zoom_target - height
+ height += zoom * _zoom_speed * delta
+ var new_zoom := _zoom_target - height
+ # Set to target if height is within _zoom_epsilon of it or has overshot past it
+ if abs(new_zoom) < _zoom_epsilon or sign(zoom) != sign(new_zoom):
+ height = _zoom_target
+ _camera.position.y = height
+
+func _update_orientation() -> void:
+ var dir := Vector3(0, -1, -exp(-_camera.position.y - 1))
+ _camera.look_at(_camera.position + dir)
+
+func _update_minimap_viewport() -> void:
+ var near_left := _viewport_to_map_coords(Vector2(0, _viewport_dims.y))
+ var far_left := _viewport_to_map_coords(Vector2(0, 0))
+ var far_right := _viewport_to_map_coords(Vector2(_viewport_dims.x, 0))
+ var near_right := _viewport_to_map_coords(_viewport_dims)
+ map_view_camera_changed.emit(near_left, far_left, far_right, near_right)
+
+func _update_mouse_map_position() -> void:
+ _mouse_pos_map = _viewport_to_map_coords(_mouse_pos_viewport)
+ var hover_index := GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map)
+ if _mouse_over_viewport:
+ _map_shader_material.set_shader_parameter(Events.ShaderManager.param_hover_index, hover_index)
+
+func _on_mouse_entered_viewport():
+ _mouse_over_viewport = true
+
+func _on_mouse_exited_viewport():
+ _mouse_over_viewport = false
+ _map_shader_material.set_shader_parameter(Events.ShaderManager.param_hover_index, 0)
+
+func _on_minimap_clicked(pos_clicked : Vector2):
+ pos_clicked *= _map_mesh_dims
+ _camera.position.x = pos_clicked.x
+ _camera.position.z = pos_clicked.y
+ _clamp_over_map()
+
+func enable_processing() -> void:
+ set_process_unhandled_input(true)
+ set_physics_process(true)
+
+func disable_processing() -> void:
+ set_process_unhandled_input(false)
+ set_physics_process(false)
diff --git a/game/src/Game/GameSession/MapView.tscn b/game/src/Game/GameSession/MapView.tscn
new file mode 100644
index 0000000..fa6ffcd
--- /dev/null
+++ b/game/src/Game/GameSession/MapView.tscn
@@ -0,0 +1,30 @@
+[gd_scene load_steps=5 format=3 uid="uid://dkehmdnuxih2r"]
+
+[ext_resource type="Script" path="res://src/GameSession/MapView.gd" id="1_exccw"]
+[ext_resource type="Shader" path="res://src/GameSession/TerrainMap.gdshader" id="1_upocn"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_tayeg"]
+render_priority = 0
+shader = ExtResource("1_upocn")
+shader_parameter/province_shape_subdivisions = null
+shader_parameter/hover_index = null
+shader_parameter/selected_index = null
+shader_parameter/terrain_tile_factor = null
+
+[sub_resource type="MapMesh" id="MapMesh_3gtsd"]
+
+[node name="MapView" type="Node3D" node_paths=PackedStringArray("_camera", "_map_mesh_instance")]
+editor_description = "SS-73"
+script = ExtResource("1_exccw")
+_camera = NodePath("MapCamera")
+_map_mesh_instance = NodePath("MapMeshInstance")
+
+[node name="MapCamera" type="Camera3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0.25, 1.5, -2.75)
+near = 0.01
+
+[node name="MapMeshInstance" type="MeshInstance3D" parent="."]
+editor_description = "FS-343"
+transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0)
+material_override = SubResource("ShaderMaterial_tayeg")
+mesh = SubResource("MapMesh_3gtsd")
diff --git a/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc b/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc
new file mode 100644
index 0000000..65f73d8
--- /dev/null
+++ b/game/src/Game/GameSession/ProvinceIndexSampler.gdshaderinc
@@ -0,0 +1,18 @@
+
+// Province shape texture
+uniform sampler2DArray province_shape_tex : repeat_enable, filter_nearest;
+// Province shape subdivisions
+uniform vec2 province_shape_subdivisions;
+
+uvec3 vec3_to_uvec3(vec3 v) {
+ return uvec3(v * 255.0);
+}
+uvec3 read_uvec3(vec2 uv) {
+ uv *= province_shape_subdivisions;
+ vec2 subdivision_coords = mod(floor(uv), province_shape_subdivisions);
+ float idx = subdivision_coords.x + subdivision_coords.y * province_shape_subdivisions.x;
+ return vec3_to_uvec3(texture(province_shape_tex, vec3(uv, idx)).rgb);
+}
+uint uvec2_to_uint(uvec2 v) {
+ return (v.y << 8u) | v.x;
+}
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd
new file mode 100644
index 0000000..67060bf
--- /dev/null
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd
@@ -0,0 +1,122 @@
+extends PanelContainer
+
+@export var _province_name_label : Label
+@export var _region_name_label : Label
+@export var _life_rating_bar : ProgressBar
+@export var _rgo_icon_texture_rect : TextureRect
+@export var _rgo_name_label : Label
+@export var _buildings_container : Container
+
+const _missing_suffix : String = "_MISSING"
+
+var _selected_index : int:
+ get: return _selected_index
+ set(v):
+ _selected_index = v
+ update_info()
+var _province_info : Dictionary
+
+func _ready():
+ GameSingleton.province_selected.connect(_on_province_selected)
+ GameSingleton.state_updated.connect(update_info)
+ update_info()
+
+enum { CANNOT_EXPAND, CAN_EXPAND, PREPARING, EXPANDING }
+
+func _expand_building(building_identifier : String) -> void:
+ if GameSingleton.expand_building(_selected_index, building_identifier) != OK:
+ push_error("Failed to expand ", building_identifier, " in province #", _selected_index);
+
+# Each building row contains:
+# level - Level Label
+# name - Name Label
+# button - Expansion Button
+# progress_bar - Expansion ProgressBar
+var _building_rows : Array[Dictionary]
+
+# REQUIREMENTS:
+# * UI-183, UI-185, UI-186, UI-765, UI-187, UI-188, UI-189
+# * UI-191, UI-193, UI-194, UI-766, UI-195, UI-196, UI-197
+# * UI-199, UI-201, UI-202, UI-767, UI-203, UI-204, UI-205
+func _add_building_row() -> void:
+ var row : Dictionary
+
+ row.level = Label.new()
+ row.level.text = "X"
+ _buildings_container.add_child(row.level)
+
+ row.name = Label.new()
+ row.name.text = GameSingleton.get_building_info_building_key() + _missing_suffix
+ _buildings_container.add_child(row.name)
+
+ row.button = Button.new()
+ row.button.text = "EXPAND_PROVINCE_BUILDING"
+ row.button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.button.mouse_filter = Control.MOUSE_FILTER_PASS
+ row.button.pressed.connect(func(): _expand_building(row.name.text))
+ _buildings_container.add_child(row.button)
+
+ row.progress_bar = ProgressBar.new()
+ row.progress_bar.max_value = 1
+ row.progress_bar.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.progress_bar.mouse_filter = Control.MOUSE_FILTER_PASS
+ _buildings_container.add_child(row.progress_bar)
+
+ _building_rows.append(row)
+ _set_building_row(_building_rows.size() - 1, {})
+
+func _set_building_row(index : int, building : Dictionary) -> void:
+ if index < 0 or index > _building_rows.size():
+ push_error("Invalid building row index: ", index, " (max ", _building_rows.size(), ")")
+ return
+ if index == _building_rows.size(): _add_building_row()
+ var row := _building_rows[index]
+ if building.is_empty():
+ row.level.visible = false
+ row.name.visible = false
+ row.progress_bar.visible = false
+ row.button.visible = false
+ return
+ row.level.text = str(building.get(GameSingleton.get_building_info_level_key(), 0))
+ row.level.visible = true
+ row.name.text = building.get(GameSingleton.get_building_info_building_key(),
+ GameSingleton.get_building_info_building_key() + _missing_suffix)
+ row.name.visible = true
+
+ var expansion_state : int = building.get(GameSingleton.get_building_info_expansion_state_key(),
+ CANNOT_EXPAND)
+ var show_progress_bar := expansion_state == PREPARING or expansion_state == EXPANDING
+ row.progress_bar.value = building.get(GameSingleton.get_building_info_expansion_progress_key(), 0)
+ row.progress_bar.visible = show_progress_bar
+ row.button.disabled = expansion_state != CAN_EXPAND
+ row.button.visible = not show_progress_bar
+
+func update_info() -> void:
+ _province_info = GameSingleton.get_province_info_from_index(_selected_index)
+ if _province_info:
+ _province_name_label.text = _province_info.get(GameSingleton.get_province_info_province_key(),
+ GameSingleton.get_province_info_province_key() + _missing_suffix)
+ _region_name_label.text = _province_info.get(GameSingleton.get_province_info_region_key(),
+ GameSingleton.get_province_info_region_key() + _missing_suffix)
+
+ _life_rating_bar.value = _province_info.get(GameSingleton.get_province_info_life_rating_key(), 0)
+ _life_rating_bar.tooltip_text = tr("LIFE_RATING_TOOLTIP").format({ "life_rating": _life_rating_bar.value })
+
+ _rgo_name_label.text = _province_info.get(GameSingleton.get_province_info_rgo_key(),
+ GameSingleton.get_province_info_rgo_key() + _missing_suffix)
+ _rgo_icon_texture_rect.texture = GameSingleton.get_good_icon_texture(_rgo_name_label.text)
+
+ var buildings : Array = _province_info.get(GameSingleton.get_province_info_buildings_key(), [])
+ for i in max(buildings.size(), _building_rows.size()):
+ _set_building_row(i, buildings[i] if i < buildings.size() else {})
+
+ show()
+ else:
+ hide()
+ mouse_exited.emit()
+
+func _on_province_selected(index : int) -> void:
+ _selected_index = index
+
+func _on_close_button_pressed() -> void:
+ GameSingleton.set_selected_province(0)
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
new file mode 100644
index 0000000..a233db0
--- /dev/null
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
@@ -0,0 +1,86 @@
+[gd_scene load_steps=2 format=3 uid="uid://byq323jbel48u"]
+
+[ext_resource type="Script" path="res://src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd" id="1_3n8k5"]
+
+[node name="ProvinceOverviewPanel" type="PanelContainer" node_paths=PackedStringArray("_province_name_label", "_region_name_label", "_life_rating_bar", "_rgo_icon_texture_rect", "_rgo_name_label", "_buildings_container")]
+editor_description = "UI-56"
+anchors_preset = 2
+anchor_top = 1.0
+anchor_bottom = 1.0
+offset_top = -300.0
+offset_right = 200.0
+grow_vertical = 0
+mouse_filter = 1
+script = ExtResource("1_3n8k5")
+_province_name_label = NodePath("PanelList/TopBarList/NameList/ProvinceName")
+_region_name_label = NodePath("PanelList/TopBarList/NameList/RegionName")
+_life_rating_bar = NodePath("PanelList/TopBarList/NameList/LifeRatingBar")
+_rgo_icon_texture_rect = NodePath("PanelList/InteractList/RGOInfo/RGOIcon")
+_rgo_name_label = NodePath("PanelList/InteractList/RGOInfo/RGOName")
+_buildings_container = NodePath("PanelList/InteractList/BuildingsContainer")
+
+[node name="PanelList" type="VBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="TopBarList" type="HBoxContainer" parent="PanelList"]
+layout_mode = 2
+
+[node name="NameList" type="VBoxContainer" parent="PanelList/TopBarList"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 0
+
+[node name="ProvinceName" type="Label" parent="PanelList/TopBarList/NameList"]
+editor_description = "UI-57"
+layout_mode = 2
+text = "province_MISSING"
+vertical_alignment = 1
+
+[node name="RegionName" type="Label" parent="PanelList/TopBarList/NameList"]
+editor_description = "UI-58"
+layout_mode = 2
+text = "region_MISSING"
+vertical_alignment = 1
+
+[node name="LifeRatingBar" type="ProgressBar" parent="PanelList/TopBarList/NameList"]
+editor_description = "UI-62"
+layout_mode = 2
+mouse_filter = 1
+
+[node name="CloseButton" type="Button" parent="PanelList/TopBarList"]
+custom_minimum_size = Vector2(30, 30)
+layout_mode = 2
+size_flags_vertical = 0
+mouse_filter = 1
+text = "X"
+
+[node name="InteractList" type="VBoxContainer" parent="PanelList"]
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="HSeparator" type="HSeparator" parent="PanelList/InteractList"]
+layout_mode = 2
+mouse_filter = 1
+
+[node name="RGOInfo" type="HBoxContainer" parent="PanelList/InteractList"]
+editor_description = "UI-112"
+layout_mode = 2
+
+[node name="RGOIcon" type="TextureRect" parent="PanelList/InteractList/RGOInfo"]
+editor_description = "UI-100"
+layout_mode = 2
+
+[node name="RGOName" type="Label" parent="PanelList/InteractList/RGOInfo"]
+layout_mode = 2
+text = "rgo_MISSING"
+vertical_alignment = 1
+
+[node name="HSeparator2" type="HSeparator" parent="PanelList/InteractList"]
+layout_mode = 2
+mouse_filter = 1
+
+[node name="BuildingsContainer" type="GridContainer" parent="PanelList/InteractList"]
+layout_mode = 2
+columns = 3
+
+[connection signal="pressed" from="PanelList/TopBarList/CloseButton" to="." method="_on_close_button_pressed"]
diff --git a/game/src/Game/GameSession/TerrainMap.gdshader b/game/src/Game/GameSession/TerrainMap.gdshader
new file mode 100644
index 0000000..88e7019
--- /dev/null
+++ b/game/src/Game/GameSession/TerrainMap.gdshader
@@ -0,0 +1,50 @@
+shader_type spatial;
+
+render_mode unshaded;
+
+#include "res://src/GameSession/ProvinceIndexSampler.gdshaderinc"
+
+// Province colour texture
+uniform sampler2D province_colour_tex: source_color, repeat_enable, filter_nearest;
+// Index of the mouse over the map mesh
+uniform uint hover_index;
+// Index of the currently selected province
+uniform uint selected_index;
+// Cosmetic terrain textures
+uniform sampler2DArray terrain_tex: source_color, repeat_enable, filter_linear;
+// The number of times the terrain textures should tile vertically
+uniform float terrain_tile_factor;
+
+const vec3 highlight_colour = vec3(1.0);
+
+vec3 get_terrain_colour(vec2 uv, vec2 corner, vec2 half_pixel_size, vec2 terrain_uv) {
+ uvec3 province_data = read_uvec3(fma(corner, half_pixel_size, uv));
+ vec4 province_colour = texelFetch(province_colour_tex, ivec2(province_data.rg), 0);
+ vec3 terrain_colour = texture(terrain_tex, vec3(terrain_uv, float(province_data.b))).rgb;
+ vec3 mixed_colour = mix(terrain_colour, province_colour.rgb, province_colour.a);
+ uint index = uvec2_to_uint(province_data.rg);
+ float mix_val = 0.1 * (float(index == hover_index) + float(index == selected_index));
+ return mix(mixed_colour, highlight_colour, mix_val);
+}
+
+vec3 mix_terrain_colour(vec2 uv) {
+ vec2 map_size = vec2(textureSize(province_shape_tex, 0).xy) * province_shape_subdivisions;
+ vec2 pixel_offset = fract(fma(uv, map_size, vec2(0.5)));
+ vec2 half_pixel_size = 0.49 / map_size;
+
+ vec2 terrain_uv = uv;
+ terrain_uv.x *= map_size.x / map_size.y;
+ terrain_uv *= terrain_tile_factor;
+
+ return mix(
+ mix(get_terrain_colour(uv, vec2(-1, -1), half_pixel_size, terrain_uv),
+ get_terrain_colour(uv, vec2(+1, -1), half_pixel_size, terrain_uv), pixel_offset.x),
+ mix(get_terrain_colour(uv, vec2(-1, +1), half_pixel_size, terrain_uv),
+ get_terrain_colour(uv, vec2(+1, +1), half_pixel_size, terrain_uv), pixel_offset.x),
+ pixel_offset.y);
+}
+
+void fragment() {
+ vec3 terrain_colour = mix_terrain_colour(UV);
+ ALBEDO = terrain_colour;
+}
diff --git a/game/src/Game/GameStart.tscn b/game/src/Game/GameStart.tscn
new file mode 100644
index 0000000..2046bb5
--- /dev/null
+++ b/game/src/Game/GameStart.tscn
@@ -0,0 +1,52 @@
+[gd_scene load_steps=6 format=3 uid="uid://1udsn4mggep2"]
+
+[ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="1_wlojq"]
+[ext_resource type="Script" path="res://src/SplashContainer.gd" id="2_xmcgv"]
+[ext_resource type="Texture2D" uid="uid://deef5hufq0j61" path="res://splash_assets/splash_end.png" id="3_qfv12"]
+[ext_resource type="Texture2D" uid="uid://cgdnixsyh7bja" path="res://splash_assets/splash_image.png" id="4_5b6yq"]
+[ext_resource type="VideoStream" path="res://splash_assets/splash_startup.ogv" id="5_8euyy"]
+
+[node name="GameStartup" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="GameMenu" parent="." instance=ExtResource("1_wlojq")]
+visible = false
+layout_mode = 1
+
+[node name="SplashContainer" type="AspectRatioContainer" parent="." node_paths=PackedStringArray("_splash_finish", "_splash_image", "_splash_video")]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+ratio = 1.7778
+stretch_mode = 3
+script = ExtResource("2_xmcgv")
+_splash_finish = NodePath("SplashFinish")
+_splash_image = NodePath("SplashImage")
+_splash_video = NodePath("SplashVideo")
+
+[node name="SplashFinish" type="TextureRect" parent="SplashContainer"]
+layout_mode = 2
+texture = ExtResource("3_qfv12")
+expand_mode = 1
+
+[node name="SplashImage" type="TextureRect" parent="SplashContainer"]
+layout_mode = 2
+texture = ExtResource("4_5b6yq")
+expand_mode = 1
+
+[node name="SplashVideo" type="VideoStreamPlayer" parent="SplashContainer"]
+layout_mode = 2
+stream = ExtResource("5_8euyy")
+autoplay = true
+expand = true
+
+[connection signal="splash_end" from="SplashContainer" to="GameMenu" method="_on_splash_container_splash_end"]
+[connection signal="finished" from="SplashContainer/SplashVideo" to="SplashContainer" method="_on_splash_startup_finished"]
diff --git a/game/src/Game/LocaleButton.gd b/game/src/Game/LocaleButton.gd
new file mode 100644
index 0000000..2b717a4
--- /dev/null
+++ b/game/src/Game/LocaleButton.gd
@@ -0,0 +1,80 @@
+extends OptionButton
+
+const section_name : String = "localisation"
+const setting_name : String = "locale"
+
+var _default_locale_index : int
+
+func _ready():
+ var locales_country_rename : Dictionary = ProjectSettings.get_setting("internationalization/locale/country_short_name", {})
+
+ var locales_list = TranslationServer.get_loaded_locales()
+ var default_locale := Events.Localisation.get_default_locale()
+ if default_locale not in locales_list:
+ locales_list.push_back(default_locale)
+
+ for locale in locales_list:
+ # locale_name consists of a compulsory language name and optional script
+ # and country names, in the format: "<language>[ (script)][, country]"
+ var locale_name := TranslationServer.get_locale_name(locale)
+ var comma_idx := locale_name.find(", ")
+ if comma_idx != -1:
+ var locale_country_name := locale_name.substr(comma_idx + 2)
+ locale_country_name = locales_country_rename.get(locale_country_name, "")
+ if not locale_country_name.is_empty():
+ locale_name = locale_name.left(comma_idx + 2) + locale_country_name
+
+ add_item(locale_name)
+ set_item_metadata(item_count - 1, locale)
+
+ if locale == default_locale:
+ _default_locale_index = item_count - 1
+
+ Events.Options.load_settings.connect(load_setting)
+ Events.Options.save_settings.connect(save_setting)
+
+func _notification(what : int):
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _select_locale_by_string(TranslationServer.get_locale())
+
+func _valid_index(index : int) -> bool:
+ return 0 <= index and index < item_count
+
+func load_setting(file : ConfigFile) -> void:
+ if file == null: return
+ var load_value = file.get_value(section_name, setting_name, Events.Localisation.get_default_locale())
+ match typeof(load_value):
+ TYPE_STRING, TYPE_STRING_NAME:
+ if _select_locale_by_string(load_value as String):
+ item_selected.emit(selected)
+ return
+ push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name])
+ reset_setting()
+
+func _select_locale_by_string(locale : String) -> bool:
+ for idx in item_count:
+ if get_item_metadata(idx) == locale:
+ selected = idx
+ return true
+ selected = _default_locale_index
+ return false
+
+# REQUIREMENTS:
+# * UIFUN-74
+func save_setting(file : ConfigFile) -> void:
+ if file == null: return
+ file.set_value(section_name, setting_name, get_item_metadata(selected))
+
+func reset_setting() -> void:
+ _select_locale_by_string(TranslationServer.get_locale())
+
+# REQUIREMENTS:
+# * SS-58
+func _on_item_selected(index : int) -> void:
+ if _valid_index(index):
+ TranslationServer.set_locale(get_item_metadata(index))
+ Events.Options.save_settings_to_file.call_deferred()
+ else:
+ push_error("Invalid LocaleButton index: %d" % index)
+ reset_setting()
diff --git a/game/src/Game/LocaleButton.tscn b/game/src/Game/LocaleButton.tscn
new file mode 100644
index 0000000..55f1c29
--- /dev/null
+++ b/game/src/Game/LocaleButton.tscn
@@ -0,0 +1,12 @@
+[gd_scene load_steps=2 format=3 uid="uid://b7oncobnacxmt"]
+
+[ext_resource type="Script" path="res://src/LocaleButton.gd" id="1_ganev"]
+
+[node name="LocaleButton" type="OptionButton"]
+custom_minimum_size = Vector2(150, 0)
+alignment = 2
+text_overrun_behavior = 2
+fit_to_longest_item = false
+script = ExtResource("1_ganev")
+
+[connection signal="item_selected" from="." to="." method="_on_item_selected"]
diff --git a/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd b/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd
new file mode 100644
index 0000000..0db4d7d
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd
@@ -0,0 +1,200 @@
+extends Control
+
+signal back_button_pressed
+
+###############
+# Credits CSV format
+# The project title row is the only requirement within the csv file, however
+# it can be on any row, so long as it exists.
+# ----------------------
+# title,project-title
+# role-name,person-name
+# role-name,person-name
+# role-name,person-name
+# ...
+###############
+
+@export_file("*.csv")
+var core_credits_path : String
+
+@export
+var godot_engine_scene : PackedScene
+
+@export_group("Label Variants", "label_variants_")
+@export
+var label_variants_project : StringName
+
+@export
+var label_variants_role : StringName
+
+@export
+var label_variants_person : StringName
+
+@export
+var credits_list: VBoxContainer
+
+const title_key : String = "TITLE"
+
+# REQUIREMENTS:
+# * 1.5 Credits Menu
+# * SS-17
+
+# REQUIREMENTS
+# * FS-4
+func _load_credit_file(path : String) -> Dictionary:
+ var roles := {}
+ var core_credits = FileAccess.open(path, FileAccess.READ)
+ if core_credits == null:
+ push_error("Failed to open credits file %s (error code %d)" % [path, FileAccess.get_open_error()])
+ return roles
+
+ while not core_credits.eof_reached():
+ var line := core_credits.get_csv_line()
+ var role := line[0].strip_edges().to_upper()
+
+ # If the line does not have an identifiable role or is empty then skip it
+ if role.is_empty() or line.size() < 2:
+ if not (role.is_empty() and line.size() < 2):
+ push_warning("Incorrectly formatted credit line %s in %s" % [line, path])
+ continue
+
+ var person := line[1].strip_edges()
+
+ if person.is_empty():
+ push_warning("Incorrectly formatted credit line %s in %s" % [line, path])
+ continue
+ if line.size() > 2:
+ push_warning("Extra entries ignored in credit line %s in %s" % [line, path])
+
+ if role not in roles:
+ roles[role] = [person]
+ else:
+ if person in roles[role]:
+ push_warning("Duplicate person %s for role %s in %s" % [person, role, path])
+ else:
+ roles[role].push_back(person)
+ if title_key in roles:
+ if roles[title_key].size() > 1:
+ push_warning("More than one %s: %s in %s" % [title_key, roles[title_key], path])
+ roles[title_key] = [roles[title_key][0]]
+ else:
+ push_warning("Credits file %s missing %s" % [path, title_key])
+ for role_list in roles.values():
+ role_list.sort_custom(func(a : String, b : String) -> bool: return a.naturalnocasecmp_to(b) < 0)
+ return roles
+
+func _add_label(node : Node, text : String, type_variation : StringName) -> void:
+ var label := Label.new()
+ label.name = 'Label' + text
+ label.text = text
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
+ label.theme_type_variation = type_variation
+ node.add_child(label)
+
+# REQUIREMENTS:
+# * UI-34, UI-35
+func _add_project_credits(project : Dictionary) -> void:
+ var project_credits_list = VBoxContainer.new()
+ project_credits_list.name = 'Credits'
+ if title_key in project:
+ var title : String = project[title_key][0]
+ project_credits_list.name += title
+ _add_label(project_credits_list, title, label_variants_project)
+ project_credits_list.add_child(HSeparator.new())
+
+ for role in project:
+ if role == title_key:
+ continue
+
+ var role_parent = VBoxContainer.new()
+
+ for person in project[role]:
+ _add_label(role_parent, person, label_variants_person)
+
+ _add_label(project_credits_list, role, label_variants_role)
+ project_credits_list.add_child(role_parent)
+ project_credits_list.add_child(HSeparator.new())
+
+ credits_list.add_child(project_credits_list)
+
+func _add_godot_credits() -> void:
+ var godot_credits_list = VBoxContainer.new()
+ godot_credits_list.name = 'CreditsGodot'
+ var godot_engine = godot_engine_scene.instantiate()
+ godot_credits_list.add_child(godot_engine)
+ godot_credits_list.add_child(HSeparator.new())
+
+ var author_dict := Engine.get_author_info()
+ _add_label(godot_credits_list, "Contributors", label_variants_role)
+
+ for role in author_dict:
+ var role_parent = VBoxContainer.new()
+
+ for person in author_dict[role]:
+ _add_label(role_parent, person, label_variants_person)
+
+ _add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
+ godot_credits_list.add_child(role_parent)
+ godot_credits_list.add_child(HSeparator.new())
+
+ var donor_dict := Engine.get_donor_info()
+ _add_label(godot_credits_list, "Donors", label_variants_role)
+
+ for role in donor_dict:
+ if donor_dict[role].size() == 0 or donor_dict[role][0].begins_with("None"): continue
+ var role_parent = VBoxContainer.new()
+
+ for person in donor_dict[role]:
+ _add_label(role_parent, person, label_variants_person)
+
+ _add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
+ godot_credits_list.add_child(role_parent)
+ godot_credits_list.add_child(HSeparator.new())
+
+ credits_list.add_child(godot_credits_list)
+
+func _add_link_button(node : Node, text : String, url: String, type_variation : StringName) -> void:
+ var button := LinkButton.new()
+ button.name = 'LinkButton' + text
+ button.text = text
+ button.uri = url
+ button.size_flags_horizontal = SIZE_SHRINK_CENTER
+ button.theme_type_variation = type_variation
+ node.add_child(button)
+
+func _add_licenses() -> void:
+ var license_list = VBoxContainer.new()
+ license_list.name = 'Licenses'
+ _add_label(license_list, "Third-Party Licenses", label_variants_project)
+ license_list.add_child(HSeparator.new())
+
+ var license_info := {
+ "OpenVic": ["GPLv3", "https://github.com/OpenVicProject/OpenVic/blob/main/LICENSE.md"],
+ "Godot": ["MIT", "https://github.com/godotengine/godot/blob/master/LICENSE.txt"],
+ "FreeType": ["FreeType License", "https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT"],
+ "ENet": ["MIT", "http://enet.bespin.org/License.html"],
+ "mbed TLS": ["APLv2", "https://github.com/Mbed-TLS/mbedtls/blob/development/LICENSE"]
+ }
+ # Add additional licenses required for attribution here
+ # These licenses should also either be displayed or exported alongside this project
+
+ for project in license_info:
+ _add_label(license_list, project, label_variants_role)
+ _add_link_button(license_list, license_info[project][0], license_info[project][1], label_variants_person)
+ license_list.add_child(HSeparator.new())
+
+ credits_list.add_child(license_list)
+
+
+# REQUIREMENTS:
+# * SS-17
+func _ready():
+ _add_project_credits(_load_credit_file(core_credits_path))
+ _add_godot_credits()
+ _add_licenses()
+
+# REQUIREMENTS:
+# * UI-38
+# * UIFUN-37
+func _on_back_button_pressed() -> void:
+ back_button_pressed.emit()
diff --git a/game/src/Game/Menu/CreditsMenu/CreditsMenu.tscn b/game/src/Game/Menu/CreditsMenu/CreditsMenu.tscn
new file mode 100644
index 0000000..2d10d2e
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/CreditsMenu.tscn
@@ -0,0 +1,50 @@
+[gd_scene load_steps=4 format=3 uid="uid://c8knthxkwj1uj"]
+
+[ext_resource type="Theme" uid="uid://stfxt4hpsify" path="res://theme/credits_menu.tres" id="1_7y4l8"]
+[ext_resource type="Script" path="res://src/CreditsMenu/CreditsMenu.gd" id="1_csd7i"]
+[ext_resource type="PackedScene" uid="uid://ddjbee5gj6bkv" path="res://src/CreditsMenu/GodotEngineButton.tscn" id="3_fl02a"]
+
+[node name="CreditsMenu" type="Control" node_paths=PackedStringArray("credits_list")]
+editor_description = "UI-34"
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_7y4l8")
+script = ExtResource("1_csd7i")
+core_credits_path = "res://common/credits.csv"
+godot_engine_scene = ExtResource("3_fl02a")
+label_variants_project = &"ProjectLabel"
+label_variants_role = &"RoleLabel"
+label_variants_person = &"PersonLabel"
+credits_list = NodePath("Scroll/CreditsList")
+
+[node name="ControlMargin" type="MarginContainer" parent="."]
+layout_mode = 2
+anchor_right = 1.0
+anchor_bottom = 0.071
+offset_bottom = -0.120003
+theme_type_variation = &"BackButtonsMargin"
+
+[node name="BackButton" type="Button" parent="ControlMargin"]
+editor_description = "UI-38"
+layout_mode = 2
+text = "CREDITS_BACK"
+
+[node name="Scroll" type="ScrollContainer" parent="."]
+editor_description = "UI-35"
+layout_mode = 2
+anchor_top = 0.071
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_top = -0.120003
+offset_bottom = -6.0
+
+[node name="CreditsList" type="VBoxContainer" parent="Scroll"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[connection signal="pressed" from="ControlMargin/BackButton" to="." method="_on_back_button_pressed"]
diff --git a/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd
new file mode 100644
index 0000000..ca3a958
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd
@@ -0,0 +1,4 @@
+extends Button
+
+func _on_pressed():
+ OS.shell_open("https://godotengine.org")
diff --git a/game/src/Game/Menu/CreditsMenu/GodotEngineButton.tscn b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.tscn
new file mode 100644
index 0000000..8b0c46b
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.tscn
@@ -0,0 +1,20 @@
+[gd_scene load_steps=3 format=3 uid="uid://ddjbee5gj6bkv"]
+
+[ext_resource type="Texture2D" uid="uid://rh7l4xuh4ali" path="res://src/CreditsMenu/logo_vertical_color_dark.svg" id="1_b0brk"]
+[ext_resource type="Script" path="res://src/CreditsMenu/GodotEngineButton.gd" id="3_gi8fv"]
+
+[node name="GodotEngineButton" type="Button"]
+custom_minimum_size = Vector2(0, 200)
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+size_flags_vertical = 3
+icon = ExtResource("1_b0brk")
+flat = true
+icon_alignment = 1
+expand_icon = true
+script = ExtResource("3_gi8fv")
+
+[connection signal="pressed" from="." to="." method="_on_pressed"]
diff --git a/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg b/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg
new file mode 100644
index 0000000..00e50cd
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg
@@ -0,0 +1 @@
+<svg height="713.37085" viewBox="0 0 584.81677 668.78517" width="623.80457" xmlns="http://www.w3.org/2000/svg"><g fill="#eee" transform="matrix(1.25 0 0 -1.25 -469.43319 897.49284)"><path d="m0 0c-3.611 0-6.636-1.659-9.09-4.967-2.441-3.311-3.668-7.958-3.668-13.938 0-5.993 1.166-10.581 3.503-13.778 2.333-3.207 5.398-4.804 9.2-4.804 3.8 0 6.887 1.617 9.258 4.862 2.371 3.233 3.559 7.861 3.559 13.886 0 6.02-1.227 10.654-3.673 13.89-2.443 3.232-5.473 4.849-9.089 4.849m-.055-59.493c-10.573 0-19.195 3.46-25.859 10.379-6.655 6.925-9.984 17.03-9.984 30.314 0 13.292 3.367 23.356 10.101 30.209 6.736 6.844 15.431 10.269 26.082 10.269 10.649 0 19.251-3.363 25.794-10.109 6.555-6.733 9.827-16.94 9.827-30.591 0-13.661-3.348-23.822-10.05-30.49-6.702-6.654-15.333-9.981-25.911-9.981" transform="matrix(1.1310535 0 0 1.1310535 531.44953 355.31567)"/><path d="m0 0v-33.768c0-1.577.116-2.571.342-2.988.224-.415.903-.623 2.029-.623 4.144 0 7.283 1.548 9.429 4.634 2.151 3.083 3.215 8.216 3.215 15.405 0 7.192-1.113 11.878-3.325 14.055-2.223 2.183-5.744 3.285-10.561 3.285zm-21.675-52.392v67.735c0 1.883.468 3.369 1.413 4.471.939 1.085 2.161 1.636 3.671 1.636h18.854c11.965 0 21.053-3.018 27.257-9.04 6.215-6.02 9.322-15.499 9.322-28.447 0-27.7-11.821-41.547-35.456-41.547h-19.302c-3.836 0-5.759 1.727-5.759 5.192" transform="matrix(1.1310535 0 0 1.1310535 607.8515 354.43097)"/><path d="m0 0c-3.612 0-6.645-1.659-9.095-4.967-2.44-3.311-3.662-7.958-3.662-13.938 0-5.993 1.169-10.581 3.499-13.778 2.33-3.207 5.398-4.804 9.2-4.804 3.801 0 6.89 1.617 9.258 4.862 2.372 3.233 3.56 7.861 3.56 13.886 0 6.02-1.225 10.654-3.671 13.89-2.447 3.232-5.473 4.849-9.089 4.849m-.058-59.493c-10.577 0-19.193 3.46-25.851 10.379-6.663 6.925-9.993 17.03-9.993 30.314 0 13.292 3.367 23.356 10.1 30.209 6.741 6.844 15.431 10.269 26.086 10.269 10.651 0 19.246-3.363 25.797-10.109 6.55-6.733 9.822-16.94 9.822-30.591 0-13.661-3.349-23.822-10.05-30.49-6.699-6.654-15.338-9.981-25.911-9.981" transform="matrix(1.1310535 0 0 1.1310535 700.81066 355.31567)"/><path d="m0 0c0-1.496-3.721-2.255-11.176-2.255-7.448 0-11.18.759-11.18 2.255v56.681h-13.545c-1.281 0-2.185 1.727-2.71 5.198-.226 1.652-.334 3.343-.334 5.077 0 1.724.108 3.422.334 5.077.525 3.462 1.429 5.202 2.71 5.202h49.112c1.279 0 2.179-1.74 2.712-5.202.221-1.655.335-3.353.335-5.077 0-1.734-.114-3.425-.335-5.077-.533-3.471-1.433-5.198-2.712-5.198h-13.211z" transform="matrix(1.1310535 0 0 1.1310535 789.01132 291.33514)"/><path d="m0 0c-6.078.094-13.034-1.173-13.034-1.173v-11.863h6.995l-.078-5.288c0-1.959-1.942-2.943-5.815-2.943-3.878 0-7.303 1.642-10.274 4.917-2.978 3.279-4.459 8.072-4.459 14.388 0 6.329 1.447 10.995 4.345 14.006 2.892 3.008 6.683 4.517 11.346 4.517 1.959 0 3.987-.316 6.096-.961 2.11-.639 3.519-1.238 4.238-1.799.713-.577 1.391-.85 2.032-.85.638 0 1.671.746 3.1 2.255 1.431 1.505 2.713 3.786 3.844 6.827 1.126 3.057 1.69 5.4 1.69 7.062 0 1.649-.036 2.786-.109 3.386-1.581 1.73-4.499 3.102-8.755 4.122-4.248 1.017-9.011 1.522-14.28 1.522-11.594 0-20.66-3.65-27.207-10.95-6.552-7.303-9.822-16.783-9.822-28.452 0-13.701 3.347-24.087 10.041-31.162 6.706-7.074 15.51-10.607 26.425-10.607 5.87 0 11.08.505 15.632 1.522 4.557 1.013 7.586 2.053 9.093 3.105l.452 35.33c0 2.053-5.418 2.985-11.496 3.089" transform="matrix(1.1310535 0 0 1.1310535 468.26549 336.71278)"/></g><g fill="#ddd" transform="matrix(1.25 0 0 -1.25 -392.9327 897.49284)"><path d="m0 0c-.624-1.28-1.771-2.454-3.449-3.516-1.676-1.069-3.805-1.6-6.391-1.6-3.412 0-6.156 1.075-8.24 3.249-2.076 2.157-3.116 5.266-3.116 9.323v10.116c0 3.969.98 7.013 2.946 9.138 1.962 2.108 4.59 3.177 7.872 3.177 3.208 0 5.695-.844 7.455-2.513 1.755-1.675 2.677-4.015 2.757-7.003l-.044-.133h-2.619c-.094 2.29-.759 4.057-2.01 5.305-1.244 1.238-3.095 1.864-5.539 1.864-2.473 0-4.432-.837-5.866-2.516-1.43-1.675-2.143-4.103-2.143-7.293v-10.174c0-3.308.771-5.83 2.311-7.567 1.54-1.724 3.616-2.588 6.236-2.588 1.913 0 3.451.339 4.602 1.033 1.155.684 1.956 1.519 2.409 2.51v8.861h-7.06v2.463h9.889z" transform="matrix(1.1310535 0 0 1.1310535 441.34721 235.75121)"/><path d="m0 0c1.553 0 2.936.44 4.144 1.336 1.21.9 2.058 2.037 2.561 3.422v5.468h-4.492c-1.91 0-3.44-.541-4.585-1.623-1.148-1.075-1.716-2.418-1.716-4.015 0-1.349.355-2.457 1.074-3.311.718-.857 1.722-1.277 3.014-1.277m7.124-2.04c-.14.876-.249 1.587-.318 2.144-.067.567-.101 1.131-.101 1.704-.767-1.254-1.757-2.294-2.98-3.109-1.221-.821-2.579-1.228-4.075-1.228-2.092 0-3.701.648-4.84 1.946-1.132 1.303-1.704 3.059-1.704 5.276 0 2.343.823 4.223 2.473 5.618 1.649 1.395 3.89 2.092 6.709 2.092h4.417v3.106c0 1.786-.456 3.193-1.351 4.21-.914 1.004-2.17 1.512-3.791 1.512-1.508 0-2.752-.479-3.728-1.45-.973-.965-1.456-2.144-1.456-3.549l-2.623.023-.046.137c-.074 1.906.647 3.591 2.168 5.084 1.515 1.489 3.459 2.229 5.825 2.229 2.338 0 4.22-.711 5.657-2.128 1.429-1.431 2.146-3.471 2.146-6.124v-12.396c0-.903.042-1.78.121-2.617.081-.848.212-1.665.417-2.48z" transform="matrix(1.1310535 0 0 1.1310535 456.01527 232.82495)"/><path d="m0 0 .24-3.923c.664 1.404 1.554 2.486 2.657 3.255 1.107.759 2.41 1.138 3.906 1.138 1.527 0 2.814-.444 3.852-1.343 1.039-.896 1.805-2.252 2.292-4.074.623 1.682 1.505 3.011 2.65 3.973 1.145.964 2.534 1.444 4.143 1.444 2.217 0 3.937-.897 5.156-2.692 1.224-1.799 1.834-4.559 1.834-8.288v-14.765h-2.823v14.814c0 3.1-.429 5.283-1.263 6.538-.839 1.257-2.042 1.89-3.598 1.89-1.637 0-2.915-.691-3.834-2.096-.914-1.405-1.478-3.161-1.683-5.282v-.655-15.209h-2.809v14.798c0 3.027-.424 5.194-1.292 6.488-.864 1.294-2.066 1.936-3.609 1.936-1.475 0-2.668-.45-3.562-1.342-.9-.897-1.54-2.125-1.928-3.683v-18.197h-2.806v25.275z" transform="matrix(1.1310535 0 0 1.1310535 476.7303 259.10521)"/><path d="m0 0c-1.758 0-3.202-.802-4.334-2.402-1.133-1.606-1.718-3.585-1.765-5.944h11.66v1.082c0 2.086-.489 3.823-1.469 5.201-.986 1.379-2.347 2.063-4.092 2.063m.397-23.76c-2.725 0-4.954 1.026-6.685 3.073-1.726 2.043-2.591 4.657-2.591 7.841v4.197c0 3.19.867 5.85 2.602 7.965 1.739 2.105 3.828 3.158 6.277 3.158 2.648 0 4.699-.939 6.164-2.823 1.468-1.887 2.201-4.422 2.201-7.603v-2.773h-14.464v-2.102c0-2.447.586-4.484 1.752-6.11 1.168-1.63 2.755-2.438 4.744-2.438 1.382 0 2.585.244 3.588.724 1.003.491 1.863 1.179 2.578 2.082l1.149-1.988c-.763-.968-1.752-1.75-2.959-2.33-1.204-.577-2.659-.873-4.356-.873" transform="matrix(1.1310535 0 0 1.1310535 522.82277 256.83868)"/><path d="m0 0c-1.763 0-3.21-.802-4.341-2.402-1.126-1.606-1.712-3.585-1.763-5.944h11.663v1.082c0 2.086-.488 3.823-1.474 5.201-.981 1.379-2.341 2.063-4.085 2.063m.394-23.76c-2.726 0-4.951 1.026-6.679 3.073-1.733 2.043-2.6 4.657-2.6 7.841v4.197c0 3.19.871 5.85 2.602 7.965 1.744 2.105 3.834 3.158 6.283 3.158 2.643 0 4.703-.939 6.164-2.823 1.463-1.887 2.197-4.422 2.197-7.603v-2.773h-14.465v-2.102c0-2.447.587-4.484 1.76-6.11 1.162-1.63 2.742-2.438 4.738-2.438 1.387 0 2.585.244 3.585.724 1.007.491 1.866 1.179 2.589 2.082l1.141-1.988c-.764-.968-1.75-1.75-2.959-2.33-1.204-.577-2.658-.873-4.356-.873" transform="matrix(1.1310535 0 0 1.1310535 558.0805 256.83868)"/><path d="m0 0 .23-4.178c.674 1.483 1.564 2.634 2.682 3.435 1.108.805 2.413 1.213 3.914 1.213 2.258 0 3.988-.835 5.189-2.513 1.214-1.675 1.815-4.279 1.815-7.812v-15.42h-2.825v15.394c0 2.888-.423 4.905-1.264 6.075-.836 1.17-2.065 1.753-3.665 1.753-1.435 0-2.638-.466-3.603-1.414-.969-.939-1.691-2.19-2.172-3.767v-18.041h-2.805v25.275z" transform="matrix(1.1310535 0 0 1.1310535 575.91679 259.10521)"/><path d="m0 0c0-2.565.486-4.605 1.472-6.123.974-1.532 2.457-2.288 4.436-2.288 1.356 0 2.498.361 3.435 1.101.934.74 1.672 1.77 2.218 3.077v12.52c-.525 1.346-1.246 2.434-2.157 3.272-.91.824-2.062 1.238-3.448 1.238-1.975 0-3.468-.86-4.46-2.587-.999-1.73-1.496-3.986-1.496-6.756zm-2.833 3.454c0 3.582.723 6.459 2.177 8.627 1.442 2.157 3.448 3.239 6.004 3.239 1.419 0 2.664-.346 3.728-1.04 1.066-.681 1.947-1.678 2.654-2.946l.274 3.516h2.381v-25.298c0-3.239-.751-5.749-2.26-7.525-1.511-1.769-3.657-2.665-6.428-2.665-.996 0-2.067.156-3.212.459-1.147.303-2.162.701-3.052 1.2l.776 2.463c.759-.492 1.608-.873 2.548-1.141.932-.277 1.895-.41 2.894-.41 2.009 0 3.498.645 4.46 1.932.966 1.304 1.45 3.19 1.45 5.687v3.057c-.717-1.138-1.597-2.011-2.64-2.614-1.039-.606-2.253-.909-3.622-.909-2.539 0-4.53.994-5.968 2.982-1.441 1.984-2.164 4.631-2.164 7.932z" transform="matrix(1.1310535 0 0 1.1310535 600.8685 242.30884)"/><path d="m627.82321 230.5176h-3.20089v28.58738h3.20089zm0 36.72644h-3.20089v4.50385h3.20089z"/><path d="m0 0 .23-4.178c.676 1.483 1.562 2.634 2.678 3.435 1.115.805 2.422 1.213 3.916 1.213 2.258 0 3.995-.835 5.199-2.513 1.211-1.675 1.807-4.279 1.807-7.812v-15.42h-2.825v15.394c0 2.888-.422 4.905-1.261 6.075-.843 1.17-2.063 1.753-3.668 1.753-1.434 0-2.635-.466-3.599-1.414-.967-.939-1.692-2.19-2.171-3.767v-18.041h-2.809v25.275z" transform="matrix(1.1310535 0 0 1.1310535 638.15379 259.10521)"/><path d="m0 0c-1.763 0-3.208-.802-4.334-2.402-1.129-1.606-1.718-3.585-1.768-5.944h11.662v1.082c0 2.086-.486 3.823-1.47 5.201-.981 1.379-2.343 2.063-4.09 2.063m.401-23.76c-2.733 0-4.958 1.026-6.681 3.073-1.73 2.043-2.595 4.657-2.595 7.841v4.197c0 3.19.865 5.85 2.6 7.965 1.739 2.105 3.831 3.158 6.275 3.158 2.646 0 4.706-.939 6.172-2.823 1.462-1.887 2.195-4.422 2.195-7.603v-2.773h-14.469v-2.102c0-2.447.59-4.484 1.757-6.11 1.166-1.63 2.748-2.438 4.746-2.438 1.382 0 2.579.244 3.578.724 1.012.491 1.869 1.179 2.591 2.082l1.147-1.988c-.769-.968-1.755-1.75-2.962-2.33-1.203-.577-2.658-.873-4.354-.873" transform="matrix(1.1310535 0 0 1.1310535 669.70883 256.83868)"/></g><g stroke-width="1.41382" transform="translate(89.812354 -.891698)"><path d="m340.91387 248.41524s-.45949-2.81915-.72812-2.7937l-51.15472 4.93563c-4.07038.39304-7.23167 3.63917-7.51726 7.71803l-1.40534 20.14265-39.57556 2.82339-2.69191-18.2552c-.59946-4.06049-4.14531-7.1214-8.24962-7.1214h-53.99084c-4.1029 0-7.64875 3.06091-8.24821 7.1214l-2.69332 18.2552-39.57556-2.82339-1.40533-20.14265c-.2856-4.08028-3.44689-7.3264-7.51727-7.71944l-51.180171-4.93422c-.264383-.0255-.458076 2.79653-.72246 2.79653l-.06928 11.07018 43.344801 6.98991 1.41947 20.32221c.28701 4.11421 3.60665 7.44092 7.72368 7.7364l54.50406 3.888c.20642.0141.41001.0226.6136.0226 4.09582 0 7.63602-3.06232 8.23548-7.12281l2.76967-18.78397h39.59394l2.76967 18.78397c.59804 4.05907 4.14248 7.1214 8.24396 7.1214.20076 0 .40153-.007.59805-.0212l54.51112-3.888c4.11562-.29548 7.43668-3.62219 7.72368-7.7364l1.41806-20.32221 43.32642-7.02101z" fill="#fff"/><path d="m64.257603 164.94208v67.1761 8.53238 7.76468c.152692.001.305384.007.456663.0212l51.174514 4.93422c2.6806.25873 4.78153 2.41621 4.96815 5.10247l1.57782 22.58996 44.63986 3.18533 3.07505-20.84955c.3987-2.70322 2.71736-4.7066 5.45168-4.7066h53.99084c2.73291 0 5.05157 2.00338 5.45026 4.7066l3.07505 20.84955 44.64127-3.18533 1.57641-22.58996c.18804-2.68626 2.28756-4.84233 4.96815-5.10247l51.15472-4.93422c.15128-.0141.30256-.0198.45525-.0212v-6.66049l.0212-.007v-76.8056c7.20611-9.07172 14.02963-19.07834 19.2576-27.49732-7.98948-13.60092-17.77875-25.75551-28.24241-37.01656-9.70443 4.88474-19.13035 10.41842-28.03316 16.30697-4.45493-4.42808-9.47257-8.05028-14.40114-11.83648-4.84232-3.88941-10.29965-6.741079-15.47564-10.063549 1.54107-11.475951 2.30311-22.773762 2.60991-34.564995-13.35491-6.721286-27.59629-11.177637-42.00167-14.378518-5.75141 9.666266-11.01081 20.134166-15.59157 30.367373-5.43189-.90767-10.88922-1.244159-16.35362-1.309194v-.0085c-.0382 0-.0735.0085-.10604.0085-.0339 0-.0693-.0085-.10321-.0085v.0085c-5.4743.06503-10.92739.401524-16.36069 1.309194-4.57794-10.233207-9.83451-20.701107-15.5944-30.367373-14.39831 3.200881-28.6411 7.657232-41.9946 14.378518.30538 11.791233 1.06743 23.089044 2.61273 34.564995-5.18588 3.32247-10.63614 6.174139-15.47988 10.063549-4.9215 3.7862-9.94762 7.4084-14.40397 11.83648-8.902802-5.88855-18.325891-11.42223-28.033158-16.30697-10.463659 11.26105-20.247272 23.41564-28.239579 37.01656 6.281105 9.85952 13.018384 19.76924 19.2576 27.49732z" fill="#478cbf"/><path d="m295.00412 263.89328-1.58489 22.71014c-.19086 2.73715-2.36814 4.91584-5.10529 5.11236l-54.50971 3.88941c-.1329.01-.2658.0141-.39728.0141-2.70888 0-5.04592-1.98783-5.44603-4.70801l-3.12595-21.19877h-44.47726l-3.12595 21.19877c-.41991 2.85308-2.97043 4.90453-5.84331 4.69387l-54.50971-3.88941c-2.73715-.19652-4.91442-2.37521-5.10529-5.11236l-1.58489-22.71014-46.015498-4.43656c.02121 4.94553.08483 10.36328.08483 11.44202 0 48.59854 61.649488 71.95763 138.244428 72.22625h.0933.0947c76.59494-.26862 138.22322-23.62771 138.22322-72.22625 0-1.09853.0664-6.49366.0891-11.44202z" fill="#478cbf"/><path d="m160.89242 198.8266c0 17.03932-13.80592 30.84242-30.83959 30.84242-17.02518 0-30.835345-13.8031-30.835345-30.84242 0-17.02801 13.810165-30.82404 30.835345-30.82404 17.03367 0 30.83959 13.79603 30.83959 30.82404" fill="#fff"/><path d="m153.47185 200.6558c0 11.30205-9.16012 20.46217-20.47065 20.46217-11.30488 0-20.47066-9.16012-20.47066-20.46217s9.16578-20.47065 20.47066-20.47065c11.31053 0 20.47065 9.1686 20.47065 20.47065" fill="#414042"/><path d="m202.59379 232.47488c-5.48278 0-9.92641-4.04069-9.92641-9.02157v-28.39085c0-4.97664 4.44363-9.02157 9.92641-9.02157s9.93631 4.04493 9.93631 9.02157v28.39085c0 4.98088-4.45353 9.02157-9.93631 9.02157" fill="#fff"/><path d="m244.30027 198.8266c0 17.03932 13.80592 30.84242 30.84242 30.84242 17.02376 0 30.83251-13.8031 30.83251-30.84242 0-17.02801-13.80875-30.82404-30.83251-30.82404-17.0365 0-30.84242 13.79603-30.84242 30.82404" fill="#fff"/><path d="m251.72267 200.6558c0 11.30205 9.15729 20.46217 20.45934 20.46217 11.31337 0 20.47066-9.16012 20.47066-20.46217s-9.15729-20.47065-20.47066-20.47065c-11.30205 0-20.45934 9.1686-20.45934 20.47065" fill="#414042"/></g></svg>
diff --git a/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg.import b/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg.import
new file mode 100644
index 0000000..a4fb09a
--- /dev/null
+++ b/game/src/Game/Menu/CreditsMenu/logo_vertical_color_dark.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://rh7l4xuh4ali"
+path="res://.godot/imported/logo_vertical_color_dark.svg-1167b3ce62f0747c0e76b17bdbb9f218.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://src/CreditsMenu/logo_vertical_color_dark.svg"
+dest_files=["res://.godot/imported/logo_vertical_color_dark.svg-1167b3ce62f0747c0e76b17bdbb9f218.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=0
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
new file mode 100644
index 0000000..db4f2ce
--- /dev/null
+++ b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
@@ -0,0 +1,165 @@
+extends HBoxContainer
+
+# REQUIREMENTS:
+# * 1.4 Game Lobby Menu
+# * SS-12
+
+signal back_button_pressed
+signal save_game_selected(save : SaveResource)
+signal start_date_selected(index : int)
+
+@export var lobby_panel_button : PackedScene
+@export var save_scene : PackedScene
+
+@export_group("Nodes")
+@export var game_select_start_date : BoxContainer
+@export var game_select_save_tab : TabBar
+@export var game_select_save_list : BoxContainer
+@export var start_button : BaseButton
+@export var session_tag_line_edit : LineEdit
+@export var session_tag_dialog : ConfirmationDialog
+@export var delete_dialog : ConfirmationDialog
+
+func filter_for_tag(tag : StringName) -> void:
+ for child in game_select_save_list.get_children():
+ if tag == &"":
+ child.show()
+ else:
+ if tag == child.resource.session_tag:
+ child.show()
+ else:
+ child.hide()
+
+func _build_date_list() -> void:
+ var start_date := lobby_panel_button.instantiate()
+ start_date.set_text(&"1836")
+ start_date.pressed.connect(_on_start_date_panel_button_pressed.bind(start_date))
+ game_select_start_date.add_child(start_date)
+ start_date = lobby_panel_button.instantiate()
+ start_date.set_text(&"1863")
+ start_date.pressed.connect(_on_start_date_panel_button_pressed.bind(start_date))
+ game_select_start_date.add_child(start_date)
+
+var _id_to_tag : Array[StringName] = []
+
+# Requirements
+# * FS-8
+func _build_save_list() -> void:
+ game_select_save_tab.add_tab("GAMELOBBY_SELECT_ALL")
+ for save_name in SaveManager._save_dictionary:
+ var save : SaveResource = SaveManager._save_dictionary[save_name]
+ var save_node := _create_save_node(save)
+ game_select_save_list.add_child(save_node)
+ if not _id_to_tag.has(save.session_tag):
+ _id_to_tag.append(save.session_tag)
+ game_select_save_tab.add_tab(save.session_tag)
+
+func _create_save_node(resource : SaveResource) -> Control:
+ var save_node = save_scene.instantiate()
+ save_node.resource = resource
+ save_node.pressed.connect(_on_save_node_pressed.bind(save_node))
+ save_node.request_to_delete.connect(_on_save_node_delete_requested.bind(save_node))
+ return save_node
+
+func _queue_clear_lists() -> void:
+ var full_list = game_select_start_date.get_children()
+ full_list.append_array(game_select_save_list.get_children())
+ for child in full_list:
+ child.queue_free()
+ game_select_save_tab.clear_tabs()
+ _id_to_tag.clear()
+
+# REQUIREMENTS:
+# * SS-16
+# * UIFUN-40
+func _on_back_button_button_down():
+ print("Returning to Main Menu.")
+ SaveManager.current_session_tag = ""
+ SaveManager.current_save = null
+ back_button_pressed.emit()
+
+# REQUIREMENTS:
+# * SS-21
+func _on_start_button_pressed():
+ print("Starting new game.")
+ if SaveManager.current_session_tag == "":
+ # TODO: Get country tag as well
+ var datetime := Time.get_datetime_dict_from_system()
+ SaveManager.current_session_tag = "%s/%s/%s-%s:%s:%s" % [
+ datetime["day"],
+ datetime["month"],
+ datetime["year"],
+ datetime["hour"],
+ datetime["minute"],
+ datetime["second"]
+ ]
+ if SaveManager.current_save == null and SaveManager.current_session_tag in _id_to_tag:
+ session_tag_dialog.dialog_text = tr("GAMELOBBY_SESSIONTAG_DIALOG_TEXT").format({ "session_tag": SaveManager.current_session_tag })
+ session_tag_dialog.title = tr("GAMELOBBY_SESSIONTAG_DIALOG_TITLE").format({ "session_tag": SaveManager.current_session_tag })
+ session_tag_dialog.popup_centered()
+ else:
+ _on_session_tag_dialog_confirmed()
+
+# REQUIREMENTS:
+# * SS-19
+func _on_game_select_list_item_selected(index):
+ print("Selected save game: ", index)
+ save_game_selected.emit(index)
+
+# If the date is double-clicked, start the game!
+func _on_game_select_list_item_activated(index):
+ _on_game_select_list_item_selected(index)
+ _on_start_button_pressed()
+
+func _on_session_tag_edit_text_submitted(new_text):
+ SaveManager.current_session_tag = new_text
+ _on_start_button_pressed()
+
+func _on_session_tag_dialog_confirmed():
+ get_tree().change_scene_to_file("res://src/GameSession/GameSession.tscn")
+
+var _requested_node_to_delete : Control
+func _on_save_node_delete_requested(node : Control) -> void:
+ _requested_node_to_delete = node
+ delete_dialog.dialog_text = tr("GAMELOBBY_DELETE_DIALOG_TEXT").format({ "file_name": _requested_node_to_delete.resource.save_name })
+ delete_dialog.title = tr("GAMELOBBY_DELETE_DIALOG_TITLE").format({ "file_name": _requested_node_to_delete.resource.save_name })
+ delete_dialog.popup_centered()
+
+var _start_date_index := -1
+func _on_start_date_panel_button_pressed(node : Control) -> void:
+ if node is LobbyPanelButton and node.get_index(true) == _start_date_index:
+ _on_start_button_pressed()
+ return
+ _start_date_index = node.get_index(true)
+ start_button.disabled = false
+ start_date_selected.emit(_start_date_index)
+
+func _on_save_node_pressed(node : Control) -> void:
+ if SaveManager.current_save != null and SaveManager.current_save == node.resource:
+ SaveManager.current_session_tag = SaveManager.current_save.session_tag
+ _on_start_button_pressed()
+ return
+ SaveManager.current_save = node.resource
+ if SaveManager.current_save != null:
+ session_tag_line_edit.text = SaveManager.current_save.session_tag
+ else:
+ session_tag_line_edit.text = ""
+ start_button.disabled = false
+ save_game_selected.emit(SaveManager.current_save)
+
+func _on_game_select_save_tab_tab_changed(tab) -> void:
+ if tab == 0:
+ filter_for_tag(&"")
+ else:
+ filter_for_tag(_id_to_tag[tab - 1])
+
+func _on_delete_dialog_confirmed():
+ _requested_node_to_delete.resource.delete()
+ _requested_node_to_delete.queue_free()
+
+func _on_visibility_changed():
+ if visible:
+ _build_date_list()
+ _build_save_list()
+ else:
+ _queue_clear_lists()
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyMenu.tscn b/game/src/Game/Menu/LobbyMenu/LobbyMenu.tscn
new file mode 100644
index 0000000..3b5796e
--- /dev/null
+++ b/game/src/Game/Menu/LobbyMenu/LobbyMenu.tscn
@@ -0,0 +1,138 @@
+[gd_scene load_steps=4 format=3 uid="uid://do60kx0d3nrh4"]
+
+[ext_resource type="Script" path="res://src/LobbyMenu/LobbyMenu.gd" id="1_cvwum"]
+[ext_resource type="PackedScene" uid="uid://k71f5gibwmtc" path="res://src/LobbyMenu/LobbyPanelButton.tscn" id="2_exh17"]
+[ext_resource type="PackedScene" uid="uid://d2s7roinx2or7" path="res://src/SaveLoadMenu/SavePanelButton.tscn" id="3_4otj7"]
+
+[node name="LobbyMenu" type="HBoxContainer" node_paths=PackedStringArray("game_select_start_date", "game_select_save_tab", "game_select_save_list", "start_button", "session_tag_line_edit", "session_tag_dialog", "delete_dialog")]
+editor_description = "UI-36"
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+script = ExtResource("1_cvwum")
+lobby_panel_button = ExtResource("2_exh17")
+save_scene = ExtResource("3_4otj7")
+game_select_start_date = NodePath("GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList/GameSelectStartDate")
+game_select_save_tab = NodePath("GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList/GameSelectSaveTab")
+game_select_save_list = NodePath("GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList/GameSelectSaveList")
+start_button = NodePath("GameStartPanel/VBoxContainer/StartButton")
+session_tag_line_edit = NodePath("GameStartPanel/VBoxContainer/SessionTagEdit")
+session_tag_dialog = NodePath("SessionTagDialog")
+delete_dialog = NodePath("DeleteDialog")
+
+[node name="GameSelectPanel" type="PanelContainer" parent="."]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="VBoxContainer" type="VBoxContainer" parent="GameSelectPanel"]
+layout_mode = 2
+
+[node name="GameSelectScroll" type="ScrollContainer" parent="GameSelectPanel/VBoxContainer"]
+editor_description = "UI-39"
+layout_mode = 2
+size_flags_vertical = 3
+horizontal_scroll_mode = 0
+
+[node name="GameSelectList" type="VBoxContainer" parent="GameSelectPanel/VBoxContainer/GameSelectScroll"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="GameSelectStartDate" type="VBoxContainer" parent="GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList"]
+layout_mode = 2
+
+[node name="GameSelectSaveTab" type="TabBar" parent="GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList"]
+layout_mode = 2
+tab_count = 1
+tab_0/title = "GAMELOBBY_SELECT_ALL"
+
+[node name="GameSelectSaveList" type="VBoxContainer" parent="GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList"]
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="GameSelectList" type="ItemList" parent="GameSelectPanel/VBoxContainer"]
+visible = false
+layout_mode = 2
+size_flags_vertical = 3
+item_count = 2
+item_0/text = "1836"
+item_1/text = "1863"
+
+[node name="Spacer" type="Control" parent="GameSelectPanel/VBoxContainer"]
+custom_minimum_size = Vector2(0, 150)
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="BackButton" type="Button" parent="GameSelectPanel/VBoxContainer"]
+editor_description = "UI-37"
+layout_mode = 2
+text = "GAMELOBBY_BACK"
+
+[node name="Spacer2" type="Control" parent="GameSelectPanel/VBoxContainer"]
+custom_minimum_size = Vector2(0, 33)
+layout_mode = 2
+
+[node name="Spacer" type="Control" parent="."]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_stretch_ratio = 2.75
+mouse_filter = 2
+
+[node name="GameStartPanel" type="PanelContainer" parent="."]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="VBoxContainer" type="VBoxContainer" parent="GameStartPanel"]
+layout_mode = 2
+
+[node name="Spacer" type="Control" parent="GameStartPanel/VBoxContainer"]
+custom_minimum_size = Vector2(0, 50)
+layout_mode = 2
+
+[node name="SelectedCountryNameLabel" type="Label" parent="GameStartPanel/VBoxContainer"]
+layout_mode = 2
+text = "France"
+horizontal_alignment = 1
+
+[node name="Spacer2" type="Control" parent="GameStartPanel/VBoxContainer"]
+custom_minimum_size = Vector2(0, 150)
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="SessionTagEdit" type="LineEdit" parent="GameStartPanel/VBoxContainer"]
+layout_mode = 2
+placeholder_text = "GAMELOBBY_SESSION_TAG"
+
+[node name="StartButton" type="Button" parent="GameStartPanel/VBoxContainer"]
+editor_description = "UI-43"
+layout_mode = 2
+disabled = true
+text = "GAMELOBBY_START"
+
+[node name="Spacer3" type="Control" parent="GameStartPanel/VBoxContainer"]
+custom_minimum_size = Vector2(0, 33)
+layout_mode = 2
+
+[node name="SessionTagDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "GAMELOBBY_SESSIONTAG_DIALOG_TITLE"
+ok_button_text = "DIALOG_OK"
+dialog_text = "GAMELOBBY_SESSIONTAG_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[node name="DeleteDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "GAMELOBBY_DELETE_DIALOG_TITLE"
+ok_button_text = "DIALOG_OK"
+dialog_text = "GAMELOBBY_DELETE_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
+[connection signal="tab_changed" from="GameSelectPanel/VBoxContainer/GameSelectScroll/GameSelectList/GameSelectSaveTab" to="." method="_on_game_select_save_tab_tab_changed"]
+[connection signal="button_down" from="GameSelectPanel/VBoxContainer/BackButton" to="." method="_on_back_button_button_down"]
+[connection signal="text_submitted" from="GameStartPanel/VBoxContainer/SessionTagEdit" to="." method="_on_session_tag_edit_text_submitted"]
+[connection signal="pressed" from="GameStartPanel/VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
+[connection signal="confirmed" from="SessionTagDialog" to="." method="_on_session_tag_dialog_confirmed"]
+[connection signal="confirmed" from="DeleteDialog" to="." method="_on_delete_dialog_confirmed"]
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
new file mode 100644
index 0000000..5f3ea46
--- /dev/null
+++ b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
@@ -0,0 +1,102 @@
+@tool
+class_name LobbyPanelButton
+extends Container
+
+signal button_down
+signal button_up
+signal pressed
+signal toggled(button_pressed : bool)
+
+var is_start_date : bool:
+ get = _is_start_date
+
+func _is_start_date() -> bool:
+ return true
+
+@export_group("Nodes")
+@export var background_button : BaseButton
+@export var name_label : Label
+
+var text : StringName:
+ get = get_text,
+ set = set_text
+
+func get_text() -> StringName:
+ return name_label.text
+
+func set_text(value : StringName) -> void:
+ name_label.text = value
+
+func _get_minimum_size() -> Vector2:
+ var result := Vector2()
+ for child in get_children():
+ child = child as Control
+ if child == null or not child.visible:
+ continue
+ if child.top_level:
+ continue
+
+ var minsize : Vector2 = child.get_combined_minimum_size()
+ result.x = max(result.x, minsize.x)
+ result.y = max(result.y, minsize.y)
+
+ var draw_style := _get_draw_mode_style()
+ if draw_style != null:
+ result += draw_style.get_minimum_size()
+
+ return result
+
+func _get_draw_mode_name(support_rtl : bool = true) -> StringName:
+ var rtl := support_rtl and background_button != null and background_button.is_layout_rtl()
+ match background_button.get_draw_mode() if background_button != null else BaseButton.DrawMode.DRAW_NORMAL:
+ BaseButton.DrawMode.DRAW_NORMAL:
+ if rtl: return &"normal_mirrored"
+ return &"normal"
+ BaseButton.DrawMode.DRAW_PRESSED:
+ if rtl: return &"pressed_mirrored"
+ return &"pressed"
+ BaseButton.DrawMode.DRAW_HOVER:
+ if rtl: return &"hover_mirrored"
+ return &"hover"
+ BaseButton.DrawMode.DRAW_DISABLED:
+ if rtl: return &"disabled_mirrored"
+ return &"disabled"
+ BaseButton.DrawMode.DRAW_HOVER_PRESSED:
+ if rtl: return &"hover_pressed_mirrored"
+ return &"hover_pressed"
+ return &""
+
+func _get_draw_mode_style() -> StyleBox:
+ if background_button == null: return null
+ var result := background_button.get_theme_stylebox(_get_draw_mode_name())
+ if result == null:
+ return background_button.get_theme_stylebox(_get_draw_mode_name(false))
+ return result
+
+func _notification(what) -> void:
+ if what == NOTIFICATION_SORT_CHILDREN:
+ var _size := size
+ var offset := Vector2()
+ var style := _get_draw_mode_style()
+ if style != null:
+ _size -= style.get_minimum_size()
+ offset += style.get_offset()
+
+ for child in get_children():
+ child = child as Control
+ if child == null or not child.is_visible_in_tree() or child.top_level:
+ continue
+
+ fit_child_in_rect(child, Rect2(offset, _size))
+
+func _on_background_button_button_down():
+ button_down.emit()
+
+func _on_background_button_button_up():
+ button_up.emit()
+
+func _on_background_button_pressed():
+ pressed.emit()
+
+func _on_background_button_toggled(button_pressed : bool):
+ toggled.emit(button_pressed)
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.tscn b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.tscn
new file mode 100644
index 0000000..f409a2e
--- /dev/null
+++ b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.tscn
@@ -0,0 +1,31 @@
+[gd_scene load_steps=2 format=3 uid="uid://k71f5gibwmtc"]
+
+[ext_resource type="Script" path="res://src/LobbyMenu/LobbyPanelButton.gd" id="1_327u2"]
+
+[node name="LobbyPanelButton" type="Container" node_paths=PackedStringArray("background_button", "name_label")]
+editor_description = "UI-41"
+offset_right = 113.0
+offset_bottom = 48.0
+script = ExtResource("1_327u2")
+background_button = NodePath("BackgroundButton")
+name_label = NodePath("SaveList/NameLabel")
+
+[node name="BackgroundButton" type="Button" parent="."]
+layout_mode = 2
+theme_type_variation = &"ButtonContainer"
+
+[node name="SaveList" type="HBoxContainer" parent="."]
+layout_mode = 2
+size_flags_horizontal = 0
+mouse_filter = 2
+
+[node name="NameLabel" type="Label" parent="SaveList"]
+layout_mode = 2
+size_flags_vertical = 1
+text = "PLACEHOLDER"
+vertical_alignment = 1
+
+[connection signal="button_down" from="BackgroundButton" to="." method="_on_background_button_button_down"]
+[connection signal="button_up" from="BackgroundButton" to="." method="_on_background_button_button_up"]
+[connection signal="pressed" from="BackgroundButton" to="." method="_on_background_button_pressed"]
+[connection signal="toggled" from="BackgroundButton" to="." method="_on_background_button_toggled"]
diff --git a/game/src/Game/Menu/MainMenu/MainMenu.gd b/game/src/Game/Menu/MainMenu/MainMenu.gd
new file mode 100644
index 0000000..9d0edc6
--- /dev/null
+++ b/game/src/Game/Menu/MainMenu/MainMenu.gd
@@ -0,0 +1,50 @@
+extends Control
+
+signal options_button_pressed
+signal new_game_button_pressed
+signal credits_button_pressed
+
+@export
+var _new_game_button : BaseButton
+
+# REQUIREMENTS:
+# * SS-3
+func _ready():
+ _on_new_game_button_visibility_changed()
+
+# REQUIREMENTS:
+# * SS-14
+# * UIFUN-32
+func _on_new_game_button_pressed():
+ print("Start a new game!")
+ new_game_button_pressed.emit()
+
+
+func _on_continue_button_pressed():
+ print("Continue last game!")
+
+
+func _on_multi_player_button_pressed():
+ print("Have fun with friends!")
+
+
+func _on_options_button_pressed():
+ print("Check out some options!")
+ options_button_pressed.emit()
+
+# REQUIREMENTS
+# * UI-32
+# * UIFUN-36
+func _on_credits_button_pressed():
+ credits_button_pressed.emit()
+
+# REQUIREMENTS
+# * SS-4
+# * UIFUN-3
+func _on_exit_button_pressed():
+ print("See you later!")
+ get_tree().quit()
+
+func _on_new_game_button_visibility_changed():
+ if visible:
+ _new_game_button.grab_focus.call_deferred()
diff --git a/game/src/Game/Menu/MainMenu/MainMenu.tscn b/game/src/Game/Menu/MainMenu/MainMenu.tscn
new file mode 100644
index 0000000..0618fe8
--- /dev/null
+++ b/game/src/Game/Menu/MainMenu/MainMenu.tscn
@@ -0,0 +1,150 @@
+[gd_scene load_steps=6 format=3 uid="uid://bp5n3mlu45ygw"]
+
+[ext_resource type="Theme" uid="uid://qoi3oec48jp0" path="res://theme/main_menu.tres" id="1_1yri4"]
+[ext_resource type="Script" path="res://src/MainMenu/MainMenu.gd" id="2_nm1fq"]
+[ext_resource type="Texture2D" uid="uid://dxys0wg0f0ic5" path="res://theme/assets/OpenVicFINALREALTRANS.png" id="3_58ess"]
+[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="3_amonp"]
+[ext_resource type="PackedScene" uid="uid://cen7wkmn6og66" path="res://src/MainMenu/ReleaseInfoBox.tscn" id="3_km0er"]
+
+[node name="MainMenu" type="Control" node_paths=PackedStringArray("_new_game_button")]
+editor_description = "UI-13"
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_1yri4")
+script = ExtResource("2_nm1fq")
+_new_game_button = NodePath("MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton")
+
+[node name="MenuPanel" type="PanelContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_type_variation = &"BackgroundPanel"
+
+[node name="MenuList" type="VBoxContainer" parent="MenuPanel"]
+layout_mode = 2
+
+[node name="TitleIcon" type="TextureRect" parent="MenuPanel/MenuList"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 1.75
+texture = ExtResource("3_58ess")
+expand_mode = 1
+stretch_mode = 5
+
+[node name="ButtonListMargin" type="MarginContainer" parent="MenuPanel/MenuList"]
+layout_mode = 2
+theme_override_constants/margin_left = 15
+theme_override_constants/margin_right = 12
+
+[node name="ButtonList" type="HBoxContainer" parent="MenuPanel/MenuList/ButtonListMargin"]
+custom_minimum_size = Vector2(500, 0)
+layout_mode = 2
+theme_type_variation = &"HBox_MainMenu_ButtonList"
+theme_override_constants/separation = 18
+alignment = 1
+
+[node name="NewGameButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+editor_description = "UI-26"
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../ExitButton")
+focus_neighbor_top = NodePath("../ExitButton")
+focus_neighbor_right = NodePath("../ContinueButton")
+focus_next = NodePath("../ContinueButton")
+focus_previous = NodePath("../ExitButton")
+theme_type_variation = &"TitleButton"
+text = "MAINMENU_NEW_GAME"
+clip_text = true
+
+[node name="ContinueButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../NewGameButton")
+focus_neighbor_right = NodePath("../MultiplayerButton")
+focus_next = NodePath("../MultiplayerButton")
+focus_previous = NodePath("../NewGameButton")
+theme_type_variation = &"TitleButton"
+disabled = true
+text = "MAINMENU_CONTINUE"
+clip_text = true
+
+[node name="MultiplayerButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+editor_description = "UI-27"
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../ContinueButton")
+focus_neighbor_right = NodePath("../OptionsButton")
+focus_next = NodePath("../OptionsButton")
+focus_previous = NodePath("../ContinueButton")
+theme_type_variation = &"TitleButton"
+text = "MAINMENU_MULTIPLAYER"
+clip_text = true
+
+[node name="OptionsButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+editor_description = "UI-5"
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../MultiplayerButton")
+focus_neighbor_right = NodePath("../CreditsButton")
+focus_next = NodePath("../CreditsButton")
+focus_previous = NodePath("../MultiplayerButton")
+theme_type_variation = &"TitleButton"
+text = "MAINMENU_OPTIONS"
+clip_text = true
+
+[node name="CreditsButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+editor_description = "UI-32"
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../OptionsButton")
+focus_neighbor_right = NodePath("../ExitButton")
+focus_next = NodePath("../ExitButton")
+focus_previous = NodePath("../OptionsButton")
+theme_type_variation = &"TitleButton"
+text = "MAINMENU_CREDITS"
+clip_text = true
+
+[node name="ExitButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"]
+editor_description = "UI-3"
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../OptionsButton")
+focus_neighbor_right = NodePath("../NewGameButton")
+focus_next = NodePath("../NewGameButton")
+focus_previous = NodePath("../OptionsButton")
+theme_type_variation = &"TitleButton"
+text = "MAINMENU_EXIT"
+clip_text = true
+
+[node name="BottomSpace" type="Control" parent="MenuPanel/MenuList"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 0.35
+
+[node name="BottomMargin" type="MarginContainer" parent="MenuPanel/MenuList"]
+layout_mode = 2
+theme_type_variation = &"BottomMargin"
+
+[node name="ReleaseInfoBox" parent="MenuPanel/MenuList/BottomMargin" instance=ExtResource("3_km0er")]
+layout_mode = 2
+
+[node name="LocaleButton" parent="MenuPanel/MenuList/BottomMargin" instance=ExtResource("3_amonp")]
+layout_mode = 2
+size_flags_horizontal = 8
+alignment = 0
+text_overrun_behavior = 4
+
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton" to="." method="_on_new_game_button_pressed"]
+[connection signal="visibility_changed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton" to="." method="_on_new_game_button_visibility_changed"]
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/ContinueButton" to="." method="_on_continue_button_pressed"]
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/MultiplayerButton" to="." method="_on_multi_player_button_pressed"]
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"]
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/CreditsButton" to="." method="_on_credits_button_pressed"]
+[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/ExitButton" to="." method="_on_exit_button_pressed"]
diff --git a/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd
new file mode 100644
index 0000000..e363162
--- /dev/null
+++ b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd
@@ -0,0 +1,41 @@
+extends HBoxContainer
+
+@export
+var _version_label : Button
+
+@export
+var _commit_label : Button
+
+@export
+var _checksum_label : Button
+
+var _checksum : String = "????"
+
+# REQUIREMENTS:
+# * UIFUN-97
+func _ready():
+ _version_label.text = _GIT_INFO_.release_name
+ _version_label.tooltip_text = _GIT_INFO_.tag
+ _commit_label.text = _GIT_INFO_.short_hash
+ _commit_label.tooltip_text = _GIT_INFO_.commit_hash
+ # UI-111
+ _checksum = Checksum.get_checksum_text()
+ _update_checksum_label_text()
+
+func _notification(what : int):
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_checksum_label_text()
+
+func _update_checksum_label_text() -> void:
+ _checksum_label.tooltip_text = tr("MAINMENU_CHECKSUM").format({ "checksum": _checksum })
+ _checksum_label.text = "(%s)" % _checksum.substr(0, 4)
+
+func _on_version_label_pressed():
+ DisplayServer.clipboard_set(_GIT_INFO_.tag)
+
+func _on_commit_label_pressed():
+ DisplayServer.clipboard_set(_GIT_INFO_.commit_hash)
+
+func _on_checksum_label_pressed():
+ DisplayServer.clipboard_set(_checksum)
diff --git a/game/src/Game/Menu/MainMenu/ReleaseInfoBox.tscn b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.tscn
new file mode 100644
index 0000000..821982b
--- /dev/null
+++ b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.tscn
@@ -0,0 +1,38 @@
+[gd_scene load_steps=2 format=3 uid="uid://cen7wkmn6og66"]
+
+[ext_resource type="Script" path="res://src/MainMenu/ReleaseInfoBox.gd" id="1_y2djw"]
+
+[node name="ReleaseInfoBox" type="HBoxContainer" node_paths=PackedStringArray("_version_label", "_commit_label", "_checksum_label")]
+editor_description = "UI-31"
+script = ExtResource("1_y2djw")
+_version_label = NodePath("VersionLabel")
+_commit_label = NodePath("CommitLabel")
+_checksum_label = NodePath("ChecksumLabel")
+
+[node name="VersionLabel" type="Button" parent="."]
+layout_mode = 2
+tooltip_text = "VERSION_MISSING"
+theme_type_variation = &"VersionLabel"
+text = "VERSION_MISSING"
+flat = true
+alignment = 0
+
+[node name="CommitLabel" type="Button" parent="."]
+layout_mode = 2
+theme_type_variation = &"CommitLabel"
+text = "????????"
+flat = true
+alignment = 0
+
+[node name="ChecksumLabel" type="Button" parent="."]
+editor_description = "UI-111"
+layout_mode = 2
+tooltip_text = "CHECKSUM_MISSING"
+theme_type_variation = &"ChecksumLabel"
+text = "(????)"
+flat = true
+alignment = 0
+
+[connection signal="pressed" from="VersionLabel" to="." method="_on_version_label_pressed"]
+[connection signal="pressed" from="CommitLabel" to="." method="_on_commit_label_pressed"]
+[connection signal="pressed" from="ChecksumLabel" to="." method="_on_checksum_label_pressed"]
diff --git a/game/src/Game/Menu/OptionMenu/AutosaveIntervalSelector.gd b/game/src/Game/Menu/OptionMenu/AutosaveIntervalSelector.gd
new file mode 100644
index 0000000..2c55862
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/AutosaveIntervalSelector.gd
@@ -0,0 +1,2 @@
+extends SettingOptionButton
+
diff --git a/game/src/Game/Menu/OptionMenu/ControlsTab.tscn b/game/src/Game/Menu/OptionMenu/ControlsTab.tscn
new file mode 100644
index 0000000..b84dc85
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/ControlsTab.tscn
@@ -0,0 +1,14 @@
+[gd_scene load_steps=2 format=3 uid="uid://cdwymd51i4b2f"]
+
+[ext_resource type="PackedScene" uid="uid://by4gggse2nsdx" path="res://addons/keychain/ShortcutEdit.tscn" id="1_fv8sh"]
+
+[node name="Controls" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="ShortcutEdit" parent="." instance=ExtResource("1_fv8sh")]
+layout_mode = 1
diff --git a/game/src/Game/Menu/OptionMenu/GeneralTab.gd b/game/src/Game/Menu/OptionMenu/GeneralTab.gd
new file mode 100644
index 0000000..3d98678
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/GeneralTab.gd
@@ -0,0 +1,9 @@
+extends HBoxContainer
+
+@export var initial_focus: Control
+
+func _notification(what : int) -> void:
+ match(what):
+ NOTIFICATION_VISIBILITY_CHANGED:
+ if visible and is_inside_tree():
+ initial_focus.grab_focus()
diff --git a/game/src/Game/Menu/OptionMenu/GeneralTab.tscn b/game/src/Game/Menu/OptionMenu/GeneralTab.tscn
new file mode 100644
index 0000000..4e9ff6a
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/GeneralTab.tscn
@@ -0,0 +1,81 @@
+[gd_scene load_steps=5 format=3 uid="uid://duwjal7sd7p6w"]
+
+[ext_resource type="Script" path="res://src/OptionMenu/GeneralTab.gd" id="1_gbutn"]
+[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="2_5cfd7"]
+[ext_resource type="Script" path="res://src/OptionMenu/SettingNodes/SettingOptionButton.gd" id="2_msx2u"]
+[ext_resource type="Script" path="res://src/OptionMenu/AutosaveIntervalSelector.gd" id="2_t06tb"]
+
+[node name="GeneralTab" type="HBoxContainer" node_paths=PackedStringArray("initial_focus")]
+editor_description = "UI-48, UIFUN-45"
+alignment = 1
+script = ExtResource("1_gbutn")
+initial_focus = NodePath("VBoxContainer/GridContainer/SavegameFormatSelector")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="Control" type="Control" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 0.1
+
+[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+columns = 2
+
+[node name="SavegameFormatLabel" type="Label" parent="VBoxContainer/GridContainer"]
+layout_mode = 2
+text = "OPTIONS_GENERAL_SAVEFORMAT"
+
+[node name="SavegameFormatSelector" type="OptionButton" parent="VBoxContainer/GridContainer"]
+editor_description = "UI-50"
+layout_mode = 2
+focus_neighbor_bottom = NodePath("../AutosaveIntervalSelector")
+item_count = 2
+selected = 0
+popup/item_0/text = "OPTIONS_GENERAL_BINARY"
+popup/item_0/id = 0
+popup/item_1/text = "OPTIONS_GENERAL_TEXT"
+popup/item_1/id = 1
+script = ExtResource("2_msx2u")
+section_name = "general"
+setting_name = "savegame_format"
+default_selected = 0
+
+[node name="AutosaveIntervalLabel" type="Label" parent="VBoxContainer/GridContainer"]
+layout_mode = 2
+text = "OPTIONS_GENERAL_AUTOSAVE"
+
+[node name="AutosaveIntervalSelector" type="OptionButton" parent="VBoxContainer/GridContainer"]
+editor_description = "UI-15, UIFUN-19"
+layout_mode = 2
+focus_neighbor_top = NodePath("../SavegameFormatSelector")
+focus_neighbor_bottom = NodePath("../LocaleButton")
+item_count = 5
+selected = 0
+popup/item_0/text = "OPTIONS_GENERAL_AUTOSAVE_MONTHLY"
+popup/item_0/id = 0
+popup/item_1/text = "OPTIONS_GENERAL_AUTOSAVE_BIMONTHLY"
+popup/item_1/id = 1
+popup/item_2/text = "OPTIONS_GENERAL_AUTOSAVE_YEARLY"
+popup/item_2/id = 2
+popup/item_3/text = "OPTIONS_GENERAL_AUTOSAVE_BIYEARLY"
+popup/item_3/id = 3
+popup/item_4/text = "OPTIONS_GENERAL_AUTOSAVE_NEVER"
+popup/item_4/id = 4
+script = ExtResource("2_t06tb")
+section_name = "general"
+setting_name = "autosave_interval"
+default_selected = 0
+
+[node name="LocaleLabel" type="Label" parent="VBoxContainer/GridContainer"]
+layout_mode = 2
+text = "OPTIONS_GENERAL_LANGUAGE"
+
+[node name="LocaleButton" parent="VBoxContainer/GridContainer" instance=ExtResource("2_5cfd7")]
+editor_description = "UI-79"
+layout_mode = 2
+focus_neighbor_top = NodePath("../AutosaveIntervalSelector")
+alignment = 0
+text_overrun_behavior = 4
diff --git a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd
new file mode 100644
index 0000000..4dd86e1
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd
@@ -0,0 +1,64 @@
+extends SettingOptionButton
+
+# REQUIREMENTS
+# * UIFUN-24
+# * UIFUN-31
+
+@export
+var default_value : float = GuiScale.error_guiscale
+
+func _find_guiscale_index_by_value(value : float) -> int:
+ for item_index in item_count:
+ if get_item_metadata(item_index) == value:
+ return item_index
+ return -1
+
+func _sync_guiscales(to_select : float = GuiScale.get_current_guiscale()) -> void:
+ clear()
+ default_selected = -1
+ selected = -1
+ for guiscale_value in GuiScale.get_guiscale_value_list():
+ add_item(GuiScale.get_guiscale_display_name(guiscale_value))
+ set_item_metadata(item_count - 1, guiscale_value)
+
+ if guiscale_value == default_value:
+ default_selected = item_count - 1
+
+ if guiscale_value == to_select:
+ selected = item_count - 1
+
+ if default_selected == -1:
+ default_selected = item_count - 1
+
+ if selected == -1:
+ selected = default_selected
+
+func _setup_button():
+ if default_value <= 0:
+ default_value = ProjectSettings.get_setting("display/window/stretch/scale")
+ GuiScale.add_guiscale(default_value, &"default")
+ _sync_guiscales()
+
+func _get_value_for_file(select_value : int):
+ if _valid_index(select_value):
+ return get_item_metadata(select_value)
+ else:
+ return null
+
+func _set_value_from_file(load_value):
+ if typeof(load_value) == TYPE_FLOAT:
+ var target_guiscale : float = load_value
+ selected = _find_guiscale_index_by_value(target_guiscale)
+ if selected != -1: return
+ if GuiScale.add_guiscale(target_guiscale):
+ _sync_guiscales(target_guiscale)
+ return
+ push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name])
+ selected = default_selected
+
+func _on_option_selected(index : int, by_user : bool):
+ if _valid_index(index):
+ GuiScale.set_guiscale(get_item_metadata(index))
+ else:
+ push_error("Invalid GuiScaleSelector index: %d" % index)
+ reset_setting(not by_user)
diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
new file mode 100644
index 0000000..7de033a
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
@@ -0,0 +1,18 @@
+extends SettingOptionButton
+
+func _setup_button() -> void:
+ clear()
+ for screen_index in DisplayServer.get_screen_count():
+ add_item("Monitor %d" % (screen_index + 1))
+ default_selected = get_viewport().get_window().current_screen
+
+func _on_option_selected(index : int, by_user : bool) -> void:
+ if _valid_index(index):
+ var window := get_viewport().get_window()
+ var mode := window.mode
+ window.mode = Window.MODE_WINDOWED
+ get_viewport().get_window().set_current_screen(index)
+ window.mode = mode
+ else:
+ push_error("Invalid MonitorDisplaySelector index: %d" % index)
+ reset_setting(not by_user)
diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd
new file mode 100644
index 0000000..5f6a088
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd
@@ -0,0 +1,68 @@
+extends Control
+
+# REQUIREMENTS
+# * SS-13
+
+signal back_button_pressed
+
+func _ready():
+ # Prepare options menu before loading user settings
+ var tab_bar : TabBar = $Margin/Tab.get_child(0, true)
+
+ # This ends up easier to manage then trying to manually recreate the TabContainer's behavior
+ # These buttons can be accessed regardless of the tab
+ var button_list := HBoxContainer.new()
+ button_list.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
+ button_list.alignment = BoxContainer.ALIGNMENT_END
+ tab_bar.add_child(button_list)
+
+ # REQUIREMENTS
+ # * UI-12
+ # * UIFUN-14
+ var reset_button := Button.new()
+ reset_button.text = "OPTIONS_RESET"
+ reset_button.pressed.connect(Events.Options.try_reset_settings)
+ button_list.add_child(reset_button)
+
+ # REQUIREMENTS
+ # * UI-11
+ # * UIFUN-17
+ var back_button := Button.new()
+ back_button.text = "OPTIONS_BACK"
+ back_button.pressed.connect(_on_back_button_pressed)
+ button_list.add_child(back_button)
+ get_viewport().get_window().close_requested.connect(_on_window_close_requested)
+ _save_overrides.call_deferred()
+ Events.Options.save_settings.connect(func(_f): self._save_overrides.call_deferred())
+
+func _notification(what):
+ match what:
+ NOTIFICATION_CRASH:
+ _on_window_close_requested()
+
+func _input(event):
+ if self.is_visible_in_tree():
+ if event.is_action_pressed("ui_cancel"):
+ _on_back_button_pressed()
+
+func _on_back_button_pressed():
+ Events.Options.save_settings_to_file()
+ back_button_pressed.emit()
+
+func _on_window_close_requested() -> void:
+ if visible:
+ Events.Options.save_settings_to_file()
+
+func _save_overrides() -> void:
+ var override_path : String = ProjectSettings.get_setting("application/config/project_settings_override", "")
+ 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)
+ file.set_value("display", "window/size/mode", get_viewport().get_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)
diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn b/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn
new file mode 100644
index 0000000..3156e33
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn
@@ -0,0 +1,52 @@
+[gd_scene load_steps=8 format=3 uid="uid://cnbfxjy1m6wja"]
+
+[ext_resource type="Theme" uid="uid://fbxssqcg1s0m" path="res://theme/options_menu.tres" id="1_0up1d"]
+[ext_resource type="Script" path="res://src/OptionMenu/OptionsMenu.gd" id="1_tlein"]
+[ext_resource type="PackedScene" uid="uid://bq3awxxjn1tuw" path="res://src/OptionMenu/VideoTab.tscn" id="2_ji8xr"]
+[ext_resource type="PackedScene" uid="uid://cbtgwpx2wxi33" path="res://src/OptionMenu/SoundTab.tscn" id="3_4w35t"]
+[ext_resource type="PackedScene" uid="uid://duwjal7sd7p6w" path="res://src/OptionMenu/GeneralTab.tscn" id="3_6gvf6"]
+[ext_resource type="PackedScene" uid="uid://bq7ibhm0txl5p" path="res://addons/keychain/ShortcutEdit.tscn" id="4_vdhjp"]
+[ext_resource type="PackedScene" uid="uid://dp2grvybtecqu" path="res://src/OptionMenu/OtherTab.tscn" id="5_ahefp"]
+
+[node name="OptionsMenu" type="PanelContainer"]
+editor_description = "UI-25"
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_0up1d")
+theme_type_variation = &"BackgroundPanel"
+script = ExtResource("1_tlein")
+
+[node name="Margin" type="MarginContainer" parent="."]
+layout_mode = 2
+theme_type_variation = &"TabMargin"
+
+[node name="Tab" type="TabContainer" parent="Margin"]
+editor_description = "UI-45"
+layout_mode = 2
+tab_alignment = 1
+use_hidden_tabs_for_min_size = true
+
+[node name="General" parent="Margin/Tab" instance=ExtResource("3_6gvf6")]
+layout_mode = 2
+
+[node name="Video" parent="Margin/Tab" instance=ExtResource("2_ji8xr")]
+editor_description = "UI-46, UIFUN-43"
+visible = false
+layout_mode = 2
+
+[node name="Sound" parent="Margin/Tab" instance=ExtResource("3_4w35t")]
+editor_description = "UI-47, UIFUN-44"
+visible = false
+layout_mode = 2
+
+[node name="Controls" parent="Margin/Tab" instance=ExtResource("4_vdhjp")]
+editor_description = "SS-27, UI-49, UIFUN-46"
+visible = false
+layout_mode = 2
+alignment = 1
+
+[node name="Other" parent="Margin/Tab" instance=ExtResource("5_ahefp")]
+layout_mode = 2
diff --git a/game/src/Game/Menu/OptionMenu/OtherTab.tscn b/game/src/Game/Menu/OptionMenu/OtherTab.tscn
new file mode 100644
index 0000000..0ffc92d
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/OtherTab.tscn
@@ -0,0 +1,18 @@
+[gd_scene format=3 uid="uid://dp2grvybtecqu"]
+
+[node name="Other" type="Control"]
+visible = false
+layout_mode = 3
+anchors_preset = 0
+
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
+layout_mode = 0
+offset_right = 40.0
+offset_bottom = 40.0
+
+[node name="Label" type="Label" parent="HBoxContainer"]
+layout_mode = 2
+text = "Spinbox Example :)"
+
+[node name="SpinBox" type="SpinBox" parent="HBoxContainer"]
+layout_mode = 2
diff --git a/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd
new file mode 100644
index 0000000..57ba4ab
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd
@@ -0,0 +1,4 @@
+extends SettingOptionButton
+
+func _setup_button():
+ pass
diff --git a/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd
new file mode 100644
index 0000000..31b115b
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd
@@ -0,0 +1,5 @@
+extends SettingOptionButton
+
+
+func _setup_button():
+ pass
diff --git a/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd b/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd
new file mode 100644
index 0000000..4d2b8f2
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd
@@ -0,0 +1,35 @@
+extends ConfirmationDialog
+class_name ResolutionRevertDialog
+
+signal dialog_accepted(button : SettingRevertButton)
+signal dialog_reverted(button : SettingRevertButton)
+
+@export_group("Nodes")
+@export var timer : Timer
+
+var _revert_node : SettingRevertButton = null
+
+func show_dialog(button : SettingRevertButton, time : float = 0) -> void:
+ timer.start(time)
+ popup_centered(Vector2(1,1))
+ _revert_node = button
+
+func _notification(what):
+ if what == NOTIFICATION_VISIBILITY_CHANGED:
+ set_process(visible)
+ if not visible: _revert_node = null
+
+func _process(_delta) -> void:
+ dialog_text = tr("OPTIONS_VIDEO_RESOLUTION_DIALOG_TEXT").format({ "time": int(timer.time_left) })
+
+func _on_canceled_or_close_requested() -> void:
+ timer.stop()
+ dialog_reverted.emit(_revert_node)
+
+func _on_confirmed() -> void:
+ timer.stop()
+ dialog_accepted.emit(_revert_node)
+
+func _on_resolution_revert_timer_timeout() -> void:
+ dialog_reverted.emit(_revert_node)
+ hide()
diff --git a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd
new file mode 100644
index 0000000..ebdf718
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd
@@ -0,0 +1,91 @@
+extends SettingRevertButton
+
+# REQUIREMENTS
+# * UIFUN-21
+# * UIFUN-28
+# * UIFUN-301
+# * UIFUN-302
+
+@export var default_value : Vector2i = Resolution.error_resolution
+
+func _find_resolution_index_by_value(value : Vector2i) -> int:
+ for item_index in item_count:
+ if get_item_metadata(item_index) == value:
+ return item_index
+ return -1
+
+func _sync_resolutions(
+ value : Vector2i = Resolution.error_resolution,
+ _resolution_name = null,
+ _resolution_display_name = null
+) -> void:
+ clear()
+ default_selected = -1
+ selected = -1
+ var resolution_list := Resolution.get_resolution_value_list()
+ if value != Resolution.error_resolution:
+ resolution_list.append(value)
+ for resolution_value in resolution_list:
+ var display_name := "%sx%s" % [resolution_value.x, resolution_value.y]
+ var resolution_name := Resolution.get_resolution_name(resolution_value)
+ if resolution_name == &"Default":
+ display_name = "Default (%s)" % resolution_name
+ if not resolution_name.is_empty():
+ display_name = "%s (%s)" % [display_name, resolution_name + (", Default" if resolution_value == default_value else "")]
+ add_item(display_name)
+ set_item_metadata(item_count - 1, resolution_value)
+
+ if resolution_value == default_value:
+ default_selected = item_count - 1
+
+ if resolution_value == Resolution.get_current_resolution():
+ selected = item_count - 1
+
+ if default_selected == -1:
+ default_selected = item_count - 1
+
+ if selected == -1:
+ selected = default_selected
+
+func _setup_button() -> void:
+ Resolution.resolution_added.connect(_sync_resolutions)
+ if default_value.x <= 0:
+ default_value.x = ProjectSettings.get_setting("display/window/size/viewport_width")
+ if default_value.y <= 0:
+ default_value.y = ProjectSettings.get_setting("display/window/size/viewport_height")
+ if not Resolution.has_resolution(default_value):
+ Resolution.add_resolution(default_value, &"Default")
+ else:
+ _sync_resolutions()
+
+func _get_value_for_file(select_value : int) -> Variant:
+ if _valid_index(select_value):
+ return get_item_metadata(select_value)
+ else:
+ return null
+
+func _set_value_from_file(load_value) -> void:
+ var target_resolution := Resolution.error_resolution
+ match typeof(load_value):
+ TYPE_VECTOR2I: target_resolution = load_value
+ TYPE_STRING, TYPE_STRING_NAME: target_resolution = Resolution.get_resolution_value_from_string(load_value)
+ if target_resolution != Resolution.error_resolution:
+ selected = _find_resolution_index_by_value(target_resolution)
+ if selected != -1: return
+ if Resolution.add_resolution(target_resolution):
+ Resolution.set_resolution(target_resolution)
+ return
+ push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name])
+ selected = default_selected
+
+func _on_option_selected(index : int, by_user : bool) -> void:
+ if _valid_index(index):
+ if by_user:
+ print("Start Revert Countdown!")
+ revert_dialog.show_dialog.call_deferred(self)
+ previous_index = _find_resolution_index_by_value(Resolution.get_current_resolution())
+
+ Resolution.set_resolution(get_item_metadata(index))
+ else:
+ push_error("Invalid ResolutionSelector index: %d" % index)
+ reset_setting(not by_user)
diff --git a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
new file mode 100644
index 0000000..af95901
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
@@ -0,0 +1,48 @@
+extends SettingRevertButton
+
+# REQUIREMENTS
+# * UIFUN-42
+
+enum ScreenMode { Unknown = -1, Fullscreen, Borderless, Windowed }
+
+func get_screen_mode_from_window_mode(window_mode : int) -> ScreenMode:
+ match window_mode:
+ Window.MODE_EXCLUSIVE_FULLSCREEN:
+ return ScreenMode.Fullscreen
+ Window.MODE_FULLSCREEN:
+ return ScreenMode.Borderless
+ Window.MODE_WINDOWED:
+ return ScreenMode.Windowed
+ _:
+ return ScreenMode.Unknown
+
+func get_window_mode_from_screen_mode(screen_mode : int) -> Window.Mode:
+ match screen_mode:
+ ScreenMode.Fullscreen:
+ return Window.MODE_EXCLUSIVE_FULLSCREEN
+ ScreenMode.Borderless:
+ return Window.MODE_FULLSCREEN
+ ScreenMode.Windowed:
+ return Window.MODE_WINDOWED
+ _:
+ return Window.MODE_EXCLUSIVE_FULLSCREEN
+
+func _setup_button():
+ default_selected = get_screen_mode_from_window_mode(get_viewport().get_window().mode)
+ selected = default_selected
+
+func _on_option_selected(index : int, by_user : bool) -> void:
+ if _valid_index(index):
+ if by_user:
+ print("Start Revert Countdown!")
+ revert_dialog.show_dialog.call_deferred(self)
+ previous_index = get_screen_mode_from_window_mode(get_viewport().get_window().mode)
+
+ var current_resolution := Resolution.get_current_resolution()
+ var window_mode := get_window_mode_from_screen_mode(index)
+ Resolution.window_mode_changed.emit(window_mode)
+ get_viewport().get_window().mode = window_mode
+ Resolution.set_resolution(current_resolution)
+ else:
+ push_error("Invalid ScreenModeSelector index: %d" % index)
+ reset_setting(not by_user)
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd
new file mode 100644
index 0000000..6fa30ed
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd
@@ -0,0 +1,41 @@
+extends HSlider
+class_name SettingHSlider
+
+@export
+var section_name : String = "setting"
+
+@export
+var setting_name : String = "setting_hslider"
+
+@export
+var default_value : float = 0
+
+func _ready():
+ Events.Options.load_settings.connect(load_setting)
+ Events.Options.save_settings.connect(save_setting)
+ Events.Options.reset_settings.connect(reset_setting)
+
+func load_setting(file : ConfigFile):
+ if file == null: return
+ var load_value = file.get_value(section_name, setting_name, default_value)
+ match typeof(load_value):
+ TYPE_FLOAT, TYPE_INT:
+ if value == load_value: value_changed.emit(value)
+ value = load_value
+ return
+ TYPE_STRING, TYPE_STRING_NAME:
+ var load_string := load_value as String
+ if load_string.is_valid_float():
+ load_value = load_string.to_float()
+ if value == load_value: value_changed.emit(value)
+ value = load_value
+ return
+ push_error("Setting value '%s' invalid for setting [%s] \"%s\"" % [load_value, section_name, setting_name])
+ value = default_value
+
+func save_setting(file : ConfigFile):
+ if file == null: return
+ file.set_value(section_name, setting_name, value)
+
+func reset_setting():
+ value = default_value
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd
new file mode 100644
index 0000000..c5a805e
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd
@@ -0,0 +1,77 @@
+extends OptionButton
+class_name SettingOptionButton
+
+signal option_selected(index : int, by_user : bool)
+
+@export
+var section_name : String = "setting"
+
+@export
+var setting_name : String = "setting_optionbutton"
+
+@export
+var default_selected : int = -1:
+ get: return default_selected
+ set(v):
+ if v < 0 or item_count == 0:
+ default_selected = -1
+ return
+ default_selected = v % item_count
+
+func _valid_index(index : int) -> bool:
+ return 0 <= index and index < item_count
+
+func _get_value_for_file(select_value : int):
+ if _valid_index(select_value):
+ return select_value
+ else:
+ return null
+
+func _set_value_from_file(load_value) -> void:
+ match typeof(load_value):
+ TYPE_INT:
+ if _valid_index(load_value):
+ selected = load_value
+ return
+ TYPE_STRING, TYPE_STRING_NAME:
+ var load_string := load_value as String
+ if load_string.is_valid_int():
+ var load_int := load_string.to_int()
+ if _valid_index(load_int):
+ selected = load_int
+ return
+ for item_index in item_count:
+ if load_string == get_item_text(item_index):
+ selected = item_index
+ return
+ push_error("Setting value '%s' invalid for setting [%s] \"%s\"" % [load_value, section_name, setting_name])
+ selected = default_selected
+
+func _setup_button() -> void:
+ pass
+
+func _ready():
+ Events.Options.load_settings.connect(load_setting)
+ Events.Options.save_settings.connect(save_setting)
+ Events.Options.reset_settings.connect(reset_setting)
+ 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]
+ push_error(msg)
+ OS.alert(msg, "%s Options Error" % section_name)
+ get_tree().quit()
+
+func load_setting(file : ConfigFile) -> void:
+ if file == null: return
+ _set_value_from_file(file.get_value(section_name, setting_name, _get_value_for_file(default_selected)))
+ option_selected.emit(selected, false)
+
+func save_setting(file : ConfigFile) -> void:
+ if file == null: return
+ file.set_value(section_name, setting_name, _get_value_for_file(selected))
+
+func reset_setting(no_emit : bool = false) -> void:
+ selected = default_selected
+ if not no_emit:
+ option_selected.emit(selected, false)
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd
new file mode 100644
index 0000000..945d35b
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd
@@ -0,0 +1,27 @@
+extends SettingOptionButton
+class_name SettingRevertButton
+
+@export_group("Nodes")
+@export var revert_dialog : ResolutionRevertDialog
+
+var previous_index : int = -1
+
+func _ready():
+ super()
+ if revert_dialog != null:
+ revert_dialog.visibility_changed.connect(_on_revert_dialog_visibility_changed)
+ revert_dialog.dialog_accepted.connect(_on_accepted)
+ revert_dialog.dialog_reverted.connect(_on_reverted)
+
+func _on_revert_dialog_visibility_changed() -> void:
+ disabled = revert_dialog.visible
+ if not revert_dialog.visible:
+ previous_index = -1
+
+func _on_reverted(button : SettingRevertButton) -> void:
+ if button != self: return
+ selected = previous_index
+ option_selected.emit(selected, false)
+
+func _on_accepted(button : SettingRevertButton) -> void:
+ if button != self: return
diff --git a/game/src/Game/Menu/OptionMenu/SoundTab.gd b/game/src/Game/Menu/OptionMenu/SoundTab.gd
new file mode 100644
index 0000000..c707605
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/SoundTab.gd
@@ -0,0 +1,4 @@
+extends HBoxContainer
+
+func _on_ear_exploder_toggled(button_pressed):
+ print("KABOOM!!!" if button_pressed else "DEFUSED!!!")
diff --git a/game/src/Game/Menu/OptionMenu/SoundTab.tscn b/game/src/Game/Menu/OptionMenu/SoundTab.tscn
new file mode 100644
index 0000000..10d7f10
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/SoundTab.tscn
@@ -0,0 +1,34 @@
+[gd_scene load_steps=3 format=3 uid="uid://cbtgwpx2wxi33"]
+
+[ext_resource type="Script" path="res://src/OptionMenu/SoundTab.gd" id="1_a7k0s"]
+[ext_resource type="PackedScene" uid="uid://dy4si8comamnv" path="res://src/OptionMenu/VolumeGrid.tscn" id="1_okpft"]
+
+[node name="Sound" type="HBoxContainer"]
+alignment = 1
+script = ExtResource("1_a7k0s")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="Control" type="Control" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 0.1
+
+[node name="VolumeGrid" parent="VBoxContainer" instance=ExtResource("1_okpft")]
+layout_mode = 2
+
+[node name="ButtonGrid" type="GridContainer" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 2
+columns = 2
+
+[node name="Spacer" type="Control" parent="VBoxContainer/ButtonGrid"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="EarExploder" type="CheckButton" parent="VBoxContainer/ButtonGrid"]
+layout_mode = 2
+text = "Explode Eardrums on Startup?"
+
+[connection signal="toggled" from="VBoxContainer/ButtonGrid/EarExploder" to="." method="_on_ear_exploder_toggled"]
diff --git a/game/src/Game/Menu/OptionMenu/VideoTab.gd b/game/src/Game/Menu/OptionMenu/VideoTab.gd
new file mode 100644
index 0000000..3d98678
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/VideoTab.gd
@@ -0,0 +1,9 @@
+extends HBoxContainer
+
+@export var initial_focus: Control
+
+func _notification(what : int) -> void:
+ match(what):
+ NOTIFICATION_VISIBILITY_CHANGED:
+ if visible and is_inside_tree():
+ initial_focus.grab_focus()
diff --git a/game/src/Game/Menu/OptionMenu/VideoTab.tscn b/game/src/Game/Menu/OptionMenu/VideoTab.tscn
new file mode 100644
index 0000000..244f481
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/VideoTab.tscn
@@ -0,0 +1,181 @@
+[gd_scene load_steps=9 format=3 uid="uid://bq3awxxjn1tuw"]
+
+[ext_resource type="Script" path="res://src/OptionMenu/ResolutionSelector.gd" id="1_i8nro"]
+[ext_resource type="Script" path="res://src/OptionMenu/VideoTab.gd" id="1_jvv62"]
+[ext_resource type="Script" path="res://src/OptionMenu/ScreenModeSelector.gd" id="2_wa7vw"]
+[ext_resource type="Script" path="res://src/OptionMenu/GuiScaleSelector.gd" id="3_pgc5d"]
+[ext_resource type="Script" path="res://src/OptionMenu/MonitorDisplaySelector.gd" id="3_y6lyb"]
+[ext_resource type="Script" path="res://src/OptionMenu/RefreshRateSelector.gd" id="4_381mg"]
+[ext_resource type="Script" path="res://src/OptionMenu/QualityPresetSelector.gd" id="5_srg4v"]
+[ext_resource type="Script" path="res://src/OptionMenu/ResolutionRevertDialog.gd" id="8_802cr"]
+
+[node name="Video" type="HBoxContainer" node_paths=PackedStringArray("initial_focus")]
+editor_description = "UI-46"
+alignment = 1
+script = ExtResource("1_jvv62")
+initial_focus = NodePath("VideoSettingList/VideoSettingGrid/ResolutionSelector")
+
+[node name="VideoSettingList" type="VBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="Control" type="Control" parent="VideoSettingList"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 0.1
+
+[node name="VideoSettingGrid" type="GridContainer" parent="VideoSettingList"]
+layout_mode = 2
+size_flags_vertical = 3
+columns = 2
+
+[node name="ResolutionLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+text = "OPTIONS_VIDEO_RESOLUTION"
+
+[node name="ResolutionSelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid" node_paths=PackedStringArray("revert_dialog")]
+editor_description = "UI-19"
+layout_mode = 2
+focus_neighbor_bottom = NodePath("../ScreenModeSelector")
+item_count = 1
+selected = 0
+popup/item_0/text = "MISSING"
+popup/item_0/id = 0
+script = ExtResource("1_i8nro")
+revert_dialog = NodePath("../../../ResolutionRevertDialog")
+section_name = "video"
+setting_name = "resolution"
+
+[node name="GuiScaleLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+text = "OPTIONS_VIDEO_GUI_SCALE"
+
+[node name="GuiScaleSelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid"]
+editor_description = "UI-23"
+layout_mode = 2
+focus_neighbor_bottom = NodePath("../ScreenModeSelector")
+item_count = 1
+selected = 0
+popup/item_0/text = "MISSING"
+popup/item_0/id = 0
+script = ExtResource("3_pgc5d")
+section_name = "video"
+setting_name = "gui_scale"
+
+[node name="ScreenModeLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+editor_description = "UI-44"
+layout_mode = 2
+text = "OPTIONS_VIDEO_SCREEN_MODE"
+
+[node name="ScreenModeSelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid" node_paths=PackedStringArray("revert_dialog")]
+layout_mode = 2
+focus_neighbor_top = NodePath("../ResolutionSelector")
+focus_neighbor_bottom = NodePath("../MonitorDisplaySelector")
+item_count = 3
+selected = 0
+popup/item_0/text = "OPTIONS_VIDEO_FULLSCREEN"
+popup/item_0/id = 0
+popup/item_1/text = "OPTIONS_VIDEO_BORDERLESS"
+popup/item_1/id = 1
+popup/item_2/text = "OPTIONS_VIDEO_WINDOWED"
+popup/item_2/id = 2
+script = ExtResource("2_wa7vw")
+revert_dialog = NodePath("../../../ResolutionRevertDialog")
+section_name = "video"
+setting_name = "mode_selected"
+
+[node name="MonitorSelectionLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+text = "OPTIONS_VIDEO_MONITOR_SELECTION"
+
+[node name="MonitorDisplaySelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+focus_neighbor_top = NodePath("../ScreenModeSelector")
+focus_neighbor_bottom = NodePath("../RefreshRateSelector")
+item_count = 1
+selected = 0
+popup/item_0/text = "MISSING"
+popup/item_0/id = 0
+script = ExtResource("3_y6lyb")
+section_name = "video"
+setting_name = "current_screen"
+
+[node name="RefreshRateLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+text = "OPTIONS_VIDEO_REFRESH_RATE"
+
+[node name="RefreshRateSelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid"]
+editor_description = "UI-18, UIFUN-20"
+layout_mode = 2
+tooltip_text = "OPTIONS_VIDEO_REFRESH_RATE_TOOLTIP"
+focus_neighbor_top = NodePath("../MonitorDisplaySelector")
+focus_neighbor_bottom = NodePath("../QualityPresetSelector")
+item_count = 8
+selected = 0
+popup/item_0/text = "VSYNC"
+popup/item_0/id = 0
+popup/item_1/text = "30hz"
+popup/item_1/id = 1
+popup/item_2/text = "60hz"
+popup/item_2/id = 2
+popup/item_3/text = "90hz"
+popup/item_3/id = 3
+popup/item_4/text = "120hz"
+popup/item_4/id = 4
+popup/item_5/text = "144hz"
+popup/item_5/id = 5
+popup/item_6/text = "365hz"
+popup/item_6/id = 6
+popup/item_7/text = "Unlimited"
+popup/item_7/id = 7
+script = ExtResource("4_381mg")
+section_name = "video"
+setting_name = "refresh_rate"
+default_selected = 0
+
+[node name="QualityPresetLabel" type="Label" parent="VideoSettingList/VideoSettingGrid"]
+layout_mode = 2
+text = "OPTIONS_VIDEO_QUALITY"
+
+[node name="QualityPresetSelector" type="OptionButton" parent="VideoSettingList/VideoSettingGrid"]
+editor_description = "UI-21, UIFUN-22"
+layout_mode = 2
+focus_neighbor_top = NodePath("../RefreshRateSelector")
+item_count = 5
+selected = 1
+popup/item_0/text = "Low"
+popup/item_0/id = 0
+popup/item_1/text = "Medium"
+popup/item_1/id = 1
+popup/item_2/text = "High"
+popup/item_2/id = 2
+popup/item_3/text = "Ultra"
+popup/item_3/id = 3
+popup/item_4/text = "Custom"
+popup/item_4/id = 4
+script = ExtResource("5_srg4v")
+section_name = "video"
+setting_name = "quality_preset"
+default_selected = 1
+
+[node name="ResolutionRevertDialog" type="ConfirmationDialog" parent="." node_paths=PackedStringArray("timer")]
+editor_description = "UI-873"
+disable_3d = true
+title = "OPTIONS_VIDEO_RESOLUTION_DIALOG_TITLE"
+size = Vector2i(730, 100)
+ok_button_text = "DIALOG_OK"
+cancel_button_text = "DIALOG_CANCEL"
+script = ExtResource("8_802cr")
+timer = NodePath("ResolutionRevertTimer")
+
+[node name="ResolutionRevertTimer" type="Timer" parent="ResolutionRevertDialog"]
+wait_time = 5.0
+one_shot = true
+
+[connection signal="option_selected" from="VideoSettingList/VideoSettingGrid/ResolutionSelector" to="VideoSettingList/VideoSettingGrid/ResolutionSelector" method="_on_option_selected"]
+[connection signal="option_selected" from="VideoSettingList/VideoSettingGrid/GuiScaleSelector" to="VideoSettingList/VideoSettingGrid/GuiScaleSelector" method="_on_option_selected"]
+[connection signal="option_selected" from="VideoSettingList/VideoSettingGrid/ScreenModeSelector" to="VideoSettingList/VideoSettingGrid/ScreenModeSelector" method="_on_option_selected"]
+[connection signal="option_selected" from="VideoSettingList/VideoSettingGrid/MonitorDisplaySelector" to="VideoSettingList/VideoSettingGrid/MonitorDisplaySelector" method="_on_option_selected"]
+[connection signal="canceled" from="ResolutionRevertDialog" to="ResolutionRevertDialog" method="_on_canceled_or_close_requested"]
+[connection signal="close_requested" from="ResolutionRevertDialog" to="ResolutionRevertDialog" method="_on_canceled_or_close_requested"]
+[connection signal="confirmed" from="ResolutionRevertDialog" to="ResolutionRevertDialog" method="_on_confirmed"]
+[connection signal="timeout" from="ResolutionRevertDialog/ResolutionRevertTimer" to="ResolutionRevertDialog" method="_on_resolution_revert_timer_timeout"]
diff --git a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd
new file mode 100644
index 0000000..46613b4
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd
@@ -0,0 +1,70 @@
+extends GridContainer
+
+const RATIO_FOR_LINEAR : float = 100
+
+var _slider_dictionary : Dictionary
+
+var initial_focus : Control
+
+func get_db_as_volume_value(db : float) -> float:
+ # db_to_linear produces a float between 0 and 1 from a db value
+ return db_to_linear(db) * RATIO_FOR_LINEAR
+
+func get_volume_value_as_db(value : float) -> float:
+ # linear_to_db consumes a float between 0 and 1 to produce the db value
+ return linear_to_db(value / RATIO_FOR_LINEAR)
+
+func add_volume_row(bus_name : String, bus_index : int) -> HSlider:
+ var volume_label := Label.new()
+ if bus_name == "Master":
+ volume_label.text = "MASTER_BUS"
+ else:
+ volume_label.text = bus_name
+ add_child(volume_label)
+
+ var volume_slider := SettingHSlider.new()
+ volume_slider.section_name = "audio"
+ volume_slider.setting_name = volume_label.text
+ volume_slider.custom_minimum_size = Vector2(290, 0)
+ volume_slider.size_flags_vertical = Control.SIZE_FILL
+ volume_slider.min_value = 0
+ volume_slider.default_value = 100
+ volume_slider.max_value = 120 # 120 so volume can be boosted somewhat
+ volume_slider.value_changed.connect(_on_slider_value_changed.bind(bus_index))
+ add_child(volume_slider)
+
+ _slider_dictionary[volume_label.text] = volume_slider
+ if not initial_focus: initial_focus = volume_slider
+ return volume_slider
+
+# REQUIREMENTS
+# * UI-22
+func _ready():
+ for bus_index in AudioServer.bus_count:
+ add_volume_row(AudioServer.get_bus_name(bus_index), bus_index)
+
+func _notification(what : int) -> void:
+ match(what):
+ NOTIFICATION_VISIBILITY_CHANGED:
+ if visible and is_inside_tree() and initial_focus: initial_focus.grab_focus()
+
+# REQUIREMENTS
+# * UIFUN-30
+func _on_slider_value_changed(value : float, bus_index : int) -> void:
+ AudioServer.set_bus_volume_db(bus_index, get_volume_value_as_db(value))
+
+
+func _on_options_menu_load_settings(load_file : ConfigFile):
+ for volume_slider in _slider_dictionary.values():
+ volume_slider.load_setting(load_file)
+
+# REQUIREMENTS
+# * UIFUN-23
+func _on_options_menu_save_settings(save_file : ConfigFile):
+ for volume_slider in _slider_dictionary.values():
+ volume_slider.save_setting(save_file)
+
+
+func _on_options_menu_reset_settings():
+ for volume_slider in _slider_dictionary.values():
+ volume_slider.reset_setting()
diff --git a/game/src/Game/Menu/OptionMenu/VolumeGrid.tscn b/game/src/Game/Menu/OptionMenu/VolumeGrid.tscn
new file mode 100644
index 0000000..6d4de3c
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/VolumeGrid.tscn
@@ -0,0 +1,8 @@
+[gd_scene load_steps=2 format=3 uid="uid://dy4si8comamnv"]
+
+[ext_resource type="Script" path="res://src/OptionMenu/VolumeGrid.gd" id="1_wb64h"]
+
+[node name="VolumeGrid" type="GridContainer"]
+size_flags_vertical = 0
+columns = 2
+script = ExtResource("1_wb64h")
diff --git a/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.gd b/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.gd
new file mode 100644
index 0000000..bff0bb5
--- /dev/null
+++ b/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.gd
@@ -0,0 +1,123 @@
+extends Control
+
+@export var _save_scene : PackedScene
+
+@export_group("Nodes")
+@export var _label : Label
+@export var _scroll_list : BoxContainer
+@export var _save_line_edit : LineEdit
+@export var _save_load_button : Button
+@export var _tag_selection_tab : TabBar
+@export var _delete_dialog : ConfirmationDialog
+@export var _overwrite_dialog : ConfirmationDialog
+
+var is_save_menu : bool = true
+var _id_to_tag : Array[StringName] = []
+
+func filter_for_tag(tag : StringName) -> void:
+ for child in _scroll_list.get_children():
+ if tag == &"":
+ child.show()
+ else:
+ if tag == child.resource.session_tag:
+ child.show()
+ else:
+ child.hide()
+
+# Requirements
+# * UIFUN-78
+func show_for_load() -> void:
+ _label.text = "SAVELOADMENU_LOAD_TITLE"
+ _save_load_button.text = "SAVELOADMENU_LOAD_BUTTON"
+ _save_line_edit.editable = false
+ is_save_menu = false
+ show()
+
+# Requirements
+# * UIFUN-77
+func show_for_save() -> void:
+ _label.text = "SAVELOADMENU_SAVE_TITLE"
+ _save_load_button.text = "SAVELOADMENU_SAVE_BUTTON"
+ _save_line_edit.editable = true
+ is_save_menu = true
+ show()
+
+func _build_save_list() -> void:
+ _tag_selection_tab.add_tab("SAVELOADMENU_TABSELECTIONTABBAR_ALL")
+ for save_name in SaveManager._save_dictionary:
+ var save : SaveResource = SaveManager._save_dictionary[save_name]
+ var save_node := _create_save_node(save)
+ _scroll_list.add_child(save_node)
+ if not _id_to_tag.has(save.session_tag):
+ _id_to_tag.append(save.session_tag)
+ _tag_selection_tab.add_tab(save.session_tag)
+
+func _create_save_node(resource : SaveResource) -> Control:
+ var save_node = _save_scene.instantiate()
+ save_node.resource = resource
+ save_node.pressed.connect(_on_save_node_pressed.bind(save_node))
+ save_node.request_to_delete.connect(_on_save_node_delete_requested.bind(save_node))
+ return save_node
+
+func _queue_clear_scroll_list() -> void:
+ for child in _scroll_list.get_children():
+ child.queue_free()
+ _tag_selection_tab.clear_tabs()
+ _id_to_tag.clear()
+
+# REQUIREMENTS:
+# * UIFUN-84
+# * UIFUN-89
+func _on_close_button_pressed() -> void:
+ hide()
+
+func _on_delete_dialog_confirmed() -> void:
+ _requested_node_to_delete.resource.delete()
+ _requested_node_to_delete.queue_free()
+
+# REQUIREMENTS:
+# * UIFUN-83
+func _on_overwrite_dialog_confirmed() -> void:
+ SaveManager.add_or_replace_save(SaveManager.make_new_save(_submitted_text))
+ _on_close_button_pressed()
+
+var _submitted_text : String = ""
+func _on_save_line_edit_text_submitted(new_text) -> void:
+ _submitted_text = new_text
+ if SaveManager.has_save(new_text):
+ _overwrite_dialog.dialog_text = tr("SAVELOADMENU_OVERWRITE_DIALOG_TEXT").format({ "file_name": _submitted_text })
+ _overwrite_dialog.title = tr("SAVELOADMENU_OVERWRITE_DIALOG_TITLE").format({ "file_name": _submitted_text })
+ _overwrite_dialog.popup_centered()
+ return
+ _on_overwrite_dialog_confirmed()
+
+func _on_save_load_button_pressed() -> void:
+ if is_save_menu:
+ _save_line_edit.text_submitted.emit(_save_line_edit.text)
+
+var _requested_node_to_delete : Control
+func _on_save_node_delete_requested(node : Control) -> void:
+ _requested_node_to_delete = node
+ _delete_dialog.dialog_text = tr("SAVELOADMENU_DELETE_DIALOG_TEXT").format({ "file_name": _requested_node_to_delete.resource.save_name })
+ _delete_dialog.title = tr("SAVELOADMENU_DELETE_DIALOG_TITLE").format({ "file_name": _requested_node_to_delete.resource.save_name })
+ _delete_dialog.popup_centered()
+
+# REQUIREMENTS:
+# * UIFUN-81
+# * UIFUN-86
+func _on_save_node_pressed(node : Control) -> void:
+ if is_save_menu:
+ _save_line_edit.text = node.resource.save_name
+
+func _on_tag_selection_tab_bar_tab_changed(tab) -> void:
+ if tab == 0:
+ filter_for_tag(&"")
+ else:
+ filter_for_tag(_id_to_tag[tab - 1])
+
+func _on_visibility_changed() -> void:
+ if visible:
+ _build_save_list()
+ else:
+ _queue_clear_scroll_list()
+ SaveManager.flush_save()
diff --git a/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn b/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn
new file mode 100644
index 0000000..e9f068e
--- /dev/null
+++ b/game/src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn
@@ -0,0 +1,109 @@
+[gd_scene load_steps=5 format=3 uid="uid://d3g6wbvwflmyk"]
+
+[ext_resource type="Script" path="res://src/SaveLoadMenu/SaveLoadMenu.gd" id="1_3jkds"]
+[ext_resource type="PackedScene" uid="uid://d2s7roinx2or7" path="res://src/SaveLoadMenu/SavePanelButton.tscn" id="2_fc6r3"]
+
+[sub_resource type="InputEventAction" id="InputEventAction_8vo2t"]
+action = &"ui_accept"
+pressed = true
+
+[sub_resource type="Shortcut" id="Shortcut_o1f2l"]
+events = [SubResource("InputEventAction_8vo2t")]
+
+[node name="SaveLoadMenu" type="MarginContainer" node_paths=PackedStringArray("_label", "_scroll_list", "_save_line_edit", "_save_load_button", "_tag_selection_tab", "_delete_dialog", "_overwrite_dialog")]
+editor_description = "UI-82, UI-89"
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 250
+theme_override_constants/margin_top = 100
+theme_override_constants/margin_right = 250
+theme_override_constants/margin_bottom = 100
+script = ExtResource("1_3jkds")
+_save_scene = ExtResource("2_fc6r3")
+_label = NodePath("SaveLoadPanel/SaveLoadList/TitleBarList/SaveLoadLabel")
+_scroll_list = NodePath("SaveLoadPanel/SaveLoadList/SaveLoadScroll/SaveLoadScrollList")
+_save_line_edit = NodePath("SaveLoadPanel/SaveLoadList/SaveLineEdit")
+_save_load_button = NodePath("SaveLoadPanel/SaveLoadList/SaveLoadButton")
+_tag_selection_tab = NodePath("SaveLoadPanel/SaveLoadList/TagSelectionList/TagSelectionTabBar")
+_delete_dialog = NodePath("DeleteDialog")
+_overwrite_dialog = NodePath("OverwriteDialog")
+
+[node name="SaveLoadPanel" type="PanelContainer" parent="."]
+layout_mode = 2
+
+[node name="SaveLoadList" type="VBoxContainer" parent="SaveLoadPanel"]
+layout_mode = 2
+
+[node name="TitleBarList" type="HBoxContainer" parent="SaveLoadPanel/SaveLoadList"]
+layout_mode = 2
+alignment = 2
+
+[node name="SaveLoadLabel" type="Label" parent="SaveLoadPanel/SaveLoadList/TitleBarList"]
+layout_mode = 2
+size_flags_horizontal = 6
+text = "SAVELOADMENU_SAVE_TITLE"
+
+[node name="CloseButton" type="Button" parent="SaveLoadPanel/SaveLoadList/TitleBarList"]
+editor_description = "UI-87, UI-94"
+layout_mode = 2
+text = "X"
+
+[node name="TagSelectionList" type="HBoxContainer" parent="SaveLoadPanel/SaveLoadList"]
+layout_mode = 2
+
+[node name="TagSelectionLabel" type="Label" parent="SaveLoadPanel/SaveLoadList/TagSelectionList"]
+layout_mode = 2
+text = "SAVELOADMENU_SESSION"
+
+[node name="TagSelectionTabBar" type="TabBar" parent="SaveLoadPanel/SaveLoadList/TagSelectionList"]
+layout_mode = 2
+size_flags_horizontal = 3
+tab_count = 1
+tab_0/title = "SAVELOADMENU_TABSELECTIONTABBAR_ALL"
+
+[node name="SaveLoadScroll" type="ScrollContainer" parent="SaveLoadPanel/SaveLoadList"]
+editor_description = "UI-83, UI-90"
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="SaveLoadScrollList" type="VBoxContainer" parent="SaveLoadPanel/SaveLoadList/SaveLoadScroll"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="SaveLineEdit" type="LineEdit" parent="SaveLoadPanel/SaveLoadList"]
+editor_description = "UI-85, UI-92"
+layout_mode = 2
+
+[node name="SaveLoadButton" type="Button" parent="SaveLoadPanel/SaveLoadList"]
+editor_description = "UIFUN-82, UIFUN-87"
+layout_mode = 2
+size_flags_horizontal = 4
+shortcut = SubResource("Shortcut_o1f2l")
+shortcut_feedback = false
+text = "SAVELOADMENU_SAVE_BUTTON"
+
+[node name="DeleteDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "SAVELOADMENU_DELETE_DIALOG_TITLE"
+ok_button_text = "DIALOG_OK"
+dialog_text = "SAVELOADMENU_DELETE_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[node name="OverwriteDialog" type="ConfirmationDialog" parent="."]
+disable_3d = true
+title = "SAVELOADMENU_OVERWRITE_DIALOG_TITLE"
+ok_button_text = "DIALOG_OK"
+dialog_text = "SAVELOADMENU_OVERWRITE_DIALOG_TEXT"
+cancel_button_text = "DIALOG_CANCEL"
+
+[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
+[connection signal="pressed" from="SaveLoadPanel/SaveLoadList/TitleBarList/CloseButton" to="." method="_on_close_button_pressed"]
+[connection signal="tab_changed" from="SaveLoadPanel/SaveLoadList/TagSelectionList/TagSelectionTabBar" to="." method="_on_tag_selection_tab_bar_tab_changed"]
+[connection signal="text_submitted" from="SaveLoadPanel/SaveLoadList/SaveLineEdit" to="." method="_on_save_line_edit_text_submitted"]
+[connection signal="pressed" from="SaveLoadPanel/SaveLoadList/SaveLoadButton" to="." method="_on_save_load_button_pressed"]
+[connection signal="confirmed" from="DeleteDialog" to="." method="_on_delete_dialog_confirmed"]
+[connection signal="confirmed" from="OverwriteDialog" to="." method="_on_overwrite_dialog_confirmed"]
diff --git a/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd
new file mode 100644
index 0000000..5fe4917
--- /dev/null
+++ b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd
@@ -0,0 +1,41 @@
+@tool
+extends LobbyPanelButton
+
+signal request_to_delete
+
+@export_group("Nodes")
+@export var country_flag : TextureRect
+@export var date_label : Label
+@export var delete_button : BaseButton
+
+var resource : SaveResource:
+ get:
+ return resource
+ set(value):
+ if resource != null:
+ resource.changed.disconnect(_resource_changed)
+ resource = value
+ if resource != null:
+ resource.changed.connect(_resource_changed)
+ _resource_changed()
+
+func get_text() -> StringName:
+ return resource.save_name
+
+func set_text(value : StringName) -> void:
+ if resource != null:
+ resource.save_name = value
+
+func _ready():
+ _resource_changed()
+
+func _is_start_date() -> bool:
+ return false
+
+func _resource_changed() -> void:
+ if resource == null: return
+ name_label.text = resource.save_name
+ date_label.text = Time.get_datetime_string_from_unix_time(resource.get_save_file_time(), true)
+
+func _on_delete_button_pressed() -> void:
+ request_to_delete.emit()
diff --git a/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.tscn b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.tscn
new file mode 100644
index 0000000..d2d0a41
--- /dev/null
+++ b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.tscn
@@ -0,0 +1,58 @@
+[gd_scene load_steps=2 format=3 uid="uid://d2s7roinx2or7"]
+
+[ext_resource type="Script" path="res://src/SaveLoadMenu/SavePanelButton.gd" id="1_rtuo6"]
+
+[node name="SavePanelButton" type="Container" node_paths=PackedStringArray("country_flag", "date_label", "delete_button", "background_button", "name_label")]
+editor_description = "SS-18, UI-40, UI-84, UI-86, UI-91, UI-93"
+offset_right = 276.0
+offset_bottom = 48.0
+script = ExtResource("1_rtuo6")
+country_flag = NodePath("SaveList/CountryFlag")
+date_label = NodePath("SaveList/DateLabel")
+delete_button = NodePath("SaveList/DeleteButton")
+background_button = NodePath("BackgroundButton")
+name_label = NodePath("SaveList/NameLabel")
+
+[node name="BackgroundButton" type="Button" parent="."]
+layout_mode = 2
+theme_type_variation = &"ButtonContainer"
+
+[node name="SaveList" type="HBoxContainer" parent="."]
+layout_mode = 2
+mouse_filter = 2
+
+[node name="CountryFlag" type="TextureRect" parent="SaveList"]
+layout_mode = 2
+size_flags_horizontal = 0
+size_flags_vertical = 4
+mouse_filter = 2
+
+[node name="NameLabel" type="Label" parent="SaveList"]
+layout_mode = 2
+size_flags_horizontal = 0
+size_flags_vertical = 1
+text = "PLACEHOLDER"
+vertical_alignment = 1
+
+[node name="DateLabel" type="Label" parent="SaveList"]
+layout_mode = 2
+size_flags_horizontal = 0
+size_flags_vertical = 1
+text = "00.00.0000"
+vertical_alignment = 1
+
+[node name="Separator" type="Control" parent="SaveList"]
+layout_mode = 2
+size_flags_horizontal = 3
+mouse_filter = 2
+
+[node name="DeleteButton" type="Button" parent="SaveList"]
+layout_mode = 2
+size_flags_horizontal = 8
+text = "x"
+
+[connection signal="button_down" from="BackgroundButton" to="." method="_on_background_button_button_down"]
+[connection signal="button_up" from="BackgroundButton" to="." method="_on_background_button_button_up"]
+[connection signal="pressed" from="BackgroundButton" to="." method="_on_background_button_pressed"]
+[connection signal="toggled" from="BackgroundButton" to="." method="_on_background_button_toggled"]
+[connection signal="pressed" from="SaveList/DeleteButton" to="." method="_on_delete_button_pressed"]
diff --git a/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd b/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd
new file mode 100644
index 0000000..5e7faa6
--- /dev/null
+++ b/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd
@@ -0,0 +1,59 @@
+extends Resource
+class_name SaveResource
+
+signal file_flushed(path : String)
+signal file_loaded
+signal file_moved_to_trash
+signal file_deleted
+signal trash_moved
+signal deleted
+
+var save_name : StringName:
+ get: return save_name
+ set(v):
+ save_name = v
+ file.set_value("Save", "name", save_name)
+ emit_changed()
+var session_tag : StringName:
+ get: return session_tag
+ set(v):
+ session_tag = v
+ file.set_value("Save", "session_tag", v)
+ emit_changed()
+var file_path : String:
+ get: return file_path
+ set(v):
+ file_path = v
+ emit_changed()
+var file : ConfigFile = ConfigFile.new()
+
+func set_file_path(name : StringName, path : String):
+ file_path = path
+ save_name = name
+
+func flush_save() -> Error:
+ file_flushed.emit(file_path)
+ var result := file.save(file_path)
+ file.clear()
+ return result
+
+func load_save(path : String = file_path) -> Error:
+ file_loaded.emit()
+ var result := file.load(path)
+ session_tag = file.get_value("Save", "session_tag", session_tag)
+ if path != file_path:
+ set_file_path(file.get_value("Save", "name", save_name), path)
+ return result
+
+func get_save_file_time() -> int:
+ return FileAccess.get_modified_time(file_path)
+
+func move_to_trash() -> Error:
+ trash_moved.emit()
+ file_moved_to_trash.emit()
+ return OS.move_to_trash(file_path)
+
+func delete() -> Error:
+ deleted.emit()
+ file_deleted.emit()
+ return DirAccess.remove_absolute(file_path)
diff --git a/game/src/Game/MusicConductor/MusicConductor.gd b/game/src/Game/MusicConductor/MusicConductor.gd
new file mode 100644
index 0000000..98dd0eb
--- /dev/null
+++ b/game/src/Game/MusicConductor/MusicConductor.gd
@@ -0,0 +1,77 @@
+extends Node
+
+# REQUIREMENTS
+# * SS-67
+@export_dir var music_directory : String
+@export var first_song_name : String
+
+var _selected_track = 0
+var _available_songs : Array[SongInfo] = []
+var _auto_play_next_song : bool = true
+
+## True if music player should be visible.
+## Used to keep keep consistency between scene changes
+var is_music_player_visible : bool = true
+
+func get_all_song_names() -> Array[String]:
+ var songNames : Array[String] = []
+ for si in _available_songs:
+ songNames.append(si.song_name)
+ return songNames
+
+func get_current_song_index() -> int:
+ return _selected_track
+
+func get_current_song_name() -> String:
+ return _available_songs[_selected_track].song_name
+
+func scrub_song_by_percentage(percentage: float) -> void:
+ var percentInSeconds : float = (percentage / 100.0) * $AudioStreamPlayer.stream.get_length()
+ $AudioStreamPlayer.play(percentInSeconds)
+
+func get_current_song_progress_percentage() -> float:
+ return 100 * ($AudioStreamPlayer.get_playback_position() / $AudioStreamPlayer.stream.get_length())
+
+func is_paused() -> bool:
+ return $AudioStreamPlayer.stream_paused
+
+func toggle_play_pause() -> void:
+ $AudioStreamPlayer.stream_paused = !$AudioStreamPlayer.stream_paused
+
+func start_current_song() -> void:
+ $AudioStreamPlayer.stream = _available_songs[_selected_track].song_stream
+ $AudioStreamPlayer.play()
+
+# REQUIREMENTS
+# * SS-70
+func start_song_by_index(id: int) -> void:
+ _selected_track = id
+ start_current_song()
+
+# REQUIREMENTS
+# * SS-69
+func select_next_song() -> void:
+ _selected_track = (_selected_track + 1) % len(_available_songs)
+ start_current_song()
+
+func select_previous_song() -> void:
+ _selected_track = (len(_available_songs) - 1) if (_selected_track == 0) else (_selected_track - 1)
+ start_current_song()
+
+# REQUIREMENTS
+# * SND-2
+func _ready():
+ var dir = DirAccess.open(music_directory)
+ for fname in dir.get_files():
+ if fname.ends_with(".import"):
+ fname = fname.get_basename()
+ if fname.get_basename() == first_song_name:
+ _selected_track = _available_songs.size()
+ _available_songs.append(SongInfo.new(music_directory, fname))
+ start_current_song()
+
+
+func _on_audio_stream_player_finished():
+ if _auto_play_next_song:
+ select_next_song()
+ start_current_song()
diff --git a/game/src/Game/MusicConductor/MusicConductor.tscn b/game/src/Game/MusicConductor/MusicConductor.tscn
new file mode 100644
index 0000000..182de99
--- /dev/null
+++ b/game/src/Game/MusicConductor/MusicConductor.tscn
@@ -0,0 +1,13 @@
+[gd_scene load_steps=2 format=3 uid="uid://b1h31mnn8n2nu"]
+
+[ext_resource type="Script" path="res://src/MusicConductor/MusicConductor.gd" id="1_56t1b"]
+
+[node name="MusicConductor" type="Node"]
+script = ExtResource("1_56t1b")
+music_directory = "res://audio/music"
+first_song_name = "The_Crown"
+
+[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
+bus = &"MUSIC_BUS"
+
+[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_audio_stream_player_finished"]
diff --git a/game/src/Game/MusicConductor/MusicPlayer.gd b/game/src/Game/MusicConductor/MusicPlayer.gd
new file mode 100644
index 0000000..47be158
--- /dev/null
+++ b/game/src/Game/MusicConductor/MusicPlayer.gd
@@ -0,0 +1,73 @@
+extends Control
+
+@export var _song_selector_button : OptionButton
+@export var _progress_slider : HSlider
+@export var _previous_song_button : Button
+@export var _play_pause_button : Button
+@export var _next_song_button : Button
+@export var _visbility_button : Button
+
+var _is_user_dragging_progress_slider : bool = false
+
+func _ready():
+ for songName in MusicConductor.get_all_song_names():
+ _song_selector_button.add_item(songName, _song_selector_button.item_count)
+ _update_song_name_visual()
+ _update_play_pause_button()
+ _set_music_player_visible(MusicConductor.is_music_player_visible)
+
+
+func _process(_delta):
+ if !_is_user_dragging_progress_slider:
+ _progress_slider.value = MusicConductor.get_current_song_progress_percentage()
+
+func _update_song_name_visual():
+ _song_selector_button.selected = MusicConductor.get_current_song_index()
+
+func _update_play_pause_button():
+ _play_pause_button.text = "◼" if MusicConductor.is_paused() else "▶"
+
+func _on_play_pause_button_pressed():
+ MusicConductor.toggle_play_pause()
+ _update_play_pause_button()
+
+func _on_next_song_button_pressed():
+ MusicConductor.select_next_song()
+ _update_song_name_visual()
+ _update_play_pause_button()
+
+func _on_previous_song_button_pressed():
+ MusicConductor.select_previous_song()
+ _update_song_name_visual()
+ _update_play_pause_button()
+
+# REQUIREMENTS
+# * UIFUN-92
+func _on_option_button_item_selected(index):
+ MusicConductor.start_song_by_index(index)
+ _update_song_name_visual()
+ _update_play_pause_button()
+
+
+func _on_progress_slider_drag_started():
+ _is_user_dragging_progress_slider = true
+
+
+func _on_progress_slider_drag_ended(_value_changed):
+ MusicConductor.scrub_song_by_percentage(_progress_slider.value)
+ _is_user_dragging_progress_slider = false
+ _update_play_pause_button()
+
+func _set_music_player_visible(is_player_visible : bool) -> void:
+ MusicConductor.is_music_player_visible = is_player_visible
+ _visbility_button.text = "⬆️" if is_player_visible else "⬇"
+ _song_selector_button.visible = is_player_visible
+ _progress_slider.visible = is_player_visible
+ _previous_song_button.visible = is_player_visible
+ _play_pause_button.visible = is_player_visible
+ _next_song_button.visible = is_player_visible
+
+# REQUIREMENTS
+# * UIFUN-91
+func _on_music_ui_visibility_button_pressed():
+ _set_music_player_visible(not MusicConductor.is_music_player_visible)
diff --git a/game/src/Game/MusicConductor/MusicPlayer.tscn b/game/src/Game/MusicConductor/MusicPlayer.tscn
new file mode 100644
index 0000000..80ad641
--- /dev/null
+++ b/game/src/Game/MusicConductor/MusicPlayer.tscn
@@ -0,0 +1,63 @@
+[gd_scene load_steps=2 format=3 uid="uid://cvl76duuym1wq"]
+
+[ext_resource type="Script" path="res://src/MusicConductor/MusicPlayer.gd" id="1_gcm4m"]
+
+[node name="MusicPlayer" type="BoxContainer" node_paths=PackedStringArray("_song_selector_button", "_progress_slider", "_previous_song_button", "_play_pause_button", "_next_song_button", "_visbility_button")]
+editor_description = "UI-104"
+offset_right = 150.0
+offset_bottom = 110.0
+mouse_filter = 2
+vertical = true
+script = ExtResource("1_gcm4m")
+_song_selector_button = NodePath("SongSelectorButton")
+_progress_slider = NodePath("ProgressSlider")
+_previous_song_button = NodePath("ButtonList/PreviousSongButton")
+_play_pause_button = NodePath("ButtonList/PlayPauseButton")
+_next_song_button = NodePath("ButtonList/NextSongButton")
+_visbility_button = NodePath("MusicUIVisibilityButton")
+
+[node name="SongSelectorButton" type="OptionButton" parent="."]
+editor_description = "UI-107"
+custom_minimum_size = Vector2(150, 0)
+layout_mode = 2
+alignment = 1
+text_overrun_behavior = 3
+fit_to_longest_item = false
+
+[node name="ProgressSlider" type="HSlider" parent="."]
+custom_minimum_size = Vector2(150, 0)
+layout_mode = 2
+size_flags_vertical = 1
+
+[node name="ButtonList" type="HBoxContainer" parent="."]
+layout_mode = 2
+size_flags_horizontal = 4
+mouse_filter = 2
+
+[node name="PreviousSongButton" type="Button" parent="ButtonList"]
+layout_mode = 2
+text = "<"
+
+[node name="PlayPauseButton" type="Button" parent="ButtonList"]
+custom_minimum_size = Vector2(30, 0)
+layout_mode = 2
+text = "▶"
+
+[node name="NextSongButton" type="Button" parent="ButtonList"]
+layout_mode = 2
+text = ">"
+
+[node name="MusicUIVisibilityButton" type="Button" parent="."]
+editor_description = "UI-106"
+layout_mode = 2
+size_flags_horizontal = 4
+toggle_mode = true
+text = "⬆"
+
+[connection signal="item_selected" from="SongSelectorButton" to="." method="_on_option_button_item_selected"]
+[connection signal="drag_ended" from="ProgressSlider" to="." method="_on_progress_slider_drag_ended"]
+[connection signal="drag_started" from="ProgressSlider" to="." method="_on_progress_slider_drag_started"]
+[connection signal="pressed" from="ButtonList/PreviousSongButton" to="." method="_on_previous_song_button_pressed"]
+[connection signal="pressed" from="ButtonList/PlayPauseButton" to="." method="_on_play_pause_button_pressed"]
+[connection signal="pressed" from="ButtonList/NextSongButton" to="." method="_on_next_song_button_pressed"]
+[connection signal="pressed" from="MusicUIVisibilityButton" to="." method="_on_music_ui_visibility_button_pressed"]
diff --git a/game/src/Game/MusicConductor/SongInfo.gd b/game/src/Game/MusicConductor/SongInfo.gd
new file mode 100644
index 0000000..1ee9adc
--- /dev/null
+++ b/game/src/Game/MusicConductor/SongInfo.gd
@@ -0,0 +1,11 @@
+extends Resource
+class_name SongInfo
+
+var song_path : String = ""
+var song_name : String = ""
+var song_stream : Resource
+
+func _init(dirname:String, fname:String):
+ song_path = dirname.path_join(fname)
+ song_name = fname.get_basename().replace("_", " ")
+ song_stream = load(song_path)
diff --git a/game/src/Game/SplashContainer.gd b/game/src/Game/SplashContainer.gd
new file mode 100644
index 0000000..524d314
--- /dev/null
+++ b/game/src/Game/SplashContainer.gd
@@ -0,0 +1,30 @@
+extends Control
+
+signal splash_end
+
+@export var _splash_finish : TextureRect
+@export var _splash_image : TextureRect
+@export var _splash_video : VideoStreamPlayer
+
+func _process(_delta):
+ var stream_texture := _splash_video.get_video_texture()
+ if stream_texture != null and not stream_texture.get_image().is_invisible():
+ _splash_image.hide()
+ _splash_finish.show()
+ set_process(false)
+
+func _input(event):
+ if (event is InputEventKey\
+ or event is InputEventMouse\
+ or event is InputEventScreenTouch\
+ or event is InputEventJoypadButton) and event.is_pressed():
+ _splash_finish.hide()
+ _on_splash_startup_finished()
+ accept_event()
+
+func _on_splash_startup_finished():
+ set_process_input(false)
+ splash_end.emit()
+ var tween := create_tween()
+ tween.tween_property(self, "modulate:a", 0, 0.5)
+ tween.tween_callback(self.queue_free)
diff --git a/game/src/Game/Theme/StyleBoxCombinedTexture.gd b/game/src/Game/Theme/StyleBoxCombinedTexture.gd
new file mode 100644
index 0000000..db54da4
--- /dev/null
+++ b/game/src/Game/Theme/StyleBoxCombinedTexture.gd
@@ -0,0 +1,47 @@
+@tool
+extends StyleBox
+class_name StyleBoxCombinedTexture
+
+@export
+var texture_settings : Array[TextureSetting] = []:
+ get: return texture_settings.duplicate()
+ set(v):
+ texture_settings = v
+ for setting in texture_settings:
+ setting.changed.connect(emit_changed)
+ emit_changed()
+
+func _get_draw_rect(rect : Rect2) -> Rect2:
+ var combined_rect : Rect2 = Rect2()
+ for setting in texture_settings:
+ if combined_rect.position.x > setting.expand_margin_left:
+ combined_rect.position.x = setting.expand_margin_left
+ if combined_rect.position.y > setting.expand_margin_top:
+ combined_rect.position.y = setting.expand_margin_top
+ if combined_rect.end.x < setting.expand_margin_right:
+ combined_rect.end.x = setting.expand_margin_right
+ if combined_rect.end.y < setting.expand_margin_bottom:
+ combined_rect.end.y = setting.expand_margin_bottom
+ return rect.grow_individual(combined_rect.position.x, combined_rect.position.y, combined_rect.end.x, combined_rect.end.y)
+
+func _draw(to_canvas_item : RID, rect : Rect2) -> void:
+ for setting in texture_settings:
+ if setting == null or setting.texture == null:
+ continue
+ var inner_rect : Rect2 = rect
+ inner_rect.position.x -= setting.expand_margin_left
+ inner_rect.position.y -= setting.expand_margin_top
+ inner_rect.size.x += setting.expand_margin_left + setting.expand_margin_right
+ inner_rect.size.y += setting.expand_margin_top + setting.expand_margin_bottom
+ RenderingServer.canvas_item_add_nine_patch(
+ to_canvas_item,
+ inner_rect,
+ setting.region_rect,
+ setting.texture.get_rid(),
+ Vector2(setting.texture_margin_left, setting.texture_margin_top),
+ Vector2(setting.texture_margin_right, setting.texture_margin_bottom),
+ setting.axis_stretch_horizontal,
+ setting.axis_stretch_vertical,
+ setting.draw_center,
+ setting.modulate_color
+ )
diff --git a/game/src/Game/Theme/StyleBoxWithSound.gd b/game/src/Game/Theme/StyleBoxWithSound.gd
new file mode 100644
index 0000000..8c29b34
--- /dev/null
+++ b/game/src/Game/Theme/StyleBoxWithSound.gd
@@ -0,0 +1,34 @@
+## WARNING: This will not work with togglable UI elements, a special implementation is needed for them.
+@tool
+extends StyleBox
+class_name StyleBoxWithSound
+
+@export
+var style_box : StyleBox:
+ get: return style_box
+ set(v):
+ style_box = v
+ emit_changed()
+
+@export
+var sound : AudioStream:
+ get: return sound
+ set(v):
+ sound = v
+ emit_changed()
+
+func _get_draw_rect(rect : Rect2) -> Rect2:
+ if style_box == null: return Rect2()
+ return style_box._get_draw_rect(rect)
+
+func _draw(to_canvas_item : RID, rect : Rect2) -> void:
+ # This is a hack
+ # Works fine for simple non-normal style cases
+ # Normal styles being drawn immediately tho will trigger sound on startup
+ # This would require further work to be applicable for release sounds
+ # Is there any other reason aside from release sounds (might be useful for toggles?)
+ # This should be fast enough to not cause draw issues
+ if sound != null:
+ SoundManager.play_effect_stream(sound)
+ if style_box != null:
+ style_box.draw(to_canvas_item, rect)
diff --git a/game/src/Game/Theme/TextureSetting.gd b/game/src/Game/Theme/TextureSetting.gd
new file mode 100644
index 0000000..da9b185
--- /dev/null
+++ b/game/src/Game/Theme/TextureSetting.gd
@@ -0,0 +1,123 @@
+extends Resource
+class_name TextureSetting
+
+@export
+var texture : Texture2D:
+ get: return texture
+ set(v):
+ texture = v
+ emit_changed()
+@export
+var draw_center : bool = true:
+ get: return draw_center
+ set(v):
+ draw_center = v
+ emit_changed()
+
+@export_group("Texture Margins", "texture_margin_")
+@export
+var texture_margin_left : float = 0:
+ get: return texture_margin_left
+ set(v):
+ texture_margin_left = v
+ emit_changed()
+@export
+var texture_margin_top : float = 0:
+ get: return texture_margin_top
+ set(v):
+ texture_margin_top = v
+ emit_changed()
+@export
+var texture_margin_right : float = 0:
+ get: return texture_margin_right
+ set(v):
+ texture_margin_right = v
+ emit_changed()
+@export
+var texture_margin_bottom : float = 0:
+ get: return texture_margin_bottom
+ set(v):
+ texture_margin_bottom = v
+ emit_changed()
+
+@export_group("Expand Margins", "expand_margin_")
+@export
+var expand_margin_left : float = 0:
+ get: return expand_margin_left
+ set(v):
+ expand_margin_left = v
+ emit_changed()
+@export
+var expand_margin_top : float = 0:
+ get: return expand_margin_top
+ set(v):
+ expand_margin_top = v
+ emit_changed()
+@export
+var expand_margin_right : float = 0:
+ get: return expand_margin_right
+ set(v):
+ expand_margin_right = v
+ emit_changed()
+@export
+var expand_margin_bottom : float = 0:
+ get: return expand_margin_bottom
+ set(v):
+ expand_margin_bottom = v
+ emit_changed()
+
+@export_group("Axis Stretch", "axis_stretch_")
+@export
+var axis_stretch_horizontal : RenderingServer.NinePatchAxisMode = RenderingServer.NINE_PATCH_STRETCH:
+ get: return axis_stretch_horizontal
+ set(v):
+ axis_stretch_horizontal = v
+ emit_changed()
+@export
+var axis_stretch_vertical : RenderingServer.NinePatchAxisMode = RenderingServer.NINE_PATCH_STRETCH:
+ get: return axis_stretch_vertical
+ set(v):
+ axis_stretch_vertical = v
+ emit_changed()
+
+@export_group("Sub-Region", "region_")
+@export
+var region_rect : Rect2 = Rect2(0, 0, 0, 0):
+ get: return region_rect
+ set(v):
+ region_rect = v
+ emit_changed()
+
+@export_group("Modulate", "modulate_")
+@export
+var modulate_color : Color = Color(1, 1, 1, 1):
+ get: return modulate_color
+ set(v):
+ modulate_color = v
+ emit_changed()
+
+@export_group("Content Margins", "content_margin_")
+@export
+var content_margin_left : float = -1:
+ get: return content_margin_left
+ set(v):
+ content_margin_left = v
+ emit_changed()
+@export
+var content_margin_top : float = -1:
+ get: return content_margin_top
+ set(v):
+ content_margin_top = v
+ emit_changed()
+@export
+var content_margin_right : float = -1:
+ get: return content_margin_right
+ set(v):
+ content_margin_right = v
+ emit_changed()
+@export
+var content_margin_bottom : float = -1:
+ get: return content_margin_bottom
+ set(v):
+ content_margin_bottom = v
+ emit_changed()