diff --git a/src/addons/markdownlabel/example.gd b/src/addons/markdownlabel/example.gd index 8126491..552719c 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("%s task #%d on line %d: %s" % ["Checked" if checked else "Unchecked", id, line, text]) + print_debug("%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 5748474..a807de7 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(string) + print_debug(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.tscn b/src/base-environments/volunteer_room/volunteer_room.tscn index 08eec73..347e646 100644 --- a/src/base-environments/volunteer_room/volunteer_room.tscn +++ b/src/base-environments/volunteer_room/volunteer_room.tscn @@ -196,7 +196,7 @@ 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(\"anim player accessed!\") + print_debug(\"anim player accessed!\") super.play(anin_name, a, b, c) func on_autism_done(): diff --git a/src/base-environments/youth_room/Collectable.gd b/src/base-environments/youth_room/Collectable.gd index 0eaa85e..778d489 100644 --- a/src/base-environments/youth_room/Collectable.gd +++ b/src/base-environments/youth_room/Collectable.gd @@ -44,7 +44,7 @@ func _on_mouse_exited(): has_mouse = false func try_reveal(for_player: Player) -> bool: - print("reveal ui!") + print_debug("reveal ui!") revealed = ui.try_reveal() if revealed: call_deferred("wait_for_ui_exit", for_player) diff --git a/src/base-environments/youth_room/crouch_volume.gd b/src/base-environments/youth_room/crouch_volume.gd index 053f59d..1ca39c4 100644 --- a/src/base-environments/youth_room/crouch_volume.gd +++ b/src/base-environments/youth_room/crouch_volume.gd @@ -5,7 +5,7 @@ func ready(): body_exited.connect(notify_player_exit) func notify_player_entry(body: RigidBody3D): - print("Player entered Crouch area.") + print_debug("Player entered Crouch area.") if body is Player: body.inside_crouch_volume.append(self) diff --git a/src/base-environments/youth_room/scnees/scene_player.gd b/src/base-environments/youth_room/scnees/scene_player.gd index 7403928..6b835e2 100644 --- a/src/base-environments/youth_room/scnees/scene_player.gd +++ b/src/base-environments/youth_room/scnees/scene_player.gd @@ -96,12 +96,12 @@ func _rebuild(): func try_scroll(): var forward_target: int - #print( "max lines: " + str(max_lines)) - #print( "current lines: " + str(label.get_character_line(label.visible_characters))) + #print_debug( "max lines: " + str(max_lines)) + #print_debug( "current lines: " + str(label.get_character_line(label.visible_characters))) var visible_ratio: float = float(label.get_character_line(label.visible_characters)) / max_lines - #print("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9]) + #print_debug("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9]) if label.size.y * visible_ratio + scroll_container.scroll_vertical > scroll_container.size.y * 0.9: if scroll_container.scroll_vertical + scroll_container.size.y * 0.9 < label.size.y: diff --git a/src/base-environments/youth_room/youth_room.tscn b/src/base-environments/youth_room/youth_room.tscn index a83bcb9..117d17f 100644 --- a/src/base-environments/youth_room/youth_room.tscn +++ b/src/base-environments/youth_room/youth_room.tscn @@ -975,7 +975,7 @@ 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(\"anim player accessed!\") + print_debug(\"anim player accessed!\") super.play(anin_name, a, b, c) " diff --git a/src/code/button_themer.gd b/src/code/button_themer.gd index 5709a21..88b9377 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(owner) + print_debug(owner) rebuild() theme_changed.connect(rebuild) resized.connect(rebuild) diff --git a/src/dev-util/bpm_timer.gd b/src/dev-util/bpm_timer.gd index 9867688..161df9a 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(time_left) + if not Engine.is_editor_hint(): print_debug(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 80748c1..20d0318 100644 --- a/src/dev-util/bug_button.gd +++ b/src/dev-util/bug_button.gd @@ -26,4 +26,4 @@ func create_bug_report(): DisplayServer.clipboard_set(debug_text) - #print("mailto:support@polynormal.games?subject=Frame%20of%20Mind%20Demo%20-%20Bug%20Report&body=" + debug_text) + #print_debug("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 4d45e2c..8fe525e 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(event.action) + print_debug(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("Button pressed") + print_debug("Button pressed") func _on_line_edit_text_submitted(new_text): - print("Text submitted: ", new_text) + print_debug("Text submitted: ", new_text) diff --git a/src/dev-util/music_mix_helper.gd b/src/dev-util/music_mix_helper.gd index 893ed92..037d2df 100644 --- a/src/dev-util/music_mix_helper.gd +++ b/src/dev-util/music_mix_helper.gd @@ -56,7 +56,7 @@ func _ready() -> void: stream = AudioStreamPolyphonic.new() func play(from_position: float = 0.0): - print("got called") + print_debug("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 8e84f25..df0335f 100644 --- a/src/dev-util/room_template.gd +++ b/src/dev-util/room_template.gd @@ -10,7 +10,7 @@ var has_stage: bool: start_room() -@export var save_game:SaveGame = null +var save_game:SaveGame = null signal proceed(next_scene_path: String) diff --git a/src/dev-util/savegame.gd b/src/dev-util/savegame.gd index 9836d4a..e2f7d41 100644 --- a/src/dev-util/savegame.gd +++ b/src/dev-util/savegame.gd @@ -8,13 +8,13 @@ var current_room_path: String: @export var filepath: String: set(value): - print("Savegame: setting filepath: %s" % value) + print_debug("Savegame: setting filepath: %s" % value) filepath = value if _is_initialised: changed.emit() -@export var unique_save_name: String = "frame_of_mind_%s_%s" % [Time.get_date_string_from_system(), Time.get_time_string_from_system().replace(":", "-")]: - set(value): +@export var unique_save_name: String = "frame_of_mind_%s_%s" % [Time.get_date_string_from_system(), Time.get_time_string_from_system().replace(":", "-")] + "-" + str(randi()): + set(value): unique_save_name = value if _is_initialised: changed.emit() @@ -75,24 +75,27 @@ func _init(initial_filepath = "") -> void: else: filepath = initial_filepath unique_save_name = initial_filepath.get_file() + read_save_file() _is_initialised = true - if not DirAccess.dir_exists_absolute(filepath.get_base_dir()): - DirAccess.make_dir_absolute(filepath.get_base_dir()) - func read_save_file() -> void: + print_debug("Reading Savegame from: %s" % filepath) + + if not DirAccess.dir_exists_absolute(filepath.get_base_dir()): + DirAccess.make_dir_absolute(filepath.get_base_dir()) + if filepath == "DEBUG": if OS.has_feature("debug") or OS.has_feature("demo"): push_warning("Created DEBUG savegame. Progress will not be stored!") else: - print(get_stack()) + print_debug(get_stack()) push_error("Created DEBUG savegame outside of demo or debug environment. This is unintentional and will lead to data loss. Please contact support and attatch the stack above.") #TODO maybe cause a crash here? return if FileAccess.file_exists(filepath): - print("Opening existing Savegame: %s" % filepath) + print_debug("Opening existing Savegame: %s" % filepath) var file := FileAccess.open(filepath, FileAccess.READ) var raw_json := FileAccess.get_file_as_string(filepath) file.close() @@ -152,7 +155,7 @@ func read_save_file() -> void: thumbnail = ImageTexture.create_from_image(tmp_img) is_empty = false else: - print("Creating empty Savegame: %s" % filepath) + print_debug("Creating empty Savegame: %s" % filepath) is_valid = true func _get_save_dict() -> Dictionary: @@ -174,7 +177,7 @@ func save_to_file(screen_shot: Texture) -> void: return if current_room == State.rooms.NULL: - print("Not saving empty savegame.") + print_debug("Not saving empty savegame.") return last_saved = int(Time.get_unix_time_from_system()) @@ -190,7 +193,7 @@ func save_to_file(screen_shot: Texture) -> void: var thumbnail_path: String = "%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name] thumbnail_image.save_png(thumbnail_path) - print(filepath.get_base_dir()) + print_debug(filepath.get_base_dir()) var file := FileAccess.open(filepath, FileAccess.WRITE) file.store_string(JSON.stringify(_get_save_dict())) file.close() diff --git a/src/dev-util/testing.tscn b/src/dev-util/testing.tscn index f0e02ac..4faf75a 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(\"yay\") + print_debug(\"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 3714c29..dc99ba0 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(\"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\")) + 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\")) " diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index f0aacf9..6f029bd 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -454,7 +454,7 @@ func _input(event): get_viewport().set_input_as_handled() elif event.is_action_pressed("ui_left"): # right to switch context to the right - print(try_select_nearest_card(selection_position, Vector2.LEFT)) + print_debug(try_select_nearest_card(selection_position, Vector2.LEFT)) if focus_stickies: if current_context == NAVIGATE: focus_stickies = false diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index e84a736..b61b080 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -114,7 +114,7 @@ signal has_burned burn_tween.tween_property(self, "burn_progress", 2.0, 2) burn_tween.tween_callback(_torch).set_delay(1.0) burned.TORCHED: - print("Card %s has been burned." % HardCards.get_obscure_name(name)) + print_debug("Card %s has been burned." % HardCards.get_obscure_name(name)) has_burned.emit() burn_state = burning diff --git a/src/logic-scenes/card_picker/card_picker.gd b/src/logic-scenes/card_picker/card_picker.gd index 1a8fdd4..d7daad7 100644 --- a/src/logic-scenes/card_picker/card_picker.gd +++ b/src/logic-scenes/card_picker/card_picker.gd @@ -27,7 +27,7 @@ var has_stage = false: var _input_locked = true var selection_state = INI: set(state): - print("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state]) + print_debug("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state]) selection_state = state _input_locked = !(state == CARDS or state == POSTS) @@ -173,7 +173,7 @@ func _input(event): func pick(id: int): - print("%s picked card %s at id %d" % [name, options[id].text, id]) + print_debug("%s picked card %s at id %d" % [name, options[id].text, id]) if id == -1: curr_selection_id = 0 return @@ -200,11 +200,11 @@ func pick(id: int): options.erase(option) anim_players[i].play("unshuffle") anim_players.remove_at(i) - print("Removed StickyNote %s from options pool" % HardCards.get_obscure_name(option.name)) + print_debug("Removed StickyNote %s from options pool" % HardCards.get_obscure_name(option.name)) i += 1 var winning_id - print("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name)) + print_debug("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() # investigate if this fixes error on line 197 @@ -269,7 +269,7 @@ func handle_mouse_button(button_event: InputEventMouseButton, new_selection: Nod var current_scene_id func pick_cards(id: int, repeat: bool): current_scene_id = id - print("Reached actor %s in sequence %s. Is%s repeating." % [name, Scenes.id.keys()[id], " not" if repeat else ""]) + print_debug("Reached actor %s in sequence %s. Is%s repeating." % [name, Scenes.id.keys()[id], " not" if repeat else ""]) if not repeat: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE fill_card_slots(id) diff --git a/src/logic-scenes/collectable/collectable_ui.gd b/src/logic-scenes/collectable/collectable_ui.gd index 1c0840d..3ac5c33 100644 --- a/src/logic-scenes/collectable/collectable_ui.gd +++ b/src/logic-scenes/collectable/collectable_ui.gd @@ -29,7 +29,7 @@ class_name Collectable_Ui $Panel/Content/Buttons/VBoxContainer/collect_or_listen.text = "Collect Memento" @export var has_stage: bool = false: set(focused): - print("set focus of card to ", focused) + print_debug("set focus of card to ", focused) if has_stage == focused: return @@ -127,7 +127,7 @@ func _yoink_focus(): State.transition_stage_to(self) func _on_pick_button_pressed(): - print("card collected!") + print_debug("card collected!") if not is_board: Scenes.start_sequence(scene) State.leave_stage(self) @@ -140,7 +140,7 @@ func _on_pick_button_pressed(): func _on_skip_pressed(): - print("Scene skipped!") + print_debug("Scene skipped!") if scene != null: emit_signal("scene_skipped", 1) skipped = true diff --git a/src/logic-scenes/collectable/new_collectable_ui.gd b/src/logic-scenes/collectable/new_collectable_ui.gd index 23123f3..380b090 100644 --- a/src/logic-scenes/collectable/new_collectable_ui.gd +++ b/src/logic-scenes/collectable/new_collectable_ui.gd @@ -232,7 +232,7 @@ func collect_memento(): is_collected = true func _on_skip_pressed(): - print("Scene skipped!") + print_debug("Scene skipped!") if scene != null: scene_skipped.emit(1) was_skipped = true diff --git a/src/logic-scenes/player_controller/player_controller.gd b/src/logic-scenes/player_controller/player_controller.gd index 88d01fe..13c3461 100644 --- a/src/logic-scenes/player_controller/player_controller.gd +++ b/src/logic-scenes/player_controller/player_controller.gd @@ -2,7 +2,7 @@ class_name Player extends RigidBody3D var has_stage: bool = false: set(on_stage): - print("%s player controller take stage" % "True: " if on_stage else "false") + print_debug("%s player controller take stage" % "True: " if on_stage else "false") if has_stage != on_stage: if on_stage: has_stage = true @@ -26,7 +26,7 @@ var has_stage: bool = false: else: jitter_strength = 0 has_stage = false - print("player controller %s take stage" % "did" if has_stage else "didn't") + print_debug("player controller %s take stage" % "did" if has_stage else "didn't") sleeping = has_stage @export var mouse_sensitivity: Vector2 = Vector2(6, 5) @@ -145,7 +145,7 @@ func _on_ray_entered(_area): else: has_entered = false else: - print("You are standing in front of a wall") + print_debug("You are standing in front of a wall") func _on_ray_exited(area): if delay_passed and area is InteractiveSprite: diff --git a/src/singletons/main/main.gd b/src/singletons/main/main.gd index 68fdbbf..6d26838 100644 --- a/src/singletons/main/main.gd +++ b/src/singletons/main/main.gd @@ -19,7 +19,7 @@ extends Control } func _ready() -> void: - print("main.gd: ready()") + print_debug("main.gd: ready()") if State.room == null: _open() var path := await main_menu.execute() @@ -101,7 +101,7 @@ func _close() -> void: # current_room.queue_free() # State.onready_room = get_room_id_from_path(currently_loading_room) # current_room = ResourceLoader.load_threaded_get(currently_loading_room).instantiate() -# print("add room") +# print_debug("add room") # add_child(current_room) # State.onready_room = State.rooms.NULL # move_child(current_room, 0) @@ -118,7 +118,7 @@ func _unhandled_input(event: InputEvent) -> void: toggle_pause_menu() func toggle_pause_menu(): - print("Toggling pause menu") + print_debug("Toggling pause menu") pass # if not get_tree().paused: @@ -205,7 +205,7 @@ func toggle_pause_menu(): # in_game = true # #func pause_mode_changed(): -# print(get_tree().paused) +# print_debug(get_tree().paused) # #var await_swap: bool = false #func prepare_transition(scene_id: Scenes.id, _repeat): diff --git a/src/singletons/scene_reference.gd b/src/singletons/scene_reference.gd index 47e65a4..f8c6e7b 100644 --- a/src/singletons/scene_reference.gd +++ b/src/singletons/scene_reference.gd @@ -58,7 +58,7 @@ func continue_sequence(former_actor: Object): current_sequence_index += 1 State.stage_list[0] = sequence_actors[current_sequence][current_sequence_index].get_object() - print(sequence_actors[current_sequence][current_sequence_index].get_object().name) + print_debug(sequence_actors[current_sequence][current_sequence_index].get_object().name) State.stage_list[0].has_stage = true diff --git a/src/ui/menu_main/main_menu.gd b/src/ui/menu_main/main_menu.gd index 8ad24df..de869ac 100644 --- a/src/ui/menu_main/main_menu.gd +++ b/src/ui/menu_main/main_menu.gd @@ -12,8 +12,9 @@ class_name MainMenu extends Panel # Internal Signals signal _next_room(result: String) + func execute() -> String: - print("main_menu.gd: execute()") + print_debug("main_menu.gd: execute()") assert(is_node_ready(), "MainMenu node not ready yet! (???)") if State.save_game == null or State.save_game.current_room == 0: @@ -29,11 +30,6 @@ func execute() -> String: save_game_handle.visible = save_game_handle.has_existing_saves() - #if continue_button.visible: - # continue_button.grab_focus() - #else: - # new_game_button.grab_focus() - _activate() var result = await _next_room _deactivate() @@ -42,7 +38,7 @@ func execute() -> String: # Called when the node enters the scene tree for the first time. func _ready() -> void: - print("main_menu.gd: ready()") + print_debug("main_menu.gd: ready()") _deactivate() continue_button.pressed.connect(_start_game) @@ -53,25 +49,29 @@ func _ready() -> void: credits_button.pressed.connect(_choose.bind("credits")) #FIXME: Needs some other encoding, like path quit_button.pressed.connect(get_tree().quit) + func _new_game() -> void: - print("main_menu.gd: start_new_game()") + print_debug("main_menu.gd: start_new_game()") State.save_game = SaveGame.new() _start_game() func _start_game() -> void: - print("main_menu.gd: _start_game()") + print_debug("main_menu.gd: _start_game()") _next_room.emit(State.save_game.current_room_path) + func _load_save_game() -> void: - print("main_menu.gd: _load_save_game()") + print_debug("main_menu.gd: _load_save_game()") var save: SaveGame = await save_game_handle.pick_save_slot() _on_save_picked(save) + func _choose(choice: String) -> void: - print("main_menu.gd: _choose(", choice, ")") + print_debug("main_menu.gd: _choose(", choice, ")") _next_room.emit(choice) + func _activate() -> void: save_game_handle.visible = false @@ -79,6 +79,12 @@ func _activate() -> void: child.focus_mode = Control.FOCUS_ALL child.modulate = Color.WHITE child.mouse_filter = Control.MOUSE_FILTER_STOP + + if continue_button.visible: + continue_button.grab_focus() + else: + new_game_button.grab_focus() + func _deactivate() -> void: save_game_handle.visible = false @@ -88,8 +94,9 @@ func _deactivate() -> void: child.modulate = Color.WEB_GRAY child.mouse_filter = Control.MOUSE_FILTER_IGNORE + func _on_save_picked(save: SaveGame): - print("main_menu.gd: _on_save_picked(", save, ")") + print_debug("main_menu.gd: _on_save_picked(", save, ")") if (save != null): State.save_game = save _next_room.emit("start_game")