chore: more .import files, linebreak issues, and set the game to 1600x900 for much better testing and debugging experience.

This commit is contained in:
tiger tiger tiger 2025-12-08 10:43:02 +01:00
parent 43081b1be3
commit d289c90431
11 changed files with 117 additions and 118 deletions

View File

@ -213,9 +213,9 @@ func _convert_markdown(source_text: String = "") -> String:
_current_paragraph += 1 _current_paragraph += 1
_skip_line_break = false _skip_line_break = false
_current_line += 1 _current_line += 1
line = _preprocess_line(line) line = _preprocess_line(line)
# Handle fenced code blocks: # Handle fenced code blocks:
if not within_tilde_block and _denotes_fenced_code_block(line, "`"): if not within_tilde_block and _denotes_fenced_code_block(line, "`"):
if within_backtick_block: 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 if within_code_block: #ignore any formatting inside code block
_converted_text += _escape_bbcode(line) _converted_text += _escape_bbcode(line)
continue continue
var _processed_line := line var _processed_line := line
# Escape characters: # Escape characters:
_processed_line = _process_escaped_characters(_processed_line) _processed_line = _process_escaped_characters(_processed_line)
# Process syntax: # Process syntax:
_processed_line = _process_table_syntax(_processed_line) _processed_line = _process_table_syntax(_processed_line)
_processed_line = _process_list_syntax(_processed_line, indent_spaces, indent_types) _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_text_formatting_syntax(_processed_line)
_processed_line = _process_header_syntax(_processed_line) _processed_line = _process_header_syntax(_processed_line)
_processed_line = _process_custom_syntax(_processed_line) _processed_line = _process_custom_syntax(_processed_line)
# Re-insert escaped characters: # Re-insert escaped characters:
_processed_line = _reset_escaped_chars(_processed_line) _processed_line = _reset_escaped_chars(_processed_line)
_converted_text += _processed_line _converted_text += _processed_line
# end for line loop # end for line loop
# Close any remaining open list: # Close any remaining open list:
@ -278,7 +278,7 @@ func _convert_markdown(source_text: String = "") -> String:
_debug("... end of text, closing all opened tables") _debug("... end of text, closing all opened tables")
if _within_table: if _within_table:
_converted_text += "\n[/table]" _converted_text += "\n[/table]"
_debug("** ORIGINAL:") _debug("** ORIGINAL:")
_debug(source_text) _debug(source_text)
_debug(_converted_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(_start, 2).insert(_start, "[b]")
processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/b]") processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/b]")
_debug("... bold text: "+result.get_string(2)) _debug("... bold text: "+result.get_string(2))
# Italic text # Italic text
while true: while true:
regex.compile("(\\*|_)(.+?)\\1") regex.compile("(\\*|_)(.+?)\\1")
@ -574,9 +574,9 @@ func _process_text_formatting_syntax(line: String) -> String:
else: else:
processed_line = processed_line.erase(_start, 1).insert(_start, "[i]") processed_line = processed_line.erase(_start, 1).insert(_start, "[i]")
processed_line = processed_line.erase(_end + 1, 1).insert(_end + 1, "[/i]") processed_line = processed_line.erase(_end + 1, 1).insert(_end + 1, "[/i]")
_debug("... italic text: "+result.get_string(2)) _debug("... italic text: "+result.get_string(2))
# Strike-through text # Strike-through text
regex.compile("(\\~\\~)(.+?)\\1") regex.compile("(\\~\\~)(.+?)\\1")
while true: while true:
@ -588,7 +588,7 @@ func _process_text_formatting_syntax(line: String) -> String:
var _end := result.get_end() var _end := result.get_end()
processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/s]") processed_line = processed_line.erase(_end - 1, 2).insert(_end - 1, "[/s]")
_debug("... strike-through text: " + result.get_string(2)) _debug("... strike-through text: " + result.get_string(2))
return processed_line return processed_line
func _process_header_syntax(line: String) -> String: func _process_header_syntax(line: String) -> String:

