diff --git a/src/addons/markdownlabel/markdownlabel.gd b/src/addons/markdownlabel/markdownlabel.gd index 8d5f4f4..5748474 100644 --- a/src/addons/markdownlabel/markdownlabel.gd +++ b/src/addons/markdownlabel/markdownlabel.gd @@ -213,9 +213,9 @@ func _convert_markdown(source_text: String = "") -> String: _current_paragraph += 1 _skip_line_break = false _current_line += 1 - + line = _preprocess_line(line) - + # Handle fenced code blocks: if not within_tilde_block and _denotes_fenced_code_block(line, "`"): if within_backtick_block: @@ -250,11 +250,11 @@ func _convert_markdown(source_text: String = "") -> String: if within_code_block: #ignore any formatting inside code block _converted_text += _escape_bbcode(line) continue - + var _processed_line := line # Escape characters: _processed_line = _process_escaped_characters(_processed_line) - + # Process syntax: _processed_line = _process_table_syntax(_processed_line) _processed_line = _process_list_syntax(_processed_line, indent_spaces, indent_types) @@ -264,10 +264,10 @@ func _convert_markdown(source_text: String = "") -> String: _processed_line = _process_text_formatting_syntax(_processed_line) _processed_line = _process_header_syntax(_processed_line) _processed_line = _process_custom_syntax(_processed_line) - + # Re-insert escaped characters: _processed_line = _reset_escaped_chars(_processed_line) - + _converted_text += _processed_line # end for line loop # Close any remaining open list: @@ -278,7 +278,7 @@ func _convert_markdown(source_text: String = "") -> String: _debug("... end of text, closing all opened tables") if _within_table: _converted_text += "\n[/table]" - + _debug("** ORIGINAL:") _debug(source_text) _debug(_converted_text) @@ -548,7 +548,7 @@ func _process_text_formatting_syntax(line: String) -> String: processed_line = processed_line.erase(_start, 2).insert(_start, "[b]") processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/b]") _debug("... bold text: "+result.get_string(2)) - + # Italic text while true: regex.compile("(\\*|_)(.+?)\\1") @@ -574,9 +574,9 @@ func _process_text_formatting_syntax(line: String) -> String: else: processed_line = processed_line.erase(_start, 1).insert(_start, "[i]") processed_line = processed_line.erase(_end + 1, 1).insert(_end + 1, "[/i]") - + _debug("... italic text: "+result.get_string(2)) - + # Strike-through text regex.compile("(\\~\\~)(.+?)\\1") while true: @@ -588,7 +588,7 @@ func _process_text_formatting_syntax(line: String) -> String: var _end := result.get_end() processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/s]") _debug("... strike-through text: " + result.get_string(2)) - + return processed_line func _process_header_syntax(line: String) -> String: diff --git a/src/base-environments/youth_room/Collectable.gd b/src/base-environments/youth_room/Collectable.gd index a0ecb09..0eaa85e 100644 --- a/src/base-environments/youth_room/Collectable.gd +++ b/src/base-environments/youth_room/Collectable.gd @@ -25,9 +25,9 @@ var revealed: bool = false: await get_tree().create_timer(1).timeout if not ui.visible: wrapper.hide() - + var has_mouse: bool = false - + # Called when the node enters the scene tree for the first time. func _ready(): mouse_entered.connect(_on_mouse_entered) @@ -37,7 +37,7 @@ func _on_mouse_entered(): input_ray_pickable = false ui.is_collapsed = false has_mouse = true - + func _on_mouse_exited(): input_ray_pickable = true ui.is_collapsed = true diff --git a/src/base-environments/youth_room/scnees/scene_player.gd b/src/base-environments/youth_room/scnees/scene_player.gd index c6029f8..a261930 100644 --- a/src/base-environments/youth_room/scnees/scene_player.gd +++ b/src/base-environments/youth_room/scnees/scene_player.gd @@ -26,7 +26,7 @@ var max_lines: float = 0 elif progress > 0: for i in range(min(progress, substring_sizes.size()-1) as int) if progress > 0 else range(substring_sizes.size()-1): start_index += substring_sizes[i] - + label.visible_characters = start_index + substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1) else: label.visible_ratio = 0 @@ -70,13 +70,13 @@ func _ready() -> void: skip_control = %SkipControl if skip_control is SkipControl and not Engine.is_editor_hint(): skip_control.skip.connect(skip_text) - + if get_tree().root.get_child(-1) == self: TranslationServer.set_locale("en") play_scene() story_array = story_array progress = progress - + func _rebuild(): if is_node_ready(): substring_sizes = [] @@ -94,22 +94,22 @@ func _rebuild(): substring_sizes[-1] = substring_sizes[-1] + 1 label.text += "[/p]" max_lines = float(label.get_line_count()) - + func try_scroll(): var forward_target: int - + #print( "max lines: " + str(max_lines)) #print( "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]) - + 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: forward_target = scroll_container.scroll_vertical + scroll_container.size.y * 0.8 else: - forward_target = label.size.y - scroll_container.size.y + forward_target = label.size.y - scroll_container.size.y if scroll_target != null: var tween: Tween = get_tree().create_tween() ##tween.set_trans() @@ -117,38 +117,38 @@ func try_scroll(): func play_scene(): scroll_target = 0 - + # FIXME: find out why this needs to be set to prevent scenes from being fully revealed all_text_revealed = false animation_complete = false - + match State.speech_language: 2: animation_player.queue("de") _: animation_player.queue("en") - + if name == "draven": await get_tree().process_frame await get_tree().process_frame $AnimationPlayer/Music.play() - + await text_finished - + if name == "draven": trigger_intro() - + animation_complete = true all_text_revealed = true - + skip_control.start_proceed_countdown() - + await skip_control.proceed - + animation_player.play("vanish") - + await animation_player.animation_finished - + finished.emit() func _unhandled_input(event: InputEvent) -> void: diff --git a/src/dev-util/room_template.gd b/src/dev-util/room_template.gd index fbe9374..81fe10f 100644 --- a/src/dev-util/room_template.gd +++ b/src/dev-util/room_template.gd @@ -17,7 +17,7 @@ func start_room(): func pull_save_state(save: SaveGame) -> void: pass - + func save_room(): pull_save_state(save_game) 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 baa4699..81c2cdb 100644 --- a/src/dev-util/savegame.gd +++ b/src/dev-util/savegame.gd @@ -51,7 +51,7 @@ var _is_initialised: bool = false @export var save_manually: bool = false: set(val): if val: save_to_file(thumbnail) - + func _validate_property(property: Dictionary): if property.name == filepath: property.usage |= PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED @@ -72,7 +72,7 @@ func _init(initial_filepath = "") -> void: 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()) @@ -92,12 +92,12 @@ func read_save_file(): var raw_json = FileAccess.get_file_as_string(filepath) file.close() var parsed: Dictionary = JSON.parse_string(raw_json) - + var tmp_img: Image - + if FileAccess.file_exists("%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name]): tmp_img = Image.load_from_file("%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name]) - + var are_types_valid = ( parsed["unique_save_name"] is String and parsed["current_room"] is float and @@ -107,34 +107,34 @@ func read_save_file(): parsed["last_saved"] is float# and FIXME #parsed["demo"] is bool and last_saved != 0 ) - + if are_types_valid: for key in parsed.keys(): set(key, parsed[key]) - + for dict:Dictionary in [board_state["cards"], board_state["stickies"]]: for key in dict.keys(): if dict[key] is String: if dict[key].begins_with("("): dict[key] = parse_vec_from_string(dict[key]) - + var cards: Dictionary[StringName, Variant] var stickies: Dictionary[StringName, Variant] var randoms: Array[StringName] - + for cardname:String in board_state["cards"]: cards[StringName(cardname)] = board_state["cards"][cardname] for sticky_name:String in board_state["stickies"]: stickies[StringName(sticky_name)] = board_state["stickies"][sticky_name] for random_name:StringName in board_state["randoms"]: randoms.append( random_name ) - + board_state = { "cards": cards, "stickies": stickies, "randoms": randoms } - + is_valid = are_types_valid \ and current_room >= 0 \ and current_room < State.rooms.keys().size() \ @@ -142,7 +142,7 @@ func read_save_file(): if not is_valid: push_error("Parsing of Save failed.") - + if tmp_img != null: thumbnail = ImageTexture.create_from_image(tmp_img) is_empty = false @@ -167,29 +167,29 @@ func save_to_file(current_screen: Texture): if filepath == "DEBUG": push_warning("Saving DEBUG save skipped. This is intentional.") return - + if current_room == State.rooms.NULL: print("Not saving empty savegame.") return - + last_saved = Time.get_unix_time_from_system() var thumbnail_image: Image = current_screen.get_image() thumbnail_image.convert(Image.Format.FORMAT_RGB8) thumbnail_image.linear_to_srgb() thumbnail_image.resize(384, 261, Image.INTERPOLATE_LANCZOS) # nonexistent call in ViewportTexturew - + var thumbnail_path: String = "%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name] var save_dir = DirAccess.open(filepath.get_base_dir()) if not save_dir.dir_exists("thumbnails"): save_dir.make_dir("thumbnails") - + thumbnail_image.save_png("%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name]) #thumbnail_image.save_png("%s/test.png" % State.user_saves_path) print(filepath.get_base_dir()) var file = FileAccess.open(filepath, FileAccess.WRITE) file.store_string(JSON.stringify(_get_save_dict())) file.close() - + func calculate_completed_sequences() -> int: var i: int = mementos_complete - ((mementos_complete >> 1) & 0x55555555); @@ -200,10 +200,10 @@ func calculate_completed_sequences() -> int: func calculate_total_connections() -> int: var connections:= 0 - + for sticky_position in board_state.stickies.values(): connections += int(sticky_position is String) - + return connections func validate_board_state() -> bool: @@ -216,9 +216,9 @@ func validate_board_state() -> bool: if not (sticky is int or sticky is Vector2 or board_state.cards.keys().has(sticky)): push_error("Save %s could not be parsed: Corrupted Sticky Notes.") return false - + return true - + return false func parse_vec_from_string(string: String) -> Vector2: diff --git a/src/logic-scenes/card_picker/card_picker.gd b/src/logic-scenes/card_picker/card_picker.gd index fb12b0e..e6ba25f 100644 --- a/src/logic-scenes/card_picker/card_picker.gd +++ b/src/logic-scenes/card_picker/card_picker.gd @@ -11,7 +11,7 @@ enum { DONE } -var has_stage = false: +var has_stage = false: set(focus): if not focus == has_stage: if focus: @@ -23,14 +23,14 @@ var has_stage = false: self.hide() process_mode = Node.PROCESS_MODE_DISABLED has_stage = focus - + 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]) selection_state = state _input_locked = !(state == CARDS or state == POSTS) - + if state == CARDS_SELECTED: var tween = get_tree().create_tween() tween.tween_property($thought_prompt, "modulate", Color(1, 1, 1, 0), 0.5) @@ -42,11 +42,11 @@ var curr_selection_id: int = -1: set(new_id): if selection_state == CARDS or selection_state == POSTS: if not curr_selection_id == -1: options[curr_selection_id].highlighted = false - + if new_id > options.size() -1: curr_selection_id = 0 elif new_id < 0: curr_selection_id = options.size() - 1 else: curr_selection_id = new_id - + options[curr_selection_id].highlighted = true else: curr_selection_id = new_id @@ -58,7 +58,7 @@ signal cards_picked(cardnames: Array[String]) # Called when the node enters the scene tree for the first time. func _ready(): - + #FIXME: can I make this less annoying somehow? if State.onready_room == State.rooms.YOUTH: Scenes.sign_up_for_sequence(pick_cards, Scenes.id.YOUTH_DRAEVEN, 2) @@ -76,13 +76,13 @@ func _ready(): else: return assert(false) - + if get_tree().root == self.get_parent(): pick_cards(3, false) State.take_stage(self) - + reset() - + func reset(): card_anim_skipped = false output = [] @@ -97,7 +97,7 @@ func reset(): func fill_card_slots(id: int): var new_cards = HardCards.get_cards_by_scene_id(id) - + for i in range(new_cards.size()): $cards.get_child(i).remove_child($cards.get_child(i).get_child(1)) var new_card:Card = new_cards[i] @@ -113,15 +113,15 @@ func fill_post_slots(): var sticky_notes: Array[StickyNote] = [] for card: Card in output: sticky_notes.append_array(HardCards.get_children_of(card.card_id)) - + for note:StickyNote in sticky_notes: note.current_handle = self - + sticky_notes.shuffle() options = [] for ancor in $sticky_notes.get_children(): ancor.remove_child(ancor.get_child(1)) - + for i in range(sticky_notes.size()): options.append(sticky_notes[i]) $sticky_notes.get_child(i).add_child(options[i], false) @@ -137,7 +137,7 @@ func _input(event): #if event.is_action_pressed("ui_end"): # fill_card_slots(3) # selection_state = CARDS - + if has_stage: if not _input_locked: if not on_cooldown: @@ -148,7 +148,7 @@ func _input(event): on_cooldown = true await get_tree().create_timer(0.1).timeout on_cooldown = false - + if event.is_action_pressed("ui_accept"): pick(curr_selection_id) elif event.is_action_pressed("skip"): @@ -169,27 +169,27 @@ func _input(event): transition() elif selection_state == TRANSITION: show_posts() - + func pick(id: int): print("%s picked card %s at id %d" % [name, options[id].text, id]) if id == -1: curr_selection_id = 0 return - + if selection_state == CARDS: selection_state = CARDS_SELECTED elif selection_state == POSTS: selection_state = POSTS_SELECTED - + anim_players[id].play("pick") picked_player = anim_players[id] var yield_to = anim_players[id].animation_finished output.append(options[id]) - + options.remove_at(id) anim_players.remove_at(id) - + var parent_id:StringName if selection_state == POSTS_SELECTED: parent_id = output[-1].parent_id @@ -201,8 +201,8 @@ func pick(id: int): anim_players.remove_at(i) print("Removed StickyNote %s from options pool" % HardCards.get_obscure_name(option.name)) i += 1 - - var winning_id + + var winning_id 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() @@ -213,14 +213,14 @@ func pick(id: int): if Steamworks.has_initialized: Steam.setAchievement("FIGHT_BACK") Steam.storeStats() - + output.append(options.pop_at(winning_id)) random_player = anim_players[winning_id] anim_players.pop_at(winning_id).play("shuffle") - + for anim in anim_players: anim.play("unshuffle") - + await yield_to if not card_anim_skipped: transition() @@ -234,9 +234,9 @@ func transition(): anim_players.append(control.get_child(0)) control.get_child(0).play("post") curr_selection_id = -1 - + fill_post_slots() - + await anim_players[0].animation_finished if selection_state != POSTS: show_posts() @@ -253,7 +253,7 @@ func show_posts(): player.play("RESET") await get_tree().create_timer(.5).timeout selection_state = POSTS - + func handle_hover(new_highlight): if not _input_locked: @@ -276,7 +276,7 @@ func pick_cards(id: int, repeat: bool): selection_state = CARDS if id == Scenes.id.YOUTH_DRAEVEN and not repeat: $Meaning.play() - + else: Scenes.end_current_sequence() diff --git a/src/logic-scenes/main menu/main_menu.gd b/src/logic-scenes/main menu/main_menu.gd index b180e6a..2966298 100644 --- a/src/logic-scenes/main menu/main_menu.gd +++ b/src/logic-scenes/main menu/main_menu.gd @@ -55,7 +55,7 @@ func _ready() -> void: settings_button.pressed.connect(settings_popup.show_settings) quit_button.pressed.connect(get_tree().quit) credits_button.pressed.connect(roll_credits.emit) - + State.take_stage(self) func _on_save_picked(save: SaveGame): diff --git a/src/logic-scenes/main menu/save_game_list.gd b/src/logic-scenes/main menu/save_game_list.gd index 9856882..6b31758 100644 --- a/src/logic-scenes/main menu/save_game_list.gd +++ b/src/logic-scenes/main menu/save_game_list.gd @@ -39,28 +39,28 @@ func load_games(): saves = [] var save_game_dir := DirAccess.open(State.user_saves_path) var filepaths: PackedStringArray = save_game_dir.get_files() - + for path in filepaths: if path.ends_with(".json"): saves.append(SaveGame.new("%s/%s" % [State.user_saves_path, path.get_basename()])) - + saves.append(SaveGame.new()) - + #purging the current state save_buttons = [] if scroll_container != null: scroll_container.queue_free() - + scroll_container = ScrollContainer.new() - + scroll_container.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED scroll_container.custom_minimum_size = Vector2(0, ProjectSettings.get_setting("display/window/size/viewport_height") - 256) add_child(scroll_container) - + var save_box := VBoxContainer.new() save_box.add_theme_constant_override("separation", 16) scroll_container.add_child(save_box) - + for i in range(saves.size()): var new_button := SaveGameDisplay.new(saves[i], i+1) save_box.add_child(new_button) @@ -73,7 +73,7 @@ func _on_game_picked(id: int): picked.emit(id) else: $Popup.show() - + else: picked.emit(id) @@ -92,9 +92,9 @@ func get_most_recent_save() -> SaveGame: if saves[i].last_saved > most_recent_time and not saves[i].current_room == 0: most_recent_index = i most_recent_time = saves[i].last_saved - + return saves[most_recent_index] if most_recent_time > 0 else SaveGame.new() - + func has_existing_saves() -> bool: return saves.size() > 1 diff --git a/src/project.godot b/src/project.godot index b828a19..8b3359d 100644 --- a/src/project.godot +++ b/src/project.godot @@ -35,9 +35,8 @@ gdscript/warnings/native_method_override=0 [display] -window/size/viewport_width=1920 -window/size/viewport_height=1080 -window/size/mode=3 +window/size/viewport_width=1600 +window/size/viewport_height=900 window/stretch/mode="canvas_items" window/stretch/aspect="expand" display_server/driver.linuxbsd="wayland" diff --git a/src/singletons/global_state.gd b/src/singletons/global_state.gd index d687e86..d00db06 100644 --- a/src/singletons/global_state.gd +++ b/src/singletons/global_state.gd @@ -19,7 +19,7 @@ var settings_initialised screen_reader_enabled = value if settings_initialised: settings_changed.emit() - + @export var rendering_disabled: bool = false: set(value): rendering_disabled = value @@ -154,13 +154,13 @@ signal theme_changed func load_user_settings(): - + if FileAccess.file_exists(user_settings_path): var file = FileAccess.open(user_settings_path, FileAccess.READ) var raw_json = FileAccess.get_file_as_string(user_settings_path) file.close() var parsed: Dictionary = JSON.parse_string(raw_json) - + for kategory in parsed.values(): for key in kategory.keys(): if key in self: @@ -172,7 +172,7 @@ func load_user_settings(): OS.execute("defaults", ["read", "/Users/$loggedInUser/Library/Preferences/com.apple.universalaccess.plist", "reduceMotion"], out) if out[0] == "reduce": reduce_motion = true - + settings_initialised = true settings_changed.emit() @@ -214,11 +214,11 @@ func save_settings(): "obscure_logs": obscure_logs } } - + var file = FileAccess.open(user_settings_path, FileAccess.WRITE) file.store_string(JSON.stringify(out_dict)) file.close() - + settings_initialised = true settings_changed.emit() @@ -227,7 +227,7 @@ func _unhandled_input(event: InputEvent) -> void: #FIXME this can be removed when state no longer needs to be a tool if not Engine.is_editor_hint(): if event.is_action_pressed("toggle_fullscreen"): - + # I have no idea why I wrote thit as conviluted, # but it works(TM) so I am not gonna change it :D if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: @@ -250,7 +250,7 @@ func _ready(): pass_stage_to(child) break music_volume = music_volume - + #region focus handling (called staging to avoid name colisions) @@ -274,19 +274,19 @@ func take_stage(actor: Object, reclaim: bool = false) -> bool: # Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell. func leave_stage(actor:Object) -> bool: - + if stage_list[0] == actor: actor.has_stage = false focus_locked = false stage_list.erase(actor) - + if stage_list != []: stage_list.front().has_stage = true else: get_tree().quit() - + return false - + func get_current_actor(): return stage_list.front() # Used to put a new target on top of the Focus Stack. diff --git a/src/singletons/scene_reference.gd b/src/singletons/scene_reference.gd index 87639c8..47e65a4 100644 --- a/src/singletons/scene_reference.gd +++ b/src/singletons/scene_reference.gd @@ -51,21 +51,21 @@ func start_sequence(index: id): func continue_sequence(former_actor: Object): # if this fails, pass next was called without a sequencce having been started. assert(current_sequence != -1) - + if former_actor == State.stage_list[0] and former_actor == sequence_actors[current_sequence][current_sequence_index].get_object(): former_actor.has_stage = false - + 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) - + State.stage_list[0].has_stage = true - + sequence_actors[current_sequence][current_sequence_index].call(current_sequence, is_sequence_repeating(current_sequence)) - + scene_continuing.emit(current_sequence, current_sequence_index, is_sequence_repeating(current_sequence)) - + func end_current_sequence(): State.leave_stage(State.stage_list[0]) scene_finished.emit(current_sequence, is_sequence_repeating(current_sequence))