chore: debugging cardboard, better movement, but now save state has problems§

This commit is contained in:
tiger tiger tiger 2026-01-21 22:35:35 +01:00
parent 69e05f7562
commit 80eb4a727f
37 changed files with 222 additions and 117 deletions

View File

@ -5,5 +5,5 @@ func _ready() -> void:
$MarkdownLabel.display_file("res://addons/markdownlabel/README.md") $MarkdownLabel.display_file("res://addons/markdownlabel/README.md")
$MarkdownLabel.task_checkbox_clicked.connect( $MarkdownLabel.task_checkbox_clicked.connect(
func(id: int, line: int, checked: bool, text: String) -> void: 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])
) )

View File

@ -640,7 +640,7 @@ func _reset_escaped_chars(_text: String,code:=false) -> String:
func _debug(string: String) -> void: func _debug(string: String) -> void:
if not _debug_mode: if not _debug_mode:
return return
print_debug(string) print(string)
func _denotes_fenced_code_block(line: String, character: String) -> bool: func _denotes_fenced_code_block(line: String, character: String) -> bool:
var stripped_line := line.strip_edges() var stripped_line := line.strip_edges()

View File

@ -22,7 +22,7 @@ func get_ready() -> void:
card_board.initialise_from_save(save_game) card_board.initialise_from_save(save_game)
card_board.board_completed.connect(func(): card_board.board_completed.connect(func():
#TODO: hook in ending #TODO: hook in ending
save_room() %DoorInteractable.show()
) )

View File

@ -26,5 +26,5 @@ func scene_finished(_id: Scenes.id, _repeat: bool):
queue("RESET") queue("RESET")
func play(anin_name: StringName = "", a: float = -1, b: float = 1, c: bool = false) -> void: 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) super.play(anin_name, a, b, c)

View File

@ -47,9 +47,7 @@ func get_ready():
card_board.board_completed.connect(func(): card_board.board_completed.connect(func():
%DoorInteractable.show() %DoorInteractable.show()
if not save_game.is_childhood_board_complete: save_game.childhood_board_complete = true
save_game.is_childhood_board_complete = true
save_room()
) )
pull_save_state(State.save_game) 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.started_sequences = save_game.mementos_complete
Scenes.completed_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 # Call parent to restore player position
super.pull_save_state(save) super.pull_save_state(save)

View File

@ -22,7 +22,7 @@ func _fade_in(audio_stream : AudioStreamPlayer) -> void:
audio_stream.play(70) audio_stream.play(70)
func _on_scene_starting(scene_id: Scenes.id, _repeat: bool) -> void: 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 # Handle scene-specific music
# Note: Chest animation is now handled by YouthRoom.prepare_scene_start() # 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 _: pass
func _on_scene_finished(scene_id: Scenes.id, _repeat: bool) -> void: 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: match scene_id:
Scenes.id.YOUTH_CHILDHOOD: 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: 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) super.play(anim_name, a, b, c)

View File

@ -6,7 +6,7 @@ class_name ThemedButton extends Button
@onready var lower_corner_decor := load("res://import/interface-elements/lower_corner.png") @onready var lower_corner_decor := load("res://import/interface-elements/lower_corner.png")
func _ready() -> void: func _ready() -> void:
print_debug(owner) print(owner)
rebuild() rebuild()
theme_changed.connect(rebuild) theme_changed.connect(rebuild)
resized.connect(rebuild) resized.connect(rebuild)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -34,7 +34,7 @@ func _process(delta: float) -> void:
_on_beat() _on_beat()
_last_beat_timing = sync_to.get_playback_position() _last_beat_timing = sync_to.get_playback_position()
else: 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: 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 if starting_bar == 0 and starting_beat > 0: starting_bar = starting_beat / beats_per_bar

View File

@ -25,4 +25,4 @@ func create_bug_report():
DisplayServer.clipboard_set(debug_text) 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)

View File