View File

@ -25,9 +25,9 @@ var revealed: bool = false:
await get_tree().create_timer(1).timeout await get_tree().create_timer(1).timeout
if not ui.visible: if not ui.visible:
wrapper.hide() wrapper.hide()
var has_mouse: bool = false var has_mouse: bool = false
# 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(): func _ready():
mouse_entered.connect(_on_mouse_entered) mouse_entered.connect(_on_mouse_entered)
@ -37,7 +37,7 @@ func _on_mouse_entered():
input_ray_pickable = false input_ray_pickable = false
ui.is_collapsed = false ui.is_collapsed = false
has_mouse = true has_mouse = true
func _on_mouse_exited(): func _on_mouse_exited():
input_ray_pickable = true input_ray_pickable = true
ui.is_collapsed = true ui.is_collapsed = true

View File

@ -26,7 +26,7 @@ var max_lines: float = 0
elif progress > 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): 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] start_index += substring_sizes[i]
label.visible_characters = start_index + substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1) label.visible_characters = start_index + substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1)
else: else:
label.visible_ratio = 0 label.visible_ratio = 0
@ -70,13 +70,13 @@ func _ready() -> void:
skip_control = %SkipControl skip_control = %SkipControl
if skip_control is SkipControl and not Engine.is_editor_hint(): if skip_control is SkipControl and not Engine.is_editor_hint():
skip_control.skip.connect(skip_text) skip_control.skip.connect(skip_text)
if get_tree().root.get_child(-1) == self: if get_tree().root.get_child(-1) == self:
TranslationServer.set_locale("en") TranslationServer.set_locale("en")
play_scene() play_scene()
story_array = story_array story_array = story_array
progress = progress progress = progress
func _rebuild(): func _rebuild():
if is_node_ready(): if is_node_ready():
substring_sizes = [] substring_sizes = []
@ -94,22 +94,22 @@ func _rebuild():
substring_sizes[-1] = substring_sizes[-1] + 1 substring_sizes[-1] = substring_sizes[-1] + 1
label.text += "[/p]" label.text += "[/p]"
max_lines = float(label.get_line_count()) max_lines = float(label.get_line_count())
func try_scroll(): func try_scroll():
var forward_target: int var forward_target: int
#print( "max lines: " + str(max_lines)) #print( "max lines: " + str(max_lines))
#print( "current lines: " + str(label.get_character_line(label.visible_characters))) #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 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("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 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: 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 forward_target = scroll_container.scroll_vertical + scroll_container.size.y * 0.8
else: else:
forward_target = label.size.y - scroll_container.size.y forward_target = label.size.y - scroll_container.size.y
if scroll_target != null: if scroll_target != null:
var tween: Tween = get_tree().create_tween() var tween: Tween = get_tree().create_tween()
##tween.set_trans() ##tween.set_trans()
@ -117,38 +117,38 @@ func try_scroll():
func play_scene(): func play_scene():
scroll_target = 0 scroll_target = 0
# FIXME: find out why this needs to be set to prevent scenes from being fully revealed # FIXME: find out why this needs to be set to prevent scenes from being fully revealed
all_text_revealed = false all_text_revealed = false
animation_complete = false animation_complete = false
match State.speech_language: match State.speech_language:
2: 2:
animation_player.queue("de") animation_player.queue("de")
_: _:
animation_player.queue("en") animation_player.queue("en")
if name == "draven": if name == "draven":
await get_tree().process_frame await get_tree().process_frame
await get_tree().process_frame await get_tree().process_frame
$AnimationPlayer/Music.play() $AnimationPlayer/Music.play()
await text_finished await text_finished
if name == "draven": if name == "draven":
trigger_intro() trigger_intro()
animation_complete = true animation_complete = true
all_text_revealed = true all_text_revealed = true
skip_control.start_proceed_countdown() skip_control.start_proceed_countdown()
await skip_control.proceed await skip_control.proceed
animation_player.play("vanish") animation_player.play("vanish")
await animation_player.animation_finished await animation_player.animation_finished
finished.emit() finished.emit()
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:

