From 80eb4a727fdf08345348bc50a4c499a6f5f6d84a Mon Sep 17 00:00:00 2001 From: Tiger Jove Date: Wed, 21 Jan 2026 22:35:35 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20debugging=20cardboard,=20better=20move?= =?UTF-8?q?ment,=20but=20now=20save=20state=20has=20problems=C2=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/addons/markdownlabel/example.gd | 2 +- src/addons/markdownlabel/markdownlabel.gd | 2 +- .../volunteer_room/volunteer_room.gd | 2 +- .../volunteer_room/volunteer_scene_players.gd | 2 +- .../youth_room/youth_room.gd | 7 +-- .../youth_room/youth_room_scene_player.gd | 6 +-- src/code/button_themer.gd | 2 +- ...f_mind_2026-01-19_11-00-01-1526668039.tres | 22 +++++++++ ...f_mind_2026-01-19_15-33-27-3130526064.tres | 23 +++++++++ ...f_mind_2026-01-19_15-47-39-3506336039.tres | 19 +++++++ ...f_mind_2026-01-19_16-30-10-1028460818.tres | 27 ++++++++++ ...of_mind_2026-01-21_15-06-29-376758416.tres | 18 +++++++ src/dev-util/bpm_timer.gd | 2 +- src/dev-util/bug_button.gd | 2 +- src/dev-util/click-trough-area.gd | 6 +-- src/dev-util/music_mix_helper.gd | 2 +- src/dev-util/room_template.gd | 2 +- src/dev-util/savegame.gd | 10 ++-- src/dev-util/testing.tscn | 2 +- src/dev-util/ui-testing.tscn | 8 +-- src/logic-scenes/board/card-board.gd | 49 ++++++++----------- src/logic-scenes/board/card.gd | 9 +++- src/logic-scenes/board/draggable.gd | 2 +- src/logic-scenes/card_burner/card_burner.gd | 14 +++--- src/logic-scenes/card_picker/card_picker.gd | 8 +-- src/logic-scenes/interactable/interactable.gd | 4 +- .../luna/playables/story_playable.gd | 10 ++-- src/logic-scenes/playable.gd | 3 +- src/logic-scenes/startup/startup_menu.gd | 4 +- src/project.godot | 2 +- src/singletons/global_state.gd | 4 +- src/singletons/main/main.gd | 12 ++--- src/singletons/scene_reference.gd | 22 ++++----- src/ui/credits_roll/credits_roll.gd | 6 +-- src/ui/curtain/curtain.gd | 8 +-- src/ui/menu_main/main_menu.gd | 12 ++--- src/ui/menu_main/save_game_list.gd | 4 +- 37 files changed, 222 insertions(+), 117 deletions(-) create mode 100644 src/debug/frame_of_mind_2026-01-19_11-00-01-1526668039.tres create mode 100644 src/debug/frame_of_mind_2026-01-19_15-33-27-3130526064.tres create mode 100644 src/debug/frame_of_mind_2026-01-19_15-47-39-3506336039.tres create mode 100644 src/debug/frame_of_mind_2026-01-19_16-30-10-1028460818.tres create mode 100644 src/debug/frame_of_mind_2026-01-21_15-06-29-376758416.tres diff --git a/src/addons/markdownlabel/example.gd b/src/addons/markdownlabel/example.gd index 552719c..8126491 100644 --- a/src/addons/markdownlabel/example.gd +++ b/src/addons/markdownlabel/example.gd @@ -5,5 +5,5 @@ func _ready() -> void: $MarkdownLabel.display_file("res://addons/markdownlabel/README.md") $MarkdownLabel.task_checkbox_clicked.connect( func(id: int, line: int, checked: bool, text: String) -> void: - print_debug("%s task #%d on line %d: %s" % ["Checked" if checked else "Unchecked", id, line, text]) + print("%s task #%d on line %d: %s" % ["Checked" if checked else "Unchecked", id, line, text]) ) diff --git a/src/addons/markdownlabel/markdownlabel.gd b/src/addons/markdownlabel/markdownlabel.gd index a807de7..5748474 100644 --- a/src/addons/markdownlabel/markdownlabel.gd +++ b/src/addons/markdownlabel/markdownlabel.gd @@ -640,7 +640,7 @@ func _reset_escaped_chars(_text: String,code:=false) -> String: func _debug(string: String) -> void: if not _debug_mode: return - print_debug(string) + print(string) func _denotes_fenced_code_block(line: String, character: String) -> bool: var stripped_line := line.strip_edges() diff --git a/src/base-environments/volunteer_room/volunteer_room.gd b/src/base-environments/volunteer_room/volunteer_room.gd index 9b8d425..e2a7c13 100644 --- a/src/base-environments/volunteer_room/volunteer_room.gd +++ b/src/base-environments/volunteer_room/volunteer_room.gd @@ -22,7 +22,7 @@ func get_ready() -> void: card_board.initialise_from_save(save_game) card_board.board_completed.connect(func(): #TODO: hook in ending - save_room() + %DoorInteractable.show() ) diff --git a/src/base-environments/volunteer_room/volunteer_scene_players.gd b/src/base-environments/volunteer_room/volunteer_scene_players.gd index d7cef87..eccc753 100644 --- a/src/base-environments/volunteer_room/volunteer_scene_players.gd +++ b/src/base-environments/volunteer_room/volunteer_scene_players.gd @@ -26,5 +26,5 @@ func scene_finished(_id: Scenes.id, _repeat: bool): queue("RESET") func play(anin_name: StringName = "", a: float = -1, b: float = 1, c: bool = false) -> void: - print_debug("anim player accessed!") + print("anim player accessed!") super.play(anin_name, a, b, c) diff --git a/src/base-environments/youth_room/youth_room.gd b/src/base-environments/youth_room/youth_room.gd index e88c559..7968442 100644 --- a/src/base-environments/youth_room/youth_room.gd +++ b/src/base-environments/youth_room/youth_room.gd @@ -47,9 +47,7 @@ func get_ready(): card_board.board_completed.connect(func(): %DoorInteractable.show() - if not save_game.is_childhood_board_complete: - save_game.is_childhood_board_complete = true - save_room() + save_game.childhood_board_complete = true ) pull_save_state(State.save_game) @@ -73,6 +71,9 @@ func pull_save_state(save: SaveGame) -> void: Scenes.started_sequences = save_game.mementos_complete Scenes.completed_sequences = save_game.mementos_complete + # Interactions can this way load their correct prompts + get_tree().call_group("interactables", "pull_save_state") + # Call parent to restore player position super.pull_save_state(save) diff --git a/src/base-environments/youth_room/youth_room_scene_player.gd b/src/base-environments/youth_room/youth_room_scene_player.gd index ca5f7d9..ad2fb77 100644 --- a/src/base-environments/youth_room/youth_room_scene_player.gd +++ b/src/base-environments/youth_room/youth_room_scene_player.gd @@ -22,7 +22,7 @@ func _fade_in(audio_stream : AudioStreamPlayer) -> void: audio_stream.play(70) func _on_scene_starting(scene_id: Scenes.id, _repeat: bool) -> void: - print_debug("YouthRoomScenePlayer._on_scene_starting(%s)" % Scenes.id.keys()[scene_id]) + print("YouthRoomScenePlayer._on_scene_starting(%s)" % Scenes.id.keys()[scene_id]) # Handle scene-specific music # Note: Chest animation is now handled by YouthRoom.prepare_scene_start() @@ -38,7 +38,7 @@ func _on_scene_starting(scene_id: Scenes.id, _repeat: bool) -> void: _: pass func _on_scene_finished(scene_id: Scenes.id, _repeat: bool) -> void: - print_debug("YouthRoomScenePlayer._on_scene_finished(%s)" % Scenes.id.keys()[scene_id]) + print("YouthRoomScenePlayer._on_scene_finished(%s)" % Scenes.id.keys()[scene_id]) match scene_id: Scenes.id.YOUTH_CHILDHOOD: @@ -52,5 +52,5 @@ func _on_scene_finished(scene_id: Scenes.id, _repeat: bool) -> void: func play(anim_name: StringName = "", a: float = -1, b: float = 1, c: bool = false) -> void: - print_debug("YouthRoomScenePlayer.play(%s)" % anim_name) + print("YouthRoomScenePlayer.play(%s)" % anim_name) super.play(anim_name, a, b, c) diff --git a/src/code/button_themer.gd b/src/code/button_themer.gd index 88b9377..5709a21 100644 --- a/src/code/button_themer.gd +++ b/src/code/button_themer.gd @@ -6,7 +6,7 @@ class_name ThemedButton extends Button @onready var lower_corner_decor := load("res://import/interface-elements/lower_corner.png") func _ready() -> void: - print_debug(owner) + print(owner) rebuild() theme_changed.connect(rebuild) resized.connect(rebuild) diff --git a/src/debug/frame_of_mind_2026-01-19_11-00-01-1526668039.tres b/src/debug/frame_of_mind_2026-01-19_11-00-01-1526668039.tres new file mode 100644 index 0000000..1a3647d --- /dev/null +++ b/src/debug/frame_of_mind_2026-01-19_11-00-01-1526668039.tres @@ -0,0 +1,22 @@ +[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3] + +[ext_resource type="Script" path="res://dev-util/savegame.gd" id="1_sn6m6"] + +[resource] +script = ExtResource("1_sn6m6") +unique_save_name = "frame_of_mind_2026-01-19_11-00-01-1526668039" +current_room = 1 +board_positions = Dictionary[StringName, Vector2]({ +&"c_confusion": Vector2(378, 687), +&"c_out_of_world": Vector2(452, 202), +&"p_outer_conflict": Vector2(-66, 83), +&"p_unique": Vector2(-66, 83) +}) +board_attachments = Dictionary[StringName, StringName]({ +&"p_outer_conflict": &"c_confusion", +&"p_unique": &"c_out_of_world" +}) +childhood_board_complete = true +player_position = Vector3(0.63, -0.016315194, 0.925) +player_pitch = 0.87266463 +last_saved = 1769029158 diff --git a/src/debug/frame_of_mind_2026-01-19_15-33-27-3130526064.tres b/src/debug/frame_of_mind_2026-01-19_15-33-27-3130526064.tres new file mode 100644 index 0000000..4904e31 --- /dev/null +++ b/src/debug/frame_of_mind_2026-01-19_15-33-27-3130526064.tres @@ -0,0 +1,23 @@ +[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3] + +[ext_resource type="Script" path="res://dev-util/savegame.gd" id="1_8nsia"] + +[resource] +script = ExtResource("1_8nsia") +unique_save_name = "frame_of_mind_2026-01-19_15-33-27-3130526064" +current_room = 1 +mementos_complete = 3 +board_positions = Dictionary[StringName, Vector2]({ +&"c_confusion": Vector2(650, 582), +&"c_gifted": Vector2(1113, 592), +&"c_homework": Vector2(448, 707), +&"c_rejection": Vector2(197, 885), +&"p_good_grades": Vector2(133.33333, 440), +&"p_joy": Vector2(133.33333, 330), +&"p_laughed_at": Vector2(133.33333, 220), +&"p_outer_conflict": Vector2(133.33333, 110) +}) +player_position = Vector3(0.61196893, -0.008183508, 1.9193625) +player_yaw = 0.61379147 +player_pitch = -0.2038608 +last_saved = 1768833300 diff --git a/src/debug/frame_of_mind_2026-01-19_15-47-39-3506336039.tres b/src/debug/frame_of_mind_2026-01-19_15-47-39-3506336039.tres new file mode 100644 index 0000000..dcc095e --- /dev/null +++ b/src/debug/frame_of_mind_2026-01-19_15-47-39-3506336039.tres @@ -0,0 +1,19 @@ +[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3 uid="uid://0tj8owvtod7q"] + +[ext_resource type="Script" uid="uid://d06gpwuxmkxkt" path="res://dev-util/savegame.gd" id="1_mikml"] + +[resource] +script = ExtResource("1_mikml") +unique_save_name = "frame_of_mind_2026-01-19_15-47-39-3506336039" +current_room = 1 +mementos_complete = 1 +board_positions = Dictionary[StringName, Vector2]({ +&"c_out_of_world": Vector2(665, 759), +&"c_rejection": Vector2(281, 918), +&"p_finding_friends": Vector2(133.33333, 219.99997), +&"p_unique": Vector2(133.33333, 109.999985) +}) +player_position = Vector3(0.6317782, -0.0027222226, 0.92837244) +player_yaw = 2.777015 +player_pitch = -0.29538974 +last_saved = 1768834191 diff --git a/src/debug/frame_of_mind_2026-01-19_16-30-10-1028460818.tres b/src/debug/frame_of_mind_2026-01-19_16-30-10-1028460818.tres new file mode 100644 index 0000000..0df0a70 --- /dev/null +++ b/src/debug/frame_of_mind_2026-01-19_16-30-10-1028460818.tres @@ -0,0 +1,27 @@ +[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3 uid="uid://d2kixmoun8vv0"] + +[ext_resource type="Script" uid="uid://d06gpwuxmkxkt" path="res://dev-util/savegame.gd" id="1_25kue"] + +[resource] +script = ExtResource("1_25kue") +unique_save_name = "frame_of_mind_2026-01-19_16-30-10-1028460818" +current_room = 1 +mementos_complete = 7 +board_positions = Dictionary[StringName, Vector2]({ +&"c_boy_stuff": Vector2(564, 318), +&"c_comic_heroes": Vector2(1397, 863), +&"c_confusion": Vector2(869, 234), +&"c_gifted": Vector2(187, 743), +&"c_rejection": Vector2(428, 717), +&"c_teachers": Vector2(253, 412), +&"p_becoming_teacher": Vector2(133.33331, 330), +&"p_effort": Vector2(133.33331, 660), +&"p_finding_friends": Vector2(133.33331, 219.99997), +&"p_inner_conflict": Vector2(133.33331, 109.999985), +&"p_pretending": Vector2(133.33331, 550), +&"p_upset_peers": Vector2(133.33331, 439.99994) +}) +player_position = Vector3(3.203781, -0.0027222226, 0.5082533) +player_yaw = -0.53694016 +player_pitch = -0.26962742 +last_saved = 1768836806 diff --git a/src/debug/frame_of_mind_2026-01-21_15-06-29-376758416.tres b/src/debug/frame_of_mind_2026-01-21_15-06-29-376758416.tres new file mode 100644 index 0000000..82ed0cc --- /dev/null +++ b/src/debug/frame_of_mind_2026-01-21_15-06-29-376758416.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3 uid="uid://jbp7nfc2afb4"] + +[ext_resource type="Script" uid="uid://d06gpwuxmkxkt" path="res://dev-util/savegame.gd" id="1_n0fgw"] + +[resource] +script = ExtResource("1_n0fgw") +unique_save_name = "frame_of_mind_2026-01-21_15-06-29-376758416" +current_room = 1 +board_positions = Dictionary[StringName, Vector2]({ +&"c_confusion": Vector2(482, 974), +&"c_rejection": Vector2(241, 866), +&"p_laughed_at": Vector2(133.33333, 110), +&"p_outer_conflict": Vector2(133.33333, 220) +}) +childhood_board_complete = true +player_position = Vector3(0.63, -0.016315194, 0.925) +player_pitch = 0.87266463 +last_saved = 1769029090 diff --git a/src/dev-util/bpm_timer.gd b/src/dev-util/bpm_timer.gd index 161df9a..9867688 100644 --- a/src/dev-util/bpm_timer.gd +++ b/src/dev-util/bpm_timer.gd @@ -34,7 +34,7 @@ func _process(delta: float) -> void: _on_beat() _last_beat_timing = sync_to.get_playback_position() else: - if not Engine.is_editor_hint(): print_debug(time_left) + if not Engine.is_editor_hint(): print(time_left) func start(time_sec: float = 0, starting_beat: int = 0, starting_bar: int = 0, sync_to_playback:AudioStreamPlayback = null) -> void: if starting_bar == 0 and starting_beat > 0: starting_bar = starting_beat / beats_per_bar diff --git a/src/dev-util/bug_button.gd b/src/dev-util/bug_button.gd index c0a1560..5c98c2c 100644 --- a/src/dev-util/bug_button.gd +++ b/src/dev-util/bug_button.gd @@ -25,4 +25,4 @@ func create_bug_report(): DisplayServer.clipboard_set(debug_text) - #print_debug("mailto:support@polynormal.games?subject=Frame%20of%20Mind%20Demo%20-%20Bug%20Report&body=" + debug_text) + #print("mailto:support@polynormal.games?subject=Frame%20of%20Mind%20Demo%20-%20Bug%20Report&body=" + debug_text) diff --git a/src/dev-util/click-trough-area.gd b/src/dev-util/click-trough-area.gd index ddaf9dd..9a0eb40 100644 --- a/src/dev-util/click-trough-area.gd +++ b/src/dev-util/click-trough-area.gd @@ -16,7 +16,7 @@ func _process(_delta): func _input(event: InputEvent) -> void: if event is InputEventAction: - print_debug(event.action) + print(event.action) #func _unhandled_input(event): # viewport.push_input(event) @@ -38,7 +38,7 @@ func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal viewport.push_input(e) func _on_button_pressed(): - print_debug("Button pressed") + print("Button pressed") func _on_line_edit_text_submitted(new_text): - print_debug("Text submitted: ", new_text) + print("Text submitted: ", new_text) diff --git a/src/dev-util/music_mix_helper.gd b/src/dev-util/music_mix_helper.gd index 31d9e35..eb43d1c 100644 --- a/src/dev-util/music_mix_helper.gd +++ b/src/dev-util/music_mix_helper.gd @@ -57,7 +57,7 @@ func _ready() -> void: stream = AudioStreamPolyphonic.new() func play(from_position: float = 0.0): - print_debug("got called") + print("got called") super.play(from_position) self._play(from_position) diff --git a/src/dev-util/room_template.gd b/src/dev-util/room_template.gd index 76806c3..5b3a148 100644 --- a/src/dev-util/room_template.gd +++ b/src/dev-util/room_template.gd @@ -58,7 +58,7 @@ func restore_player_from_save(save: SaveGame) -> void: if player and player is PlayerController: player.restore_from_save(save) else: - print_debug("RoomTemplate: Could not find PlayerController to restore position") + print("RoomTemplate: Could not find PlayerController to restore position") func save_room(): save_game.save_to_file(get_tree().root.get_texture()) diff --git a/src/dev-util/savegame.gd b/src/dev-util/savegame.gd index 7b1f12c..01902b6 100644 --- a/src/dev-util/savegame.gd +++ b/src/dev-util/savegame.gd @@ -18,7 +18,7 @@ class_name SaveGame extends Resource ## Scenes / Items / IDs that were seen @export var seen : Array[StringName] = [] -@export var is_childhood_board_complete: bool = false +@export var childhood_board_complete: bool = false @export var subway_burnout : bool = false @export var player_position : Vector3 = Vector3.ZERO @@ -76,7 +76,7 @@ static func create_new() -> SaveGame: if not DirAccess.dir_exists_absolute(save.file_name.get_base_dir()): DirAccess.make_dir_absolute(save.file_name.get_base_dir()) - print_debug("SaveGame: Created new save: %s" % save.file_name) + print("SaveGame: Created new save: %s" % save.file_name) return save ## Loads an existing save from disk @@ -126,7 +126,7 @@ func capture_player_state() -> void: player_yaw = yaw.rotation.y player_pitch = pitch.rotation.x - print_debug("SaveGame: Captured player state - pos: %s, yaw: %.2f, pitch: %.2f" % [player_position, player_yaw, player_pitch]) + print("SaveGame: Captured player state - pos: %s, yaw: %.2f, pitch: %.2f" % [player_position, player_yaw, player_pitch]) ## Saves to disk with thumbnail func save_to_file(screen_shot: Texture2D) -> void: @@ -156,7 +156,7 @@ func save_to_file(screen_shot: Texture2D) -> void: if result != OK: push_error("Failed to save resource to: %s (Error: %d)" % [file_name, result]) else: - print_debug("Successfully saved to: %s" % file_name) + print("Successfully saved to: %s" % file_name) ## Processes and saves thumbnail as PNG func _save_thumbnail(screen_shot: Texture2D) -> void: @@ -178,8 +178,6 @@ func _save_thumbnail(screen_shot: Texture2D) -> void: # === Legacy Validation (may want to be removed) === func _validate() -> bool: - if current_room < 0 or current_room >= State.rooms.keys().size(): - return false return _validate_board_state() func _validate_board_state() -> bool: diff --git a/src/dev-util/testing.tscn b/src/dev-util/testing.tscn index 4faf75a..f0e02ac 100644 --- a/src/dev-util/testing.tscn +++ b/src/dev-util/testing.tscn @@ -17,7 +17,7 @@ func _process(delta): func _on_scene_actors_animation_finished(anim_name): - print_debug(\"yay\") + print(\"yay\") " [sub_resource type="Shader" id="Shader_tcvor"] diff --git a/src/dev-util/ui-testing.tscn b/src/dev-util/ui-testing.tscn index dc99ba0..3714c29 100644 --- a/src/dev-util/ui-testing.tscn +++ b/src/dev-util/ui-testing.tscn @@ -19,10 +19,10 @@ func _on_pressed() -> void: script/source = "extends MenuButton func _ready() -> void: - mouse_entered.connect(func(id): print_debug(\"mouse_entered\")) - get_popup().id_pressed.connect(func(id): print_debug(\"id_pressed\")) - get_popup().index_pressed.connect(func(id): print_debug(\"id_pressed\")) - get_popup().id_focused.connect(func(id): print_debug(\"id_focused\")) + mouse_entered.connect(func(id): print(\"mouse_entered\")) + get_popup().id_pressed.connect(func(id): print(\"id_pressed\")) + get_popup().index_pressed.connect(func(id): print(\"id_pressed\")) + get_popup().id_focused.connect(func(id): print(\"id_focused\")) " diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index b135663..e1e2c93 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -67,9 +67,8 @@ func _navigate_prev(): selection = candidates[index-1] -# Called when the node enters the scene tree for the first time. func _ready() -> void: - print_debug("CardBoard.gd: %s._ready()" % self.name) + print("CardBoard.gd: %s._ready()" % self.name) super._ready() # HACK: Lets us debug more easily if get_parent() == get_tree().root: @@ -80,7 +79,7 @@ func _ready() -> void: State.room.card_board = self -## frame rate independent FIR smoothing filter +## frame rate independent FIR smoothing filter used for small or dynamic card adjustments func _smooth(current: Vector2, goal: Vector2, delta: float) -> Vector2: var k := pow(0.1, 60.0 * delta) return (1.0-k) * current + k * goal @@ -132,7 +131,7 @@ func _finalize_board_state() -> void: # Reset context to NAVIGATE current_context = NAVIGATE - print_debug("CardBoard: Board state finalized") + print("CardBoard: Board state finalized") ## Spawn Cards and Post-Its @@ -219,10 +218,6 @@ func vanish(): hide() await Main.curtain.open() -# Checks if a Node is currently inside the dropzone -func is_in_dropzone(to_check: Draggable) -> bool: - return dropzone.get_rect().has_point(to_check.global_position) #TODO: is global pos correct here? - # Called by notes when a mouse event needs handling func handle_mouse_button(input: InputEventMouseButton, target: Draggable) -> void: @@ -261,10 +256,6 @@ func _end_drag(draggable: Draggable) -> void: # If dropped on a card, attach it if destination and destination is Card: var target_card := destination as Card - - if sticky.is_attached and sticky.attached_to != target_card: - sticky.attached_to.remove_note_if_present() - target_card.attach_or_exchange_note(sticky) # If dropped on board (no destination), ensure it's a child of the board @@ -364,7 +355,7 @@ func _nearest_hovered(candidates: Array[Draggable]) -> Draggable: func _by_spatial(a: Draggable, b: Draggable) -> bool: - return a.position.x + a.position.y * 100 > b.position.x + b.position.y * 100 + return a.position.x + a.position.y * 10000 > b.position.x + b.position.y * 10000 func _by_mouse(a: Draggable, b: Draggable) -> bool: @@ -411,25 +402,25 @@ func save_to_resource(savegame: SaveGame) -> void: savegame.board_positions.clear() savegame.board_attachments.clear() - print_debug("CardBoard: Saving board state...") + print("CardBoard: Saving board state...") # Save all cards and their positions for card in cards: savegame.board_positions[card.name] = card.position - print_debug(" Card '%s' at %s" % [card.name, card.position]) + print(" Card '%s' at %s" % [card.name, card.position]) # Save sticky note attachment if present var note: StickyNote = card.get_attached_note() if note: savegame.board_attachments[note.name] = card.name - print_debug(" Sticky '%s' attached to card '%s'" % [note.name, card.name]) + print(" Sticky '%s' attached to card '%s'" % [note.name, card.name]) # Save loose sticky notes (not attached to cards) for note in notes: savegame.board_positions[note.name] = note.position - print_debug(" Loose sticky '%s' at %s" % [note.name, note.position]) + print(" Loose sticky '%s' at %s" % [note.name, note.position]) - print_debug("CardBoard: Saved %d positions, %d attachments" % [ + print("CardBoard: Saved %d positions, %d attachments" % [ savegame.board_positions.size(), savegame.board_attachments.size() ]) @@ -439,11 +430,11 @@ func save_to_resource(savegame: SaveGame) -> void: func initialise_from_save(savegame: SaveGame) -> void: # Early return if nothing to load if savegame.board_positions.is_empty(): - print_debug("CardBoard: No board state to load (save is empty or legacy format)") + print("CardBoard: No board state to load (save is empty or legacy format)") return - print_debug("CardBoard: Loading board state from save...") - print_debug(" Positions: %d, Attachments: %d" % [ + print("CardBoard: Loading board state from save...") + print(" Positions: %d, Attachments: %d" % [ savegame.board_positions.size(), savegame.board_attachments.size() ]) @@ -465,7 +456,7 @@ func initialise_from_save(savegame: SaveGame) -> void: if card_name not in all_names: all_names.append(card_name) - print_debug(" Collected %d unique card/sticky names to load" % all_names.size()) + print(" Collected %d unique card/sticky names to load" % all_names.size()) # Create all cards and stickies populate_board(all_names) @@ -482,25 +473,25 @@ func initialise_from_save(savegame: SaveGame) -> void: for card: Card in cards: if savegame.board_positions.has(card.name): card.position = savegame.board_positions[card.name] - print_debug(" Card '%s' at %s" % [card.name, card.position]) + print(" Card '%s' at %s" % [card.name, card.position]) else: card.position = _generate_random_position() push_warning(" Card '%s' - no saved position, using random" % card.name) # Attach sticky notes to cards or position them loose for sticky: StickyNote in notes: - var card_name: StringName = savegame.board_attachments.get(sticky.name, &"") + var card_name: StringName = savegame.board_attachments.get(sticky.name, &"--nil--") if card_name and cards_by_name.has(card_name): - # Sticky is attached to a card + # Sticky must be attached to a card var card: Card = cards_by_name[card_name] card.attach_or_exchange_note(sticky, true) - print_debug(" Sticky '%s' attached to card '%s'" % [sticky.name, card_name]) + print(" Sticky '%s' attached to card '%s'" % [sticky.name, card_name]) else: # Sticky is loose on the board if savegame.board_positions.has(sticky.name): sticky.position = savegame.board_positions[sticky.name] - print_debug(" Loose sticky '%s' at %s" % [sticky.name, sticky.position]) + print(" Loose sticky '%s' at %s" % [sticky.name, sticky.position]) else: # Fallback to center of board sticky.position = position + size / 2.0 @@ -509,7 +500,7 @@ func initialise_from_save(savegame: SaveGame) -> void: # Re-sort by positions for correct z-ordering _sort_by_positions() - print_debug("CardBoard: Load complete!") + print("CardBoard: Load complete!") _check_completion() @@ -524,7 +515,7 @@ var _selection_candidates : Array[Draggable]: SelectionState.CARDS: return cards as Array[Draggable] SelectionState.STICKIES: return notes as Array[Draggable] SelectionState.FREE: - print_debug("switching from free selection to guided stickies selection") + print("switching from free selection to guided stickies selection") # Otherwise default to sticky selection selection_state = SelectionState.STICKIES diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index 7a2fb8e..2820c56 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -117,7 +117,7 @@ var burn_state: burned = burned.NOT: burn_tween.tween_property(self, "burn_progress", 0.5, 2) burn_state = burning burned.TORCHED: - print_debug("Card %s has been burned." % HardCards.get_obscure_name(name)) + print("Card %s has been burned." % HardCards.get_obscure_name(name)) has_burned.emit() burn_state = burning @@ -229,7 +229,12 @@ func attach_or_exchange_note(note: StickyNote, instant: bool = false) -> void: prints("Attaching", note, "to", self) # Out with the old... - remove_note_if_present() + var old := get_attached_note() + if old and note.is_attached: # swap with other card if possible + old.reparent(note.attached_to) + old.animate_home() + else: + remove_note_if_present() # just kick out our old note # ... in with the new note.reparent(self) diff --git a/src/logic-scenes/board/draggable.gd b/src/logic-scenes/board/draggable.gd index 93b664a..8ae8a04 100644 --- a/src/logic-scenes/board/draggable.gd +++ b/src/logic-scenes/board/draggable.gd @@ -71,7 +71,7 @@ var tween : Tween = null func animate_home() -> void: if tween: tween.kill() - tween = create_tween().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_BACK) + tween = create_tween().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_QUART) tween.tween_property(self, "position", home, 0.5) func _on_mouse_entered() -> void: diff --git a/src/logic-scenes/card_burner/card_burner.gd b/src/logic-scenes/card_burner/card_burner.gd index eb5c58c..bdf2116 100644 --- a/src/logic-scenes/card_burner/card_burner.gd +++ b/src/logic-scenes/card_burner/card_burner.gd @@ -14,7 +14,7 @@ var _input_locked : bool: get: return _submitted or not visible func _ready(): - print_debug("CardBurner.gd: %s._ready()" % self.name) + print("CardBurner.gd: %s._ready()" % self.name) super._ready() %SkipButton.pressed.connect(card_burned.emit) @@ -26,7 +26,7 @@ func vanish(): ## Main play coroutine - simple linear flow for burning a card func play() -> void: - print_debug("CardBurner: Starting card burning sequence") + print("CardBurner: Starting card burning sequence") # 1. Get all card names from the board (excluding stickies which start with "p") var card_names: Array[StringName] = [] @@ -34,7 +34,7 @@ func play() -> void: if not item_name.begins_with("p"): card_names.append(item_name) - print_debug("CardBurner: Found %d cards to choose from" % card_names.size()) + print("CardBurner: Found %d cards to choose from" % card_names.size()) # 2. Get card instances and shuffle them var stack : Array = HardCards.get_cards_by_name_array(card_names)["cards"] @@ -48,20 +48,20 @@ func play() -> void: assert(card, "Not enough cards collected.") cards.append(card) ancor.add_child(card) - print_debug("CardBurner: Added card '%s' to anchor" % card.name) + print("CardBurner: Added card '%s' to anchor" % card.name) print("CardBurner: ", len(cards)) # 4. Wait for player to burn a card (or skip) - print_debug("CardBurner: Waiting for player to burn a card...") + print("CardBurner: Waiting for player to burn a card...") await card_burned # 5. Play vanish animation and wait for completion - print_debug("CardBurner: Card burned, playing vanish animation") + print("CardBurner: Card burned, playing vanish animation") $AnimationPlayer.play("vanish") await $AnimationPlayer.animation_finished - print_debug("CardBurner: Sequence complete") + print("CardBurner: Sequence complete") func handle_hover(card: Draggable) -> void: diff --git a/src/logic-scenes/card_picker/card_picker.gd b/src/logic-scenes/card_picker/card_picker.gd index 299bbef..038ed96 100644 --- a/src/logic-scenes/card_picker/card_picker.gd +++ b/src/logic-scenes/card_picker/card_picker.gd @@ -20,7 +20,7 @@ var _input_locked: bool: var selection_state := INI: set(state): - print_debug("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state]) + print("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state]) selection_state = state if state == CARDS_SELECTED: @@ -115,7 +115,7 @@ func _input(event): func pick(id: int) -> void: - print_debug("%s picked card %s at id %d" % [name, options[id].text, id]) + print("%s picked card %s at id %d" % [name, options[id].text, id]) if id == -1: curr_selection_id = 0 return @@ -143,11 +143,11 @@ func pick(id: int) -> void: options.erase(option) anim_players[i].play("unshuffle") anim_players.remove_at(i) - print_debug("Removed StickyNote %s from options pool" % HardCards.get_obscure_name(option.name)) + print("Removed StickyNote %s from options pool" % HardCards.get_obscure_name(option.name)) i += 1 var winning_id - print_debug("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name)) + print("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name)) if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED): randomize() winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0) diff --git a/src/logic-scenes/interactable/interactable.gd b/src/logic-scenes/interactable/interactable.gd index 7acdd13..c82d34f 100644 --- a/src/logic-scenes/interactable/interactable.gd +++ b/src/logic-scenes/interactable/interactable.gd @@ -35,10 +35,10 @@ func _ready() -> void: light.visible = false Scenes.player_enable.connect(_player_active) # TODO: do I have to clean this up? - _pull_save_state.call_deferred() -func _pull_save_state() -> void: +## To be called by room +func pull_save_state() -> void: if interaction: playable = interaction.instantiate() as Control canvas_layer.add_child(playable) diff --git a/src/logic-scenes/luna/playables/story_playable.gd b/src/logic-scenes/luna/playables/story_playable.gd index 0846855..d2846da 100644 --- a/src/logic-scenes/luna/playables/story_playable.gd +++ b/src/logic-scenes/luna/playables/story_playable.gd @@ -67,7 +67,7 @@ var all_text_revealed: bool = false: var substring_sizes: Array[int] func _ready() -> void: - print_debug("StoryPlayable.gd: %s._ready()" % self.name) + print("StoryPlayable.gd: %s._ready()" % self.name) super._ready() State.settings_changed.connect(func(): story_array = story_array) skip_control = %SkipControl @@ -88,7 +88,7 @@ func _ready() -> void: func _rebuild(): - print_debug("StoryPlayable.gd: %s._rebuild()" % self.name) + print("StoryPlayable.gd: %s._rebuild()" % self.name) if is_node_ready(): substring_sizes = [] var p: int = 0 @@ -149,7 +149,7 @@ func appear(): await super.appear() func play(): - print_debug("StoryPlayable.gd: %s.play()" % self.name) + print("StoryPlayable.gd: %s.play()" % self.name) Input.mouse_mode = Input.MOUSE_MODE_VISIBLE @@ -217,11 +217,11 @@ func skip_text(): _emit_thunder() func _on_text_finished(): - print_debug("StoryPlayable.gd: %s._on_text_finished()" % self.name) + print("StoryPlayable.gd: %s._on_text_finished()" % self.name) if not animation_complete: text_finished.emit() func _emit_thunder() -> void: - if State.room is YouthRoom: State.room.play_thunder() + if State.room is YouthRoom: (State.room as YouthRoom).play_thunder() diff --git a/src/logic-scenes/playable.gd b/src/logic-scenes/playable.gd index 0c250e8..f8bd309 100644 --- a/src/logic-scenes/playable.gd +++ b/src/logic-scenes/playable.gd @@ -3,9 +3,10 @@ class_name Playable func _ready() -> void: hide() - if get_parent() == get_tree().root: + if not Main.normal_boot: play.call_deferred() + ## Awaitable that encapsulates the core interaction with this Playable func play() -> void: push_warning("Playeable[base].play() not overridden") diff --git a/src/logic-scenes/startup/startup_menu.gd b/src/logic-scenes/startup/startup_menu.gd index 69e6092..b1240f3 100644 --- a/src/logic-scenes/startup/startup_menu.gd +++ b/src/logic-scenes/startup/startup_menu.gd @@ -40,7 +40,7 @@ func _on_font_style_selected(index): match index: 1: State.current_main_theme = preload("res://logic-scenes/themes/handwriting.theme") - print_debug("easy handwriting selected") + print("easy handwriting selected") #owner.theme.set_font("NanumPenScript.ttf") return 2: @@ -68,7 +68,7 @@ func _on_subtitle_option_selected(index): State.enable_subtitles = true State.enable_closed_caption = true - print_debug(State.print_settings()) + print(State.print_settings()) # Volume Settings diff --git a/src/project.godot b/src/project.godot index 99dc983..613cd06 100644 --- a/src/project.godot +++ b/src/project.godot @@ -30,13 +30,13 @@ buses/default_bus_layout="uid://djkwd76o033io" [autoload] +HardCards="*res://dev-util/hardcoded_cards.tscn" State="*res://singletons/global_state.gd" Scenes="*res://singletons/scene_reference.gd" Steamworks="*res://dev-util/steamworks.gd" PromptManager="*res://addons/input_prompts/input_prompt_manager.gd" Steam="*res://dev-util/steam.gd" Main="*res://singletons/main/main.tscn" -HardCards="*res://dev-util/hardcoded_cards.tscn" I18n="*res://dev-util/i18n.gd" [debug] diff --git a/src/singletons/global_state.gd b/src/singletons/global_state.gd index 1fdba59..106f6b7 100644 --- a/src/singletons/global_state.gd +++ b/src/singletons/global_state.gd @@ -259,14 +259,14 @@ var focus_locked: bool = false # Intented for use when an actor wants focus for itself, can reclaim focus, thus dropping the stack that focused. func take_stage(actor: Object, _reclaim: bool = false) -> void: - print_debug(">>> take_stage(", actor,")"); + print(">>> take_stage(", actor,")"); assert(not focus_locked, "Focus is locked, %s cannot take focus." % actor) stage_list.push_front(actor) # Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell. func leave_stage(actor:Object) -> void: - print_debug("<<< leave_stage(", actor,")"); + print("<<< leave_stage(", actor,")"); assert(actor in stage_list, "Actor %s not in stage list." % actor) stage_list.erase(actor) diff --git a/src/singletons/main/main.gd b/src/singletons/main/main.gd index 15c8a68..cfa2935 100644 --- a/src/singletons/main/main.gd +++ b/src/singletons/main/main.gd @@ -25,7 +25,7 @@ enum AppState {BOOT, MENU, PLAY, PAUSE, CREDITS} var app_state: AppState = AppState.BOOT: set(value): app_state = value - print_debug("main.gd: app_state changing to: %s" % str(app_state)) + print("main.gd: app_state changing to: %s" % str(app_state)) match app_state: AppState.BOOT: credits_roll.hide() @@ -49,10 +49,10 @@ var app_state: AppState = AppState.BOOT: credits_roll.play() func _enter_tree() -> void: - print_debug("main.gd: _enter_tree()") + print("main.gd: _enter_tree()") func _ready() -> void: - print_debug("main.gd: _ready()") + print("main.gd: _ready()") main_menu.continue_button.pressed.connect(func(): app_state = AppState.PLAY) main_menu.credits_button.pressed.connect(func(): app_state = AppState.CREDITS) @@ -60,15 +60,15 @@ func _ready() -> void: await %Loading.stop() if normal_boot: - print_debug("main.gd: normal boot (loading last save and showing main menu)") + print("main.gd: normal boot (loading last save and showing main menu)") app_state = AppState.MENU else: - print_debug("main.gd: direct boot (hiding menus and entering main loop)") + print("main.gd: direct boot (hiding menus and entering main loop)") app_state = AppState.PLAY func start_game(save: SaveGame) -> void: - print_debug("main.gd: play_game()") + print("main.gd: play_game()") var room_path := room_paths.get(save.current_room, youth_room_path) as String while room_path: diff --git a/src/singletons/scene_reference.gd b/src/singletons/scene_reference.gd index e083756..43e13ab 100644 --- a/src/singletons/scene_reference.gd +++ b/src/singletons/scene_reference.gd @@ -36,37 +36,37 @@ func _ready() -> void: # Called by CollectableUi when it starts playing a scene func begin_sequence(scene_id: id, repeat: bool) -> void: - print_debug(">>> Scenes.begin_sequence(%s)" % str(id)) + print(">>> Scenes.begin_sequence(%s)" % str(id)) is_playing = true - + # Disable player movement during cutscenes player_enable.emit(false) - + started_sequences = started_sequences | (1 << scene_id) - + # Emit signal for other systems (music, animations, etc.) scene_starting.emit(scene_id, repeat) # Called by CollectableUi when it finishes playing a scene func end_sequence(scene_id: id, repeat: bool) -> void: - print_debug(">>> Scenes.end_sequence(%s)" % str(id)) - + print(">>> Scenes.end_sequence(%s)" % str(id)) + # Emit signal before clearing state scene_finished.emit(scene_id, repeat) - + # Mark as completed completed_sequences = completed_sequences | (1 << scene_id) - + is_playing = false - + # Re-enable player movement after cutscene player_enable.emit(true) # TODO: put this in savegame into a "seen" array. -func is_sequence_repeating(index: int) -> bool: +func is_sequence_repeating(index: int) -> bool: return completed_sequences & (1 << index) > 0 -func is_sequence_unlocked(index: id) -> bool: +func is_sequence_unlocked(index: id) -> bool: return (1 << int(index)) & enabled_sequences > 0 func get_completed_total() -> int: diff --git a/src/ui/credits_roll/credits_roll.gd b/src/ui/credits_roll/credits_roll.gd index 3efcd6c..1e3d095 100644 --- a/src/ui/credits_roll/credits_roll.gd +++ b/src/ui/credits_roll/credits_roll.gd @@ -8,7 +8,7 @@ var offset : Vector2 var playing : bool func _ready() -> void: - print_debug("credits_roll.gd: _ready()") + print("credits_roll.gd: _ready()") original = Handle.position set_process_input(false) @@ -22,7 +22,7 @@ func _input(event: InputEvent) -> void: stop() func play() -> void: - print_debug("credits_roll.gd: show()") + print("credits_roll.gd: show()") set_process_input(true) offset = original Handle.position = original @@ -34,7 +34,7 @@ func play() -> void: await tween.finished func stop() -> void: - print_debug("credits_roll.gd: hide()") + print("credits_roll.gd: hide()") set_process_input(false) var tween := create_tween() tween.tween_property(self, "modulate:a", 0.0, 2.0) diff --git a/src/ui/curtain/curtain.gd b/src/ui/curtain/curtain.gd index b5b7c99..9690c8e 100644 --- a/src/ui/curtain/curtain.gd +++ b/src/ui/curtain/curtain.gd @@ -4,13 +4,13 @@ class_name Curtain var _tween : Tween = null func _ready() -> void: - print_debug("curtain.gd: ready()") + print("curtain.gd: ready()") visible = true ## Conceals the Game Stage func close() -> void: visible = true - print_debug("curtain.gd: show()") + print("curtain.gd: show()") if _tween: _tween.kill() _tween = create_tween() _tween.tween_property(self, "modulate", Color.WHITE, 0.7) @@ -19,7 +19,7 @@ func close() -> void: ## Conceals the Game Stage func black() -> void: visible = true - print_debug("curtain.gd: show()") + print("curtain.gd: show()") if _tween: _tween.kill() _tween = create_tween() _tween.tween_property(self, "modulate", Color.BLACK, 0.7) @@ -27,7 +27,7 @@ func black() -> void: ## Makes the Game Stage Visible func open() -> void: - print_debug("curtain.gd: hide()") + print("curtain.gd: hide()") if _tween: _tween.kill() _tween = create_tween() _tween.tween_property(self, "modulate", Color.TRANSPARENT, 0.7) diff --git a/src/ui/menu_main/main_menu.gd b/src/ui/menu_main/main_menu.gd index b36b9cd..a9b88c4 100644 --- a/src/ui/menu_main/main_menu.gd +++ b/src/ui/menu_main/main_menu.gd @@ -12,7 +12,7 @@ class_name MainMenu extends Panel signal success func execute() -> void: - print_debug("main_menu.gd: execute()") + print("main_menu.gd: execute()") modulate.a = 0.0 assert(is_node_ready(), "MainMenu node not ready yet! (???)") @@ -32,7 +32,7 @@ func execute() -> void: # Called when the node enters the scene tree for the first time. func _ready() -> void: - print_debug("main_menu.gd: ready()") + print("main_menu.gd: ready()") _deactivate() continue_button.pressed.connect(_start_game) @@ -43,19 +43,19 @@ func _ready() -> void: quit_button.pressed.connect(get_tree().quit) func _new_game() -> void: - print_debug("main_menu.gd: start_new_game()") + print("main_menu.gd: start_new_game()") State.save_game = SaveGame.create_new() _start_game() func _start_game() -> void: - print_debug("main_menu.gd: _start_game()") + print("main_menu.gd: _start_game()") success.emit() await Main.start_game(State.save_game) func _load_save_game() -> void: - print_debug("main_menu.gd: _load_save_game()") + print("main_menu.gd: _load_save_game()") var save: SaveGame = await save_game_list.pick_save_slot() if (save != null): State.save_game = save @@ -67,7 +67,7 @@ func _load_save_game() -> void: func _activate() -> void: load_game_button.disabled = not save_game_list.has_more_saves() - continue_button.disabled = (State.save_game == null or State.save_game.is_empty) + continue_button.disabled = not State.save_game or State.save_game.is_empty load_game_button.disabled = not save_game_list.has_more_saves() diff --git a/src/ui/menu_main/save_game_list.gd b/src/ui/menu_main/save_game_list.gd index 0d7ba17..c2d74f8 100644 --- a/src/ui/menu_main/save_game_list.gd +++ b/src/ui/menu_main/save_game_list.gd @@ -101,12 +101,12 @@ func _on_delete_requested(id: int) -> void: # Delete the save file if FileAccess.file_exists(save_path): DirAccess.remove_absolute(save_path) - print_debug("Deleted save file: %s" % save_path) + print("Deleted save file: %s" % save_path) # Delete the thumbnail if FileAccess.file_exists(thumbnail_path): DirAccess.remove_absolute(thumbnail_path) - print_debug("Deleted thumbnail: %s" % thumbnail_path) + print("Deleted thumbnail: %s" % thumbnail_path) # Reload the save list _load_games()