@ -16,7 +16,7 @@ func _process(_delta):
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event is InputEventAction: if event is InputEventAction:
print_debug(event.action) print(event.action)
#func _unhandled_input(event): #func _unhandled_input(event):
# viewport.push_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) viewport.push_input(e)
func _on_button_pressed(): func _on_button_pressed():
print_debug("Button pressed") print("Button pressed")
func _on_line_edit_text_submitted(new_text): func _on_line_edit_text_submitted(new_text):
print_debug("Text submitted: ", new_text) print("Text submitted: ", new_text)

View File

@ -57,7 +57,7 @@ func _ready() -> void:
stream = AudioStreamPolyphonic.new() stream = AudioStreamPolyphonic.new()
func play(from_position: float = 0.0): func play(from_position: float = 0.0):
print_debug("got called") print("got called")
super.play(from_position) super.play(from_position)
self._play(from_position) self._play(from_position)

View File

@ -58,7 +58,7 @@ func restore_player_from_save(save: SaveGame) -> void:
if player and player is PlayerController: if player and player is PlayerController:
player.restore_from_save(save) player.restore_from_save(save)
else: else:
print_debug("RoomTemplate: Could not find PlayerController to restore position") print("RoomTemplate: Could not find PlayerController to restore position")
func save_room(): func save_room():
save_game.save_to_file(get_tree().root.get_texture()) save_game.save_to_file(get_tree().root.get_texture())

View File

@ -18,7 +18,7 @@ class_name SaveGame extends Resource
## Scenes / Items / IDs that were seen ## Scenes / Items / IDs that were seen
@export var seen : Array[StringName] = [] @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 subway_burnout : bool = false
@export var player_position : Vector3 = Vector3.ZERO @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()): if not DirAccess.dir_exists_absolute(save.file_name.get_base_dir()):
DirAccess.make_dir_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 return save
## Loads an existing save from disk ## Loads an existing save from disk
@ -126,7 +126,7 @@ func capture_player_state() -> void:
player_yaw = yaw.rotation.y player_yaw = yaw.rotation.y
player_pitch = pitch.rotation.x 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 ## Saves to disk with thumbnail
func save_to_file(screen_shot: Texture2D) -> void: func save_to_file(screen_shot: Texture2D) -> void:
@ -156,7 +156,7 @@ func save_to_file(screen_shot: Texture2D) -> void:
if result != OK: if result != OK:
push_error("Failed to save resource to: %s (Error: %d)" % [file_name, result]) push_error("Failed to save resource to: %s (Error: %d)" % [file_name, result])
else: else:
print_debug("Successfully saved to: %s" % file_name) print("Successfully saved to: %s" % file_name)
## Processes and saves thumbnail as PNG ## Processes and saves thumbnail as PNG
func _save_thumbnail(screen_shot: Texture2D) -> void: 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) === # === Legacy Validation (may want to be removed) ===
func _validate() -> bool: func _validate() -> bool:
if current_room < 0 or current_room >= State.rooms.keys().size():
return false
return _validate_board_state() return _validate_board_state()
func _validate_board_state() -> bool: func _validate_board_state() -> bool:

View File