View File

@ -17,7 +17,7 @@ func start_room():
func pull_save_state(save: SaveGame) -> void: func pull_save_state(save: SaveGame) -> void:
pass pass
func save_room(): func save_room():
pull_save_state(save_game) pull_save_state(save_game)
save_game.save_to_file(get_tree().root.get_texture()) save_game.save_to_file(get_tree().root.get_texture())

View File

@ -51,7 +51,7 @@ var _is_initialised: bool = false
@export var save_manually: bool = false: @export var save_manually: bool = false:
set(val): set(val):
if val: save_to_file(thumbnail) if val: save_to_file(thumbnail)
func _validate_property(property: Dictionary): func _validate_property(property: Dictionary):
if property.name == filepath: if property.name == filepath:
property.usage |= PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED property.usage |= PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED
@ -72,7 +72,7 @@ func _init(initial_filepath = "") -> void:
unique_save_name = initial_filepath.get_file() unique_save_name = initial_filepath.get_file()
read_save_file() read_save_file()
_is_initialised = true _is_initialised = true
if not DirAccess.dir_exists_absolute(filepath.get_base_dir()): if not DirAccess.dir_exists_absolute(filepath.get_base_dir()):
DirAccess.make_dir_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) var raw_json = FileAccess.get_file_as_string(filepath)
file.close() file.close()
var parsed: Dictionary = JSON.parse_string(raw_json) var parsed: Dictionary = JSON.parse_string(raw_json)
var tmp_img: Image var tmp_img: Image
if FileAccess.file_exists("%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name]): 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]) tmp_img = Image.load_from_file("%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name])
var are_types_valid = ( var are_types_valid = (
parsed["unique_save_name"] is String and parsed["unique_save_name"] is String and
parsed["current_room"] is float and parsed["current_room"] is float and
@ -107,34 +107,34 @@ func read_save_file():
parsed["last_saved"] is float# and FIXME parsed["last_saved"] is float# and FIXME
#parsed["demo"] is bool and last_saved != 0 #parsed["demo"] is bool and last_saved != 0
) )
if are_types_valid: if are_types_valid:
for key in parsed.keys(): for key in parsed.keys():
set(key, parsed[key]) set(key, parsed[key])
for dict:Dictionary in [board_state["cards"], board_state["stickies"]]: for dict:Dictionary in [board_state["cards"], board_state["stickies"]]:
for key in dict.keys(): for key in dict.keys():
if dict[key] is String: if dict[key] is String:
if dict[key].begins_with("("): if dict[key].begins_with("("):
dict[key] = parse_vec_from_string(dict[key]) dict[key] = parse_vec_from_string(dict[key])
var cards: Dictionary[StringName, Variant] var cards: Dictionary[StringName, Variant]
var stickies: Dictionary[StringName, Variant] var stickies: Dictionary[StringName, Variant]
var randoms: Array[StringName] var randoms: Array[StringName]
for cardname:String in board_state["cards"]: for cardname:String in board_state["cards"]:
cards[StringName(cardname)] = board_state["cards"][cardname] cards[StringName(cardname)] = board_state["cards"][cardname]
for sticky_name:String in board_state["stickies"]: for sticky_name:String in board_state["stickies"]:
stickies[StringName(sticky_name)] = board_state["stickies"][sticky_name] stickies[StringName(sticky_name)] = board_state["stickies"][sticky_name]
for random_name:StringName in board_state["randoms"]: for random_name:StringName in board_state["randoms"]:
randoms.append( random_name ) randoms.append( random_name )
board_state = { board_state = {
"cards": cards, "cards": cards,
"stickies": stickies, "stickies": stickies,
"randoms": randoms "randoms": randoms
} }
is_valid = are_types_valid \ is_valid = are_types_valid \
and current_room >= 0 \ and current_room >= 0 \
and current_room < State.rooms.keys().size() \ and current_room < State.rooms.keys().size() \
@ -142,7 +142,7 @@ func read_save_file():
if not is_valid: if not is_valid:
push_error("Parsing of Save failed.") push_error("Parsing of Save failed.")
if tmp_img != null: if tmp_img != null:
thumbnail = ImageTexture.create_from_image(tmp_img) thumbnail = ImageTexture.create_from_image(tmp_img)
is_empty = false is_empty = false
@ -167,29 +167,29 @@ func save_to_file(current_screen: Texture):
if filepath == "DEBUG": if filepath == "DEBUG":
push_warning("Saving DEBUG save skipped. This is intentional.") push_warning("Saving DEBUG save skipped. This is intentional.")
return return
if current_room == State.rooms.NULL: if current_room == State.rooms.NULL:
print("Not saving empty savegame.") print("Not saving empty savegame.")
return return
last_saved = Time.get_unix_time_from_system() last_saved = Time.get_unix_time_from_system()
var thumbnail_image: Image = current_screen.get_image() var thumbnail_image: Image = current_screen.get_image()
thumbnail_image.convert(Image.Format.FORMAT_RGB8) thumbnail_image.convert(Image.Format.FORMAT_RGB8)
thumbnail_image.linear_to_srgb() thumbnail_image.linear_to_srgb()
thumbnail_image.resize(384, 261, Image.INTERPOLATE_LANCZOS) # nonexistent call in ViewportTexturew 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 thumbnail_path: String = "%s/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name]
var save_dir = DirAccess.open(filepath.get_base_dir()) var save_dir = DirAccess.open(filepath.get_base_dir())
if not save_dir.dir_exists("thumbnails"): if not save_dir.dir_exists("thumbnails"):
save_dir.make_dir("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/thumbnails/%s.png" % [filepath.get_base_dir(), unique_save_name])
#thumbnail_image.save_png("%s/test.png" % State.user_saves_path) #thumbnail_image.save_png("%s/test.png" % State.user_saves_path)
print(filepath.get_base_dir()) print(filepath.get_base_dir())
var file = FileAccess.open(filepath, FileAccess.WRITE) var file = FileAccess.open(filepath, FileAccess.WRITE)
file.store_string(JSON.stringify(_get_save_dict())) file.store_string(JSON.stringify(_get_save_dict()))
file.close() file.close()
func calculate_completed_sequences() -> int: func calculate_completed_sequences() -> int:
var i: int = mementos_complete - ((mementos_complete >> 1) & 0x55555555); var i: int = mementos_complete - ((mementos_complete >> 1) & 0x55555555);
@ -200,10 +200,10 @@ func calculate_completed_sequences() -> int:
func calculate_total_connections() -> int: func calculate_total_connections() -> int:
var connections:= 0 var connections:= 0
for sticky_position in board_state.stickies.values(): for sticky_position in board_state.stickies.values():
connections += int(sticky_position is String) connections += int(sticky_position is String)
return connections return connections
func validate_board_state() -> bool: 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)): 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.") push_error("Save %s could not be parsed: Corrupted Sticky Notes.")
return false return false
return true return true
return false return false
func parse_vec_from_string(string: String) -> Vector2: func parse_vec_from_string(string: String) -> Vector2:

