aboutsummaryrefslogtreecommitdiff
path: root/game/src
diff options
context:
space:
mode:
Diffstat (limited to 'game/src')
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentParser.gd4
-rw-r--r--game/src/Game/Autoload/GameLoader.gd12
-rw-r--r--game/src/Game/Autoload/WindowOverride.gd27
-rw-r--r--game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd4
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn3
-rw-r--r--game/src/Game/GameStart.gd56
-rw-r--r--game/src/Game/LoadingScreen.tscn1
7 files changed, 68 insertions, 39 deletions
diff --git a/game/src/Game/Autoload/Argument/ArgumentParser.gd b/game/src/Game/Autoload/Argument/ArgumentParser.gd
index b463c74..b012215 100644
--- a/game/src/Game/Autoload/Argument/ArgumentParser.gd
+++ b/game/src/Game/Autoload/Argument/ArgumentParser.gd
@@ -309,10 +309,8 @@ Options:
("Type: %s - Default Value: %s" % [option.get_type_string(), option.default_value]).rpad(45),
option.description
])
+
func _ready():
if Engine.is_editor_hint(): return
_set_argument_setting()
GameDebug._singleton = GameDebug.new()
- if get_argument(&"help"):
- _print_help()
- get_tree().quit()
diff --git a/game/src/Game/Autoload/GameLoader.gd b/game/src/Game/Autoload/GameLoader.gd
index 1720e3c..8c14c7e 100644
--- a/game/src/Game/Autoload/GameLoader.gd
+++ b/game/src/Game/Autoload/GameLoader.gd
@@ -1,17 +1,5 @@
extends Node
-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"
-}
-
var ShaderManager : ShaderManagerClass
func _init():
diff --git a/game/src/Game/Autoload/WindowOverride.gd b/game/src/Game/Autoload/WindowOverride.gd
new file mode 100644
index 0000000..837570e
--- /dev/null
+++ b/game/src/Game/Autoload/WindowOverride.gd
@@ -0,0 +1,27 @@
+extends Node
+
+const VideoOptions = preload("res://src/Game/Menu/OptionMenu/VideoTab.tscn")
+
+func _init():
+ var window_id := DisplayServer.get_window_list()[0]
+ DisplayServer.window_set_size(Vector2(1280.0, 720.0), window_id)
+
+func _ready():
+ if ArgumentParser.get_argument(&"help"): return
+ _on_SceneTree_idle()
+ # Hack to ensure Video Options load
+ var video := VideoOptions.instantiate()
+ video.visible = false
+ add_child(video)
+ video.queue_free()
+
+func _on_SceneTree_idle():
+ var window := get_window()
+ window.set_mode(Window.MODE_FULLSCREEN)
+ await get_tree().process_frame
+ window.transparent = false
+ window.borderless = false
+ var screen_pos := DisplayServer.screen_get_position(window.current_screen)
+ var screen_size := DisplayServer.screen_get_size(window.current_screen)
+ window.position = screen_pos + (screen_size - window.size) / 2
+ ProjectSettings.set_setting.call_deferred("display/window/per_pixel_transparency/allowed", false)
diff --git a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
index 350c1a8..6cdbf28 100644
--- a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
+++ b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
@@ -11,7 +11,7 @@ signal zoom_out_button_pressed
var _mapmode_button_group : ButtonGroup
# REQUIREMENTS:
-# * UI-550, UI-552, UI-554, UI-561, UI-562
+# * UI-550, UI-552, UI-554, UI-561, UI-562, UI-563
func _add_mapmode_button(identifier : String) -> void:
var button := Button.new()
button.text = identifier
@@ -37,7 +37,7 @@ func _on_game_session_menu_button_pressed() -> void:
# REQUIREMENTS:
# * SS-76
-# * UIFUN-129, UIFUN-131, UIFUN-133, UIFUN-140, UIFUN-141
+# * UIFUN-129, UIFUN-131, UIFUN-133, UIFUN-140, UIFUN-141, UIFUN-142
func _mapmode_pressed(button : BaseButton) -> void:
GameSingleton.set_mapmode(button.tooltip_text)
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
index 7e49ac8..7a982e9 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
@@ -93,15 +93,18 @@ layout_mode = 2
mouse_filter = 1
[node name="PopStats" type="HBoxContainer" parent="PanelList/InteractList"]
+editor_description = "UI-124"
layout_mode = 2
[node name="PopTypeChart" parent="PanelList/InteractList/PopStats" instance=ExtResource("2_3oytt")]
+editor_description = "UI-125"
layout_mode = 2
[node name="PopIdeologyChart" parent="PanelList/InteractList/PopStats" instance=ExtResource("2_3oytt")]
layout_mode = 2
[node name="PopCultureChart" parent="PanelList/InteractList/PopStats" instance=ExtResource("2_3oytt")]
+editor_description = "UI-127"
layout_mode = 2
[node name="HSeparator3" type="HSeparator" parent="PanelList/InteractList"]
diff --git a/game/src/Game/GameStart.gd b/game/src/Game/GameStart.gd
index fa7568b..422a42a 100644
--- a/game/src/Game/GameStart.gd
+++ b/game/src/Game/GameStart.gd
@@ -7,6 +7,15 @@ const SoundTabScene = preload("res://src/Game/Menu/OptionMenu/SoundTab.tscn")
@export var loading_screen : LoadingScreen
func _ready() -> void:
+ if ArgumentParser.get_argument(&"help"):
+ ArgumentParser._print_help()
+ # For some reason this doesn't get freed properly
+ # Godot will always quit before it frees the active StreamPlayback resource
+ # This hack fixes that
+ MusicConductor.queue_free()
+ get_tree().quit()
+ return
+
# Hack to ensure Sound Options load
var sound_tab := SoundTabScene.instantiate()
sound_tab.visible = false
@@ -16,39 +25,42 @@ func _ready() -> void:
loading_screen.start_loading_screen(_initialize_game)
-# REQUIREMENTS
-# * FS-333, FS-334, FS-335, FS-341
-func _initialize_game() -> void:
- GameSingleton.setup_logger()
- loading_screen.try_update_loading_screen(5)
-
+func _load_compatibility_mode():
# 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 = ArgumentParser.get_argument(&"compatibility-mode")
+ var compatibility_mode_path : String = ArgumentParser.get_argument(&"compatibility-mode", "")
+
+ if not compatibility_mode_path:
+ # TODO - non-Windows default paths
+ const default_path : String = "C:/Program Files (x86)/Steam/steamapps/common/Victoria 2"
+ compatibility_mode_path = default_path
+
+ var compatibility_mode_paths : PackedStringArray = [compatibility_mode_path]
+ # Example for adding mod paths
+ #compatibility_mode_paths.push_back("C:/Program Files (x86)/Steam/steamapps/common/Victoria 2/mod/TGC")
+
+ if GameSingleton.load_defines_compatibility_mode(compatibility_mode_paths) != OK:
+ push_error("Errors loading game defines!")
+
+# REQUIREMENTS
+# * FS-333, FS-334, FS-335, FS-341
+func _initialize_game() -> void:
var start := Time.get_ticks_usec()
+ loading_screen.try_update_loading_screen(0)
+ GameSingleton.setup_logger()
- loading_screen.try_update_loading_screen(15)
- loading_screen.try_update_loading_screen(25)
Localisation.initialize()
- loading_screen.try_update_loading_screen(45)
- loading_screen.try_update_loading_screen(50, true)
-
- # TODO: Loading takes way too long to keep the LoadingScreen at 50%
- # Should either split this up or seperately multithread the compatibility mode loader
- # Or both and emit a signal that allows us to add percentages to the LoadingScreen
- if compatibility_mode_path:
- if GameSingleton.load_defines_compatibility_mode(compatibility_mode_path) != OK:
- push_error("Errors loading game defines!")
- else:
- GameLoader.define_filepaths_dict.make_read_only()
- if GameSingleton.load_defines(GameLoader.define_filepaths_dict) != OK:
- push_error("Errors loading game defines!")
+ loading_screen.try_update_loading_screen(15, true)
+
+ _load_compatibility_mode()
+ loading_screen.try_update_loading_screen(75, true)
loading_screen.try_update_loading_screen(100)
+
var end := Time.get_ticks_usec()
print("Loading took ", float(end - start) / 1000000, " seconds")
diff --git a/game/src/Game/LoadingScreen.tscn b/game/src/Game/LoadingScreen.tscn
index 5ae1cb9..01b6856 100644
--- a/game/src/Game/LoadingScreen.tscn
+++ b/game/src/Game/LoadingScreen.tscn
@@ -59,6 +59,7 @@ _data = {
}
[node name="LoadingScreen" type="Control" node_paths=PackedStringArray("progress_bar", "quote_label", "animation_player")]
+editor_description = "UI-24"
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0