@ -17,7 +17,7 @@ func _process(delta):
func _on_scene_actors_animation_finished(anim_name): func _on_scene_actors_animation_finished(anim_name):
print_debug(\"yay\") print(\"yay\")
" "
[sub_resource type="Shader" id="Shader_tcvor"] [sub_resource type="Shader" id="Shader_tcvor"]

View File

@ -19,10 +19,10 @@ func _on_pressed() -> void:
script/source = "extends MenuButton script/source = "extends MenuButton
func _ready() -> void: func _ready() -> void:
mouse_entered.connect(func(id): print_debug(\"mouse_entered\")) mouse_entered.connect(func(id): print(\"mouse_entered\"))
get_popup().id_pressed.connect(func(id): print_debug(\"id_pressed\")) get_popup().id_pressed.connect(func(id): print(\"id_pressed\"))
get_popup().index_pressed.connect(func(id): print_debug(\"id_pressed\")) get_popup().index_pressed.connect(func(id): print(\"id_pressed\"))
get_popup().id_focused.connect(func(id): print_debug(\"id_focused\")) get_popup().id_focused.connect(func(id): print(\"id_focused\"))
" "

View File

@ -67,9 +67,8 @@ func _navigate_prev():
selection = candidates[index-1] selection = candidates[index-1]
# Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
print_debug("CardBoard.gd: %s._ready()" % self.name) print("CardBoard.gd: %s._ready()" % self.name)
super._ready() super._ready()
# HACK: Lets us debug more easily # HACK: Lets us debug more easily
if get_parent() == get_tree().root: if get_parent() == get_tree().root:
@ -80,7 +79,7 @@ func _ready() -> void:
State.room.card_board = self 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: func _smooth(current: Vector2, goal: Vector2, delta: float) -> Vector2:
var k := pow(0.1, 60.0 * delta) var k := pow(0.1, 60.0 * delta)
return (1.0-k) * current + k * goal return (1.0-k) * current + k * goal
@ -132,7 +131,7 @@ func _finalize_board_state() -> void:
# Reset context to NAVIGATE # Reset context to NAVIGATE
current_context = NAVIGATE current_context = NAVIGATE
print_debug("CardBoard: Board state finalized") print("CardBoard: Board state finalized")
## Spawn Cards and Post-Its ## Spawn Cards and Post-Its
@ -219,10 +218,6 @@ func vanish():
hide() hide()
await Main.curtain.open() 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 # Called by notes when a mouse event needs handling
func handle_mouse_button(input: InputEventMouseButton, target: Draggable) -> void: 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 dropped on a card, attach it
if destination and destination is Card: if destination and destination is Card:
var target_card := destination as 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) target_card.attach_or_exchange_note(sticky)
# If dropped on board (no destination), ensure it's a child of the board # 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: 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: 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_positions.clear()
savegame.board_attachments.clear() savegame.board_attachments.clear()
print_debug("CardBoard: Saving board state...") print("CardBoard: Saving board state...")
# Save all cards and their positions # Save all cards and their positions
for card in cards: for card in cards:
savegame.board_positions[card.name] = card.position 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 # Save sticky note attachment if present
var note: StickyNote = card.get_attached_note() var note: StickyNote = card.get_attached_note()
if note: if note:
savegame.board_attachments[note.name] = card.name 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) # Save loose sticky notes (not attached to cards)
for note in notes: for note in notes:
savegame.board_positions[note.name] = note.position 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_positions.size(),
savegame.board_attachments.size() savegame.board_attachments.size()
]) ])
@ -439,11 +430,11 @@ func save_to_resource(savegame: SaveGame) -> void:
func initialise_from_save(savegame: SaveGame) -> void: func initialise_from_save(savegame: SaveGame) -> void:
# Early return if nothing to load # Early return if nothing to load
if savegame.board_positions.is_empty(): 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 return
print_debug("CardBoard: Loading board state from save...") print("CardBoard: Loading board state from save...")
print_debug(" Positions: %d, Attachments: %d" % [ print(" Positions: %d, Attachments: %d" % [
savegame.board_positions.size(), savegame.board_positions.size(),
savegame.board_attachments.size() savegame.board_attachments.size()
]) ])
@ -465,7 +456,7 @@ func initialise_from_save(savegame: SaveGame) -> void:
if card_name not in all_names: if card_name not in all_names:
all_names.append(card_name) 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 # Create all cards and stickies
populate_board(all_names) populate_board(all_names)
@ -482,25 +473,25 @@ func initialise_from_save(savegame: SaveGame) -> void:
for card: Card in cards: for card: Card in cards:
if savegame.board_positions.has(card.name): if savegame.board_positions.has(card.name):
card.position = savegame.board_positions[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: else:
card.position = _generate_random_position() card.position = _generate_random_position()
push_warning(" Card '%s' - no saved position, using random" % card.name) push_warning(" Card '%s' - no saved position, using random" % card.name)
# Attach sticky notes to cards or position them loose # Attach sticky notes to cards or position them loose
for sticky: StickyNote in notes: 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): 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] var card: Card = cards_by_name[card_name]
card.attach_or_exchange_note(sticky, true) 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: else:
# Sticky is loose on the board # Sticky is loose on the board
if savegame.board_positions.has(sticky.name): if savegame.board_positions.has(sticky.name):
sticky.position = savegame.board_positions[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: else:
# Fallback to center of board # Fallback to center of board
sticky.position = position + size / 2.0 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 # Re-sort by positions for correct z-ordering
_sort_by_positions() _sort_by_positions()
print_debug("CardBoard: Load complete!") print("CardBoard: Load complete!")
_check_completion() _check_completion()
@ -524,7 +515,7 @@ var _selection_candidates : Array[Draggable]:
SelectionState.CARDS: return cards as Array[Draggable] SelectionState.CARDS: return cards as Array[Draggable]
SelectionState.STICKIES: return notes as Array[Draggable] SelectionState.STICKIES: return notes as Array[Draggable]
SelectionState.FREE: 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 # Otherwise default to sticky selection
selection_state = SelectionState.STICKIES selection_state = SelectionState.STICKIES

View File

@ -117,7 +117,7 @@ var burn_state: burned = burned.NOT:
burn_tween.tween_property(self, "burn_progress", 0.5, 2) burn_tween.tween_property(self, "burn_progress", 0.5, 2)
burn_state = burning burn_state = burning
burned.TORCHED: 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() has_burned.emit()
burn_state = burning burn_state = burning
@ -229,7 +229,12 @@ func attach_or_exchange_note(note: StickyNote, instant: bool = false) -> void:
prints("Attaching", note, "to", self) prints("Attaching", note, "to", self)
# Out with the old... # 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 # ... in with the new
note.reparent(self) note.reparent(self)

View File

@ -71,7 +71,7 @@ var tween : Tween = null
func animate_home() -> void: func animate_home() -> void:
if tween: tween.kill() 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) tween.tween_property(self, "position", home, 0.5)
func _on_mouse_entered() -> void: func _on_mouse_entered() -> void:

View File

@ -14,7 +14,7 @@ var _input_locked : bool:
get: return _submitted or not visible get: return _submitted or not visible
func _ready(): func _ready():
print_debug("CardBurner.gd: %s._ready()" % self.name) print("CardBurner.gd: %s._ready()" % self.name)
super._ready() super._ready()
%SkipButton.pressed.connect(card_burned.emit) %SkipButton.pressed.connect(card_burned.emit)
@ -26,7 +26,7 @@ func vanish():
## Main play coroutine - simple linear flow for burning a card ## Main play coroutine - simple linear flow for burning a card
func play() -> void: 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") # 1. Get all card names from the board (excluding stickies which start with "p")
var card_names: Array[StringName] = [] var card_names: Array[StringName] = []
@ -34,7 +34,7 @@ func play() -> void:
if not item_name.begins_with("p"): if not item_name.begins_with("p"):
card_names.append(item_name) 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 # 2. Get card instances and shuffle them
var stack : Array = HardCards.get_cards_by_name_array(card_names)["cards"] 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.") assert(card, "Not enough cards collected.")
cards.append(card) cards.append(card)
ancor.add_child(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)) print("CardBurner: ", len(cards))
# 4. Wait for player to burn a card (or skip) # 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 await card_burned
# 5. Play vanish animation and wait for completion # 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") $AnimationPlayer.play("vanish")
await $AnimationPlayer.animation_finished await $AnimationPlayer.animation_finished
print_debug("CardBurner: Sequence complete") print("CardBurner: Sequence complete")
func handle_hover(card: Draggable) -> void: func handle_hover(card: Draggable) -> void:

View File

@ -20,7 +20,7 @@ var _input_locked: bool:
var selection_state := INI: var selection_state := INI:
set(state): 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 selection_state = state
if state == CARDS_SELECTED: if state == CARDS_SELECTED:
@ -115,7 +115,7 @@ func _input(event):
func pick(id: int) -> void: 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: if id == -1:
curr_selection_id = 0 curr_selection_id = 0
return return
@ -143,11 +143,11 @@ func pick(id: int) -> void:
options.erase(option) options.erase(option)
anim_players[i].play("unshuffle") anim_players[i].play("unshuffle")
anim_players.remove_at(i) 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 i += 1
var winning_id 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): if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED):
randomize() randomize()
winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0) winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0)

