Skip to content

Commit ef05fce

Browse files
manuqwjt
andauthored
Add project settings to skip the splash + title screens (#2128)
And directly resume the persisted state. When developing, it becomes a bit tedious to reach the persisted state by pressing keys and waiting for the transitions to happen. And starting the game from the main scene (splash) is the only way to debug saved state. --------- Co-authored-by: Will Thompson <wjt@endlessaccess.org>
1 parent a55f3f2 commit ef05fce

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

addons/threadbare_project_settings/threadbare_project_settings.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extends EditorPlugin
66

77
const DEBUG_ASPECT_RATIO = "threadbare/debugging/debug_aspect_ratio"
88
const SKIP_SOKOBANS = "threadbare/debugging/skip_sokobans"
9+
const SKIP_SPLASH = "threadbare/debugging/skip_splash"
910

1011
static var setttings_configuration = {
1112
DEBUG_ASPECT_RATIO:
@@ -20,6 +21,13 @@ static var setttings_configuration = {
2021
type = TYPE_BOOL,
2122
hint_string = "Skip the sokobans from the core game loop, and complete the quest directly.",
2223
},
24+
SKIP_SPLASH:
25+
{
26+
value = false,
27+
type = TYPE_BOOL,
28+
hint_string =
29+
"Skip the splash screen and title menu, and resume the game state. Like when clicking Continue.",
30+
},
2331
}
2432

2533

scenes/menus/splash/components/splash.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ extends Control
99

1010

1111
func _ready() -> void:
12+
if ProjectSettings.get_setting(ThreadbareProjectSettings.SKIP_SPLASH):
13+
SceneSwitcher.change_to_file.call_deferred(next_scene)
14+
return
1215
logo_stitcher.finished.connect(scene_switch_timer.start)
1316
scene_switch_timer.timeout.connect(switch_to_intro)
1417

scenes/menus/title/components/title_screen.gd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ extends Control
99
@onready var credits: Control = %Credits
1010

1111

12+
func _ready() -> void:
13+
if ProjectSettings.get_setting(ThreadbareProjectSettings.SKIP_SPLASH):
14+
var saved_scene: Dictionary = GameState.restore()
15+
if saved_scene["scene_path"]:
16+
SceneSwitcher.change_to_file(saved_scene["scene_path"], saved_scene["spawn_point"])
17+
else:
18+
SceneSwitcher.change_to_file(intro_scene)
19+
20+
1221
func _input(event: InputEvent) -> void:
1322
if event.is_action_pressed(&"pause"):
1423
get_viewport().set_input_as_handled()

0 commit comments

Comments
 (0)