View File

@ -11,7 +11,7 @@ enum {
DONE DONE
} }
var has_stage = false: var has_stage = false:
set(focus): set(focus):
if not focus == has_stage: if not focus == has_stage:
if focus: if focus:
@ -23,14 +23,14 @@ var has_stage = false:
self.hide() self.hide()
process_mode = Node.PROCESS_MODE_DISABLED process_mode = Node.PROCESS_MODE_DISABLED
has_stage = focus has_stage = focus
var _input_locked = true var _input_locked = true
var selection_state = INI: var selection_state = INI:
set(state): set(state):
print("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
_input_locked = !(state == CARDS or state == POSTS) _input_locked = !(state == CARDS or state == POSTS)
if state == CARDS_SELECTED: if state == CARDS_SELECTED:
var tween = get_tree().create_tween() var tween = get_tree().create_tween()
tween.tween_property($thought_prompt, "modulate", Color(1, 1, 1, 0), 0.5) 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): set(new_id):
if selection_state == CARDS or selection_state == POSTS: if selection_state == CARDS or selection_state == POSTS:
if not curr_selection_id == -1: options[curr_selection_id].highlighted = false if not curr_selection_id == -1: options[curr_selection_id].highlighted = false
if new_id > options.size() -1: curr_selection_id = 0 if new_id > options.size() -1: curr_selection_id = 0
elif new_id < 0: curr_selection_id = options.size() - 1 elif new_id < 0: curr_selection_id = options.size() - 1
else: curr_selection_id = new_id else: curr_selection_id = new_id
options[curr_selection_id].highlighted = true options[curr_selection_id].highlighted = true
else: else:
curr_selection_id = new_id 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
#FIXME: can I make this less annoying somehow? #FIXME: can I make this less annoying somehow?
if State.onready_room == State.rooms.YOUTH: if State.onready_room == State.rooms.YOUTH:
Scenes.sign_up_for_sequence(pick_cards, Scenes.id.YOUTH_DRAEVEN, 2) Scenes.sign_up_for_sequence(pick_cards, Scenes.id.YOUTH_DRAEVEN, 2)
@ -76,13 +76,13 @@ func _ready():
else: else:
return return
assert(false) assert(false)
if get_tree().root == self.get_parent(): if get_tree().root == self.get_parent():
pick_cards(3, false) pick_cards(3, false)
State.take_stage(self) State.take_stage(self)
reset() reset()
func reset(): func reset():
card_anim_skipped = false card_anim_skipped = false
output = [] output = []
@ -97,7 +97,7 @@ func reset():
func fill_card_slots(id: int): func fill_card_slots(id: int):
var new_cards = HardCards.get_cards_by_scene_id(id) var new_cards = HardCards.get_cards_by_scene_id(id)
for i in range(new_cards.size()): for i in range(new_cards.size()):
$cards.get_child(i).remove_child($cards.get_child(i).get_child(1)) $cards.get_child(i).remove_child($cards.get_child(i).get_child(1))
var new_card:Card = new_cards[i] var new_card:Card = new_cards[i]
@ -113,15 +113,15 @@ func fill_post_slots():
var sticky_notes: Array[StickyNote] = [] var sticky_notes: Array[StickyNote] = []
for card: Card in output: for card: Card in output:
sticky_notes.append_array(HardCards.get_children_of(card.card_id)) sticky_notes.append_array(HardCards.get_children_of(card.card_id))
for note:StickyNote in sticky_notes: for note:StickyNote in sticky_notes:
note.current_handle = self note.current_handle = self
sticky_notes.shuffle() sticky_notes.shuffle()
options = [] options = []
for ancor in $sticky_notes.get_children(): for ancor in $sticky_notes.get_children():
ancor.remove_child(ancor.get_child(1)) ancor.remove_child(ancor.get_child(1))
for i in range(sticky_notes.size()): for i in range(sticky_notes.size()):
options.append(sticky_notes[i]) options.append(sticky_notes[i])
$sticky_notes.get_child(i).add_child(options[i], false) $sticky_notes.get_child(i).add_child(options[i], false)
@ -137,7 +137,7 @@ func _input(event):
#if event.is_action_pressed("ui_end"): #if event.is_action_pressed("ui_end"):
# fill_card_slots(3) # fill_card_slots(3)
# selection_state = CARDS # selection_state = CARDS
if has_stage: if has_stage:
if not _input_locked: if not _input_locked:
if not on_cooldown: if not on_cooldown:
@ -148,7 +148,7 @@ func _input(event):
on_cooldown = true on_cooldown = true
await get_tree().create_timer(0.1).timeout await get_tree().create_timer(0.1).timeout
on_cooldown = false on_cooldown = false
if event.is_action_pressed("ui_accept"): if event.is_action_pressed("ui_accept"):
pick(curr_selection_id) pick(curr_selection_id)
elif event.is_action_pressed("skip"): elif event.is_action_pressed("skip"):
@ -169,27 +169,27 @@ func _input(event):
transition() transition()
elif selection_state == TRANSITION: elif selection_state == TRANSITION:
show_posts() show_posts()
func pick(id: int): func pick(id: int):
print("%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
if selection_state == CARDS: if selection_state == CARDS:
selection_state = CARDS_SELECTED selection_state = CARDS_SELECTED
elif selection_state == POSTS: elif selection_state == POSTS:
selection_state = POSTS_SELECTED selection_state = POSTS_SELECTED
anim_players[id].play("pick") anim_players[id].play("pick")
picked_player = anim_players[id] picked_player = anim_players[id]
var yield_to = anim_players[id].animation_finished var yield_to = anim_players[id].animation_finished
output.append(options[id]) output.append(options[id])
options.remove_at(id) options.remove_at(id)
anim_players.remove_at(id) anim_players.remove_at(id)
var parent_id:StringName var parent_id:StringName
if selection_state == POSTS_SELECTED: if selection_state == POSTS_SELECTED:
parent_id = output[-1].parent_id parent_id = output[-1].parent_id
@ -201,8 +201,8 @@ func pick(id: int):
anim_players.remove_at(i) anim_players.remove_at(i)
print("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("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()
@ -213,14 +213,14 @@ func pick(id: int):
if Steamworks.has_initialized: if Steamworks.has_initialized:
Steam.setAchievement("FIGHT_BACK") Steam.setAchievement("FIGHT_BACK")
Steam.storeStats() Steam.storeStats()
output.append(options.pop_at(winning_id)) output.append(options.pop_at(winning_id))
random_player = anim_players[winning_id] random_player = anim_players[winning_id]
anim_players.pop_at(winning_id).play("shuffle") anim_players.pop_at(winning_id).play("shuffle")
for anim in anim_players: for anim in anim_players:
anim.play("unshuffle") anim.play("unshuffle")
await yield_to await yield_to
if not card_anim_skipped: transition() if not card_anim_skipped: transition()
@ -234,9 +234,9 @@ func transition():
anim_players.append(control.get_child(0)) anim_players.append(control.get_child(0))
control.get_child(0).play("post") control.get_child(0).play("post")
curr_selection_id = -1 curr_selection_id = -1
fill_post_slots() fill_post_slots()
await anim_players[0].animation_finished await anim_players[0].animation_finished
if selection_state != POSTS: if selection_state != POSTS:
show_posts() show_posts()
@ -253,7 +253,7 @@ func show_posts():
player.play("RESET") player.play("RESET")
await get_tree().create_timer(.5).timeout await get_tree().create_timer(.5).timeout
selection_state = POSTS selection_state = POSTS
func handle_hover(new_highlight): func handle_hover(new_highlight):
if not _input_locked: if not _input_locked:
@ -276,7 +276,7 @@ func pick_cards(id: int, repeat: bool):
selection_state = CARDS selection_state = CARDS
if id == Scenes.id.YOUTH_DRAEVEN and not repeat: if id == Scenes.id.YOUTH_DRAEVEN and not repeat:
$Meaning.play() $Meaning.play()
else: else:
Scenes.end_current_sequence() Scenes.end_current_sequence()

View File

@ -55,7 +55,7 @@ func _ready() -> void:
settings_button.pressed.connect(settings_popup.show_settings) settings_button.pressed.connect(settings_popup.show_settings)
quit_button.pressed.connect(get_tree().quit) quit_button.pressed.connect(get_tree().quit)
credits_button.pressed.connect(roll_credits.emit) credits_button.pressed.connect(roll_credits.emit)
State.take_stage(self) State.take_stage(self)
func _on_save_picked(save: SaveGame): func _on_save_picked(save: SaveGame):

View File

@ -39,28 +39,28 @@ func load_games():
saves = [] saves = []
var save_game_dir := DirAccess.open(State.user_saves_path) var save_game_dir := DirAccess.open(State.user_saves_path)
var filepaths: PackedStringArray = save_game_dir.get_files() var filepaths: PackedStringArray = save_game_dir.get_files()
for path in filepaths: for path in filepaths:
if path.ends_with(".json"): if path.ends_with(".json"):
saves.append(SaveGame.new("%s/%s" % [State.user_saves_path, path.get_basename()])) saves.append(SaveGame.new("%s/%s" % [State.user_saves_path, path.get_basename()]))
saves.append(SaveGame.new()) saves.append(SaveGame.new())
#purging the current state #purging the current state
save_buttons = [] save_buttons = []
if scroll_container != null: if scroll_container != null:
scroll_container.queue_free() scroll_container.queue_free()
scroll_container = ScrollContainer.new() scroll_container = ScrollContainer.new()
scroll_container.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED 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) scroll_container.custom_minimum_size = Vector2(0, ProjectSettings.get_setting("display/window/size/viewport_height") - 256)
add_child(scroll_container) add_child(scroll_container)
var save_box := VBoxContainer.new() var save_box := VBoxContainer.new()
save_box.add_theme_constant_override("separation", 16) save_box.add_theme_constant_override("separation", 16)
scroll_container.add_child(save_box) scroll_container.add_child(save_box)
for i in range(saves.size()): for i in range(saves.size()):
var new_button := SaveGameDisplay.new(saves[i], i+1) var new_button := SaveGameDisplay.new(saves[i], i+1)
save_box.add_child(new_button) save_box.add_child(new_button)
@ -73,7 +73,7 @@ func _on_game_picked(id: int):
picked.emit(id) picked.emit(id)
else: else:
$Popup.show() $Popup.show()
else: else:
picked.emit(id) 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: if saves[i].last_saved > most_recent_time and not saves[i].current_room == 0:
most_recent_index = i most_recent_index = i
most_recent_time = saves[i].last_saved most_recent_time = saves[i].last_saved
return saves[most_recent_index] if most_recent_time > 0 else SaveGame.new() return saves[most_recent_index] if most_recent_time > 0 else SaveGame.new()
func has_existing_saves() -> bool: func has_existing_saves() -> bool:
return saves.size() > 1 return saves.size() > 1

View File

@ -35,9 +35,8 @@ gdscript/warnings/native_method_override=0
[display] [display]
window/size/viewport_width=1920 window/size/viewport_width=1600
window/size/viewport_height=1080 window/size/viewport_height=900
window/size/mode=3
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/aspect="expand" window/stretch/aspect="expand"
display_server/driver.linuxbsd="wayland" display_server/driver.linuxbsd="wayland"

View File

@ -19,7 +19,7 @@ var settings_initialised
screen_reader_enabled = value screen_reader_enabled = value
if settings_initialised: if settings_initialised:
settings_changed.emit() settings_changed.emit()
@export var rendering_disabled: bool = false: @export var rendering_disabled: bool = false:
set(value): set(value):
rendering_disabled = value rendering_disabled = value
@ -154,13 +154,13 @@ signal theme_changed
func load_user_settings(): func load_user_settings():
if FileAccess.file_exists(user_settings_path): if FileAccess.file_exists(user_settings_path):
var file = FileAccess.open(user_settings_path, FileAccess.READ) var file = FileAccess.open(user_settings_path, FileAccess.READ)
var raw_json = FileAccess.get_file_as_string(user_settings_path) var raw_json = FileAccess.get_file_as_string(user_settings_path)
file.close() file.close()
var parsed: Dictionary = JSON.parse_string(raw_json) var parsed: Dictionary = JSON.parse_string(raw_json)
for kategory in parsed.values(): for kategory in parsed.values():
for key in kategory.keys(): for key in kategory.keys():
if key in self: 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) OS.execute("defaults", ["read", "/Users/$loggedInUser/Library/Preferences/com.apple.universalaccess.plist", "reduceMotion"], out)
if out[0] == "reduce": if out[0] == "reduce":
reduce_motion = true reduce_motion = true
settings_initialised = true settings_initialised = true
settings_changed.emit() settings_changed.emit()
@ -214,11 +214,11 @@ func save_settings():
"obscure_logs": obscure_logs "obscure_logs": obscure_logs
} }
} }
var file = FileAccess.open(user_settings_path, FileAccess.WRITE) var file = FileAccess.open(user_settings_path, FileAccess.WRITE)
file.store_string(JSON.stringify(out_dict)) file.store_string(JSON.stringify(out_dict))
file.close() file.close()
settings_initialised = true settings_initialised = true
settings_changed.emit() 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 #FIXME this can be removed when state no longer needs to be a tool
if not Engine.is_editor_hint(): if not Engine.is_editor_hint():
if event.is_action_pressed("toggle_fullscreen"): if event.is_action_pressed("toggle_fullscreen"):
# I have no idea why I wrote thit as conviluted, # I have no idea why I wrote thit as conviluted,
# but it works(TM) so I am not gonna change it :D # but it works(TM) so I am not gonna change it :D
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
@ -250,7 +250,7 @@ func _ready():
pass_stage_to(child) pass_stage_to(child)
break break
music_volume = music_volume music_volume = music_volume
#region focus handling (called staging to avoid name colisions) #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. # Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
func leave_stage(actor:Object) -> bool: func leave_stage(actor:Object) -> bool:
if stage_list[0] == actor: if stage_list[0] == actor:
actor.has_stage = false actor.has_stage = false
focus_locked = false focus_locked = false
stage_list.erase(actor) stage_list.erase(actor)
if stage_list != []: if stage_list != []:
stage_list.front().has_stage = true stage_list.front().has_stage = true
else: else:
get_tree().quit() get_tree().quit()
return false return false
func get_current_actor(): return stage_list.front() func get_current_actor(): return stage_list.front()
# Used to put a new target on top of the Focus Stack. # Used to put a new target on top of the Focus Stack.