View File

@ -35,10 +35,10 @@ func _ready() -> void:
light.visible = false light.visible = false
Scenes.player_enable.connect(_player_active) # TODO: do I have to clean this up? 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: if interaction:
playable = interaction.instantiate() as Control playable = interaction.instantiate() as Control
canvas_layer.add_child(playable) canvas_layer.add_child(playable)

View File

@ -67,7 +67,7 @@ var all_text_revealed: bool = false:
var substring_sizes: Array[int] var substring_sizes: Array[int]
func _ready() -> void: func _ready() -> void:
print_debug("StoryPlayable.gd: %s._ready()" % self.name) print("StoryPlayable.gd: %s._ready()" % self.name)
super._ready() super._ready()
State.settings_changed.connect(func(): story_array = story_array) State.settings_changed.connect(func(): story_array = story_array)
skip_control = %SkipControl skip_control = %SkipControl
@ -88,7 +88,7 @@ func _ready() -> void:
func _rebuild(): func _rebuild():
print_debug("StoryPlayable.gd: %s._rebuild()" % self.name) print("StoryPlayable.gd: %s._rebuild()" % self.name)
if is_node_ready(): if is_node_ready():
substring_sizes = [] substring_sizes = []
var p: int = 0 var p: int = 0
@ -149,7 +149,7 @@ func appear():
await super.appear() await super.appear()
func play(): func play():
print_debug("StoryPlayable.gd: %s.play()" % self.name) print("StoryPlayable.gd: %s.play()" % self.name)
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
@ -217,11 +217,11 @@ func skip_text():
_emit_thunder() _emit_thunder()
func _on_text_finished(): 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: if not animation_complete:
text_finished.emit() text_finished.emit()
func _emit_thunder() -> void: func _emit_thunder() -> void:
if State.room is YouthRoom: State.room.play_thunder() if State.room is YouthRoom: (State.room as YouthRoom).play_thunder()

