aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/GameStart.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-09-14 21:17:04 +0200
committer GitHub <noreply@github.com>2023-09-14 21:17:04 +0200
commit9de41a0ed5f050f205219ab2a9f114800d048c14 (patch)
tree559681d5a2569adc307409d818311760edc12654 /game/src/Game/GameStart.gd
parent1013b3c21226f703caba954664628694aedde469 (diff)
parent70c040d042cb536e5ce16b0cfff0e0afa39e8ed7 (diff)
Merge pull request #151 from OpenVicProject/dataloading
Build system cleanup + dataloading scaffolding + JSON dataloading removed
Diffstat (limited to 'game/src/Game/GameStart.gd')
-rw-r--r--game/src/Game/GameStart.gd47
1 files changed, 25 insertions, 22 deletions
diff --git a/game/src/Game/GameStart.gd b/game/src/Game/GameStart.gd
index 723086e..422a42a 100644
--- a/game/src/Game/GameStart.gd
+++ b/game/src/Game/GameStart.gd
@@ -25,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")