View File

@ -51,21 +51,21 @@ func start_sequence(index: id):
func continue_sequence(former_actor: Object): func continue_sequence(former_actor: Object):
# if this fails, pass next was called without a sequencce having been started. # if this fails, pass next was called without a sequencce having been started.
assert(current_sequence != -1) assert(current_sequence != -1)
if former_actor == State.stage_list[0] and former_actor == sequence_actors[current_sequence][current_sequence_index].get_object(): if former_actor == State.stage_list[0] and former_actor == sequence_actors[current_sequence][current_sequence_index].get_object():
former_actor.has_stage = false former_actor.has_stage = false
current_sequence_index += 1 current_sequence_index += 1
State.stage_list[0] = sequence_actors[current_sequence][current_sequence_index].get_object() 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(sequence_actors[current_sequence][current_sequence_index].get_object().name)
State.stage_list[0].has_stage = true State.stage_list[0].has_stage = true
sequence_actors[current_sequence][current_sequence_index].call(current_sequence, is_sequence_repeating(current_sequence)) 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)) scene_continuing.emit(current_sequence, current_sequence_index, is_sequence_repeating(current_sequence))
func end_current_sequence(): func end_current_sequence():
State.leave_stage(State.stage_list[0]) State.leave_stage(State.stage_list[0])
scene_finished.emit(current_sequence, is_sequence_repeating(current_sequence)) scene_finished.emit(current_sequence, is_sequence_repeating(current_sequence))