View File

@ -3,9 +3,10 @@ class_name Playable
func _ready() -> void: func _ready() -> void:
hide() hide()
if get_parent() == get_tree().root: if not Main.normal_boot:
play.call_deferred() play.call_deferred()
## Awaitable that encapsulates the core interaction with this Playable ## Awaitable that encapsulates the core interaction with this Playable
func play() -> void: func play() -> void:
push_warning("Playeable[base].play() not overridden") push_warning("Playeable[base].play() not overridden")

View File

@ -40,7 +40,7 @@ func _on_font_style_selected(index):
match index: match index:
1: 1:
State.current_main_theme = preload("res://logic-scenes/themes/handwriting.theme") 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") #owner.theme.set_font("NanumPenScript.ttf")
return return
2: 2:
@ -68,7 +68,7 @@ func _on_subtitle_option_selected(index):
State.enable_subtitles = true State.enable_subtitles = true
State.enable_closed_caption = true State.enable_closed_caption = true
print_debug(State.print_settings()) print(State.print_settings())
# Volume Settings # Volume Settings

View File

@ -30,13 +30,13 @@ buses/default_bus_layout="uid://djkwd76o033io"
[autoload] [autoload]
HardCards="*res://dev-util/hardcoded_cards.tscn"
State="*res://singletons/global_state.gd" State="*res://singletons/global_state.gd"
Scenes="*res://singletons/scene_reference.gd" Scenes="*res://singletons/scene_reference.gd"
Steamworks="*res://dev-util/steamworks.gd" Steamworks="*res://dev-util/steamworks.gd"
PromptManager="*res://addons/input_prompts/input_prompt_manager.gd" PromptManager="*res://addons/input_prompts/input_prompt_manager.gd"
Steam="*res://dev-util/steam.gd" Steam="*res://dev-util/steam.gd"
Main="*res://singletons/main/main.tscn" Main="*res://singletons/main/main.tscn"
HardCards="*res://dev-util/hardcoded_cards.tscn"
I18n="*res://dev-util/i18n.gd" I18n="*res://dev-util/i18n.gd"
[debug] [debug]

View File

@ -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. # 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: 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) assert(not focus_locked, "Focus is locked, %s cannot take focus." % actor)
stage_list.push_front(actor) stage_list.push_front(actor)
# Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell. # Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
func leave_stage(actor:Object) -> void: 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) assert(actor in stage_list, "Actor %s not in stage list." % actor)
stage_list.erase(actor) stage_list.erase(actor)

View File

@ -25,7 +25,7 @@ enum AppState {BOOT, MENU, PLAY, PAUSE, CREDITS}
var app_state: AppState = AppState.BOOT: var app_state: AppState = AppState.BOOT:
set(value): set(value):
app_state = 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: match app_state:
AppState.BOOT: AppState.BOOT:
credits_roll.hide() credits_roll.hide()
@ -49,10 +49,10 @@ var app_state: AppState = AppState.BOOT:
credits_roll.play() credits_roll.play()
func _enter_tree() -> void: func _enter_tree() -> void:
print_debug("main.gd: _enter_tree()") print("main.gd: _enter_tree()")
func _ready() -> void: 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.continue_button.pressed.connect(func(): app_state = AppState.PLAY)
main_menu.credits_button.pressed.connect(func(): app_state = AppState.CREDITS) main_menu.credits_button.pressed.connect(func(): app_state = AppState.CREDITS)
@ -60,15 +60,15 @@ func _ready() -> void:
await %Loading.stop() await %Loading.stop()
if normal_boot: 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 app_state = AppState.MENU
else: 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 app_state = AppState.PLAY
func start_game(save: SaveGame) -> void: 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 var room_path := room_paths.get(save.current_room, youth_room_path) as String
while room_path: while room_path:

View File

@ -36,37 +36,37 @@ func _ready() -> void:
# Called by CollectableUi when it starts playing a scene # Called by CollectableUi when it starts playing a scene
func begin_sequence(scene_id: id, repeat: bool) -> void: 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 is_playing = true
# Disable player movement during cutscenes # Disable player movement during cutscenes
player_enable.emit(false) player_enable.emit(false)
started_sequences = started_sequences | (1 << scene_id) started_sequences = started_sequences | (1 << scene_id)
# Emit signal for other systems (music, animations, etc.) # Emit signal for other systems (music, animations, etc.)
scene_starting.emit(scene_id, repeat) scene_starting.emit(scene_id, repeat)
# Called by CollectableUi when it finishes playing a scene # Called by CollectableUi when it finishes playing a scene
func end_sequence(scene_id: id, repeat: bool) -> void: 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 # Emit signal before clearing state
scene_finished.emit(scene_id, repeat) scene_finished.emit(scene_id, repeat)
# Mark as completed # Mark as completed
completed_sequences = completed_sequences | (1 << scene_id) completed_sequences = completed_sequences | (1 << scene_id)
is_playing = false is_playing = false
# Re-enable player movement after cutscene # Re-enable player movement after cutscene
player_enable.emit(true) player_enable.emit(true)
# TODO: put this in savegame into a "seen" array. # 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 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 return (1 << int(index)) & enabled_sequences > 0
func get_completed_total() -> int: func get_completed_total() -> int:

View File

@ -8,7 +8,7 @@ var offset : Vector2
var playing : bool var playing : bool
func _ready() -> void: func _ready() -> void:
print_debug("credits_roll.gd: _ready()") print("credits_roll.gd: _ready()")
original = Handle.position original = Handle.position
set_process_input(false) set_process_input(false)
@ -22,7 +22,7 @@ func _input(event: InputEvent) -> void:
stop() stop()
func play() -> void: func play() -> void:
print_debug("credits_roll.gd: show()") print("credits_roll.gd: show()")
set_process_input(true) set_process_input(true)
offset = original offset = original
Handle.position = original Handle.position = original
@ -34,7 +34,7 @@ func play() -> void:
await tween.finished await tween.finished
func stop() -> void: func stop() -> void:
print_debug("credits_roll.gd: hide()") print("credits_roll.gd: hide()")
set_process_input(false) set_process_input(false)
var tween := create_tween() var tween := create_tween()
tween.tween_property(self, "modulate:a", 0.0, 2.0) tween.tween_property(self, "modulate:a", 0.0, 2.0)

View File

@ -4,13 +4,13 @@ class_name Curtain
var _tween : Tween = null var _tween : Tween = null
func _ready() -> void: func _ready() -> void:
print_debug("curtain.gd: ready()") print("curtain.gd: ready()")
visible = true visible = true
## Conceals the Game Stage ## Conceals the Game Stage
func close() -> void: func close() -> void:
visible = true visible = true
print_debug("curtain.gd: show()") print("curtain.gd: show()")
if _tween: _tween.kill() if _tween: _tween.kill()
_tween = create_tween() _tween = create_tween()
_tween.tween_property(self, "modulate", Color.WHITE, 0.7) _tween.tween_property(self, "modulate", Color.WHITE, 0.7)
@ -19,7 +19,7 @@ func close() -> void:
## Conceals the Game Stage ## Conceals the Game Stage
func black() -> void: func black() -> void:
visible = true visible = true
print_debug("curtain.gd: show()") print("curtain.gd: show()")
if _tween: _tween.kill() if _tween: _tween.kill()
_tween = create_tween() _tween = create_tween()
_tween.tween_property(self, "modulate", Color.BLACK, 0.7) _tween.tween_property(self, "modulate", Color.BLACK, 0.7)
@ -27,7 +27,7 @@ func black() -> void:
## Makes the Game Stage Visible ## Makes the Game Stage Visible
func open() -> void: func open() -> void:
print_debug("curtain.gd: hide()") print("curtain.gd: hide()")
if _tween: _tween.kill() if _tween: _tween.kill()
_tween = create_tween() _tween = create_tween()
_tween.tween_property(self, "modulate", Color.TRANSPARENT, 0.7) _tween.tween_property(self, "modulate", Color.TRANSPARENT, 0.7)

View File

@ -12,7 +12,7 @@ class_name MainMenu extends Panel
signal success signal success
func execute() -> void: func execute() -> void:
print_debug("main_menu.gd: execute()") print("main_menu.gd: execute()")
modulate.a = 0.0 modulate.a = 0.0
assert(is_node_ready(), "MainMenu node not ready yet! (???)") 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. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
print_debug("main_menu.gd: ready()") print("main_menu.gd: ready()")
_deactivate() _deactivate()
continue_button.pressed.connect(_start_game) continue_button.pressed.connect(_start_game)
@ -43,19 +43,19 @@ func _ready() -> void:
quit_button.pressed.connect(get_tree().quit) quit_button.pressed.connect(get_tree().quit)
func _new_game() -> void: 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() State.save_game = SaveGame.create_new()
_start_game() _start_game()
func _start_game() -> void: func _start_game() -> void:
print_debug("main_menu.gd: _start_game()") print("main_menu.gd: _start_game()")
success.emit() success.emit()
await Main.start_game(State.save_game) await Main.start_game(State.save_game)
func _load_save_game() -> void: 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() var save: SaveGame = await save_game_list.pick_save_slot()
if (save != null): if (save != null):
State.save_game = save State.save_game = save
@ -67,7 +67,7 @@ func _load_save_game() -> void:
func _activate() -> void: func _activate() -> void:
load_game_button.disabled = not save_game_list.has_more_saves() 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() load_game_button.disabled = not save_game_list.has_more_saves()

View File

@ -101,12 +101,12 @@ func _on_delete_requested(id: int) -> void:
# Delete the save file # Delete the save file
if FileAccess.file_exists(save_path): if FileAccess.file_exists(save_path):
DirAccess.remove_absolute(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 # Delete the thumbnail
if FileAccess.file_exists(thumbnail_path): if FileAccess.file_exists(thumbnail_path):
DirAccess.remove_absolute(thumbnail_path) DirAccess.remove_absolute(thumbnail_path)
print_debug("Deleted thumbnail: %s" % thumbnail_path) print("Deleted thumbnail: %s" % thumbnail_path)
# Reload the save list # Reload the save list
_load_games() _load_games()