From 25c918e6a229b844ff6cf8bf042961ff22c4bc19 Mon Sep 17 00:00:00 2001 From: Ratdoku Builder Date: Sat, 5 Dec 2026 17:10:37 -0600 Subject: [PATCH] feat: guest-of-day mascot and Windows export preset The Home mascot now features a deterministic guest of the day, tap-cycles unlocked guests with a story teaser, and scales cleanly at large text sizes. Screens stay centered at 360dp on wide aspect ratios. Adds a Windows Desktop export preset. --- CHANGELOG.md | 1 + export_presets.cfg | 30 +++++++++++++ scripts/Home.gd | 109 +++++++++++++++++++++++++++++++++++++-------- scripts/Main.gd | 16 ++++++- tools/qa_ui.gd | 15 ++++++- 5 files changed, 149 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42fb39c..bb64c6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable alpha milestones for Ratdoku. - Added a 100/115/130% text size setting that applies live, plus an Android haptics toggle. - Difficulty now opens a picker with plain-language Zen / Easy / Normal descriptions instead of cycling inline. - Added six repeating cozy hotel events with a Home banner, event detail, daily-room goal, and a claimable cosmetic gift and frame. +- The Home mascot now shows a deterministic guest of the day; tapping cycles through unlocked guests with a story teaser. - Added Free play with 30 deterministic symmetry variants of the verified boards; it never writes progress, unlocks, achievements, or guest stories. - Save format is now v7 with guest notes and event state; existing saves migrate automatically. - Full QA is 9/9 stages, including the free-play uniqueness suite and Android build. diff --git a/export_presets.cfg b/export_presets.cfg index d249392..2fafcec 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -59,3 +59,33 @@ apk_expansion/enable=false apk_expansion/SALT="" apk_expansion/public_key="" permissions/custom_permissions=PackedStringArray() + +[preset.1] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="data/*.json" +exclude_filter="art/guests/source/*" +export_path="build/Ratdoku.exe" +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +binary_format/architecture="x86_64" +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false diff --git a/scripts/Home.gd b/scripts/Home.gd index a5bd720..f36f114 100644 --- a/scripts/Home.gd +++ b/scripts/Home.gd @@ -24,6 +24,11 @@ var event_progress: Label var event_claim: Button var mascot_card: PanelContainer var mascot_art: Control +var mascot_button: Button +var mascot_note: Label +var mascot_id := "" +var mascot_art_id := "" +var mascot_cycling := false var avatar_holder: CenterContainer var avatar_frame_id := "" var avatar_portrait_id := "" @@ -116,14 +121,23 @@ func _ready() -> void: var card := UI.panel(Palette.CREAM, 26, 12) mascot_card = card card.size_flags_horizontal = Control.SIZE_SHRINK_CENTER - var mascot := _make_mascot() + var mascot := _make_mascot("crumb") mascot_art = mascot + mascot_art.mouse_filter = Control.MOUSE_FILTER_IGNORE card.add_child(mascot) + mascot_button = Button.new() + mascot_button.flat = true + mascot_button.mouse_filter = Control.MOUSE_FILTER_STOP + mascot_button.pressed.connect(_on_mascot_pressed) + mascot_button.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + card.add_child(mascot_button) column.add_child(card) _apply_mascot_scale() mascot_caption = UI.label("Crumb, innkeeper", 12, Palette.MUTED) column.add_child(mascot_caption) + mascot_note = UI.label("Guest of the day · tap to cycle", 10, Palette.MUTED) + column.add_child(mascot_note) hint_label = UI.label(UI.place_hint(), 11, Palette.MUTED) column.add_child(hint_label) @@ -168,10 +182,13 @@ func _apply_mascot_scale() -> void: if mascot_card == null or mascot_art == null: return var scale := UI.ui_scale() - var card_size := int(160 / scale) - var art_size := int(138 / scale) + var card_base := 140 if mascot_cycling else 160 + var art_base := 120 if mascot_cycling else 138 + var card_size := int(card_base / scale) + var art_size := int(art_base / scale) mascot_card.custom_minimum_size = Vector2(card_size, card_size) mascot_art.custom_minimum_size = Vector2(art_size, art_size) + mascot_button.custom_minimum_size = Vector2(card_size, card_size) func _build_event_layer() -> void: @@ -240,15 +257,7 @@ func _claim_event() -> void: func refresh() -> void: hint_label.text = UI.place_hint() _apply_mascot_scale() - var avatar_id := SaveGame.selected_avatar() - if avatar_id == "crumb": - mascot_caption.text = "Crumb, innkeeper" - else: - var guest := Guests.by_id(avatar_id) - mascot_caption.text = "%s · %s" % [ - str(guest.get("name", avatar_id)), - str(guest.get("role", "Guest")) - ] + _refresh_mascot() daily_button.text = _daily_text() var event := SaveGame.current_event() if event.is_empty(): @@ -277,10 +286,10 @@ func refresh() -> void: func _daily_text() -> String: var streak := SaveGame.daily_streak() if SaveGame.daily_completed_today(): - return "Daily done · %d-day streak" % streak + return "Daily done · %dd" % streak if streak > 0: - return "Daily room · %d-day streak" % streak - return "Daily room · start a streak" + return "Daily · %dd streak" % streak + return "Daily room" func _build_avatar() -> void: @@ -311,11 +320,75 @@ func _refresh_avatar() -> void: _build_avatar() -func _make_mascot() -> Control: - if ResourceLoader.exists("res://art/crumb.png"): +func _make_mascot(id: String) -> Control: + var path := "res://art/crumb.png" if id == "crumb" else Guests.portrait(id, "cards") + if ResourceLoader.exists(path): var texture_rect := TextureRect.new() - texture_rect.texture = load("res://art/crumb.png") + texture_rect.texture = load(path) texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED return texture_rect return RatPortrait.new() + + +func _unlocked_mascot_ids() -> Array: + var out: Array = ["crumb"] + for guest in Guests.all(): + var id := str(guest.get("id", "")) + if id != "crumb" and SaveGame.is_guest_unlocked(id): + out.append(id) + return out + + +func _mascot_guest(id: String) -> Dictionary: + if id == "crumb": + return {"name": "Crumb", "role": "Innkeeper", "stories": []} + return Guests.by_id(id) + + +func _on_mascot_pressed() -> void: + var ids := _unlocked_mascot_ids() + if ids.is_empty(): + return + var index := ids.find(mascot_id) + mascot_cycling = true + mascot_id = str(ids[(index + 1) % ids.size()]) + UI.haptic(false) + _refresh_mascot() + + +func _refresh_mascot() -> void: + var ids := _unlocked_mascot_ids() + if ids.is_empty(): + return + if not mascot_cycling: + mascot_id = str(ids[Daily.day_number(Daily.today_key()) % ids.size()]) + elif not ids.has(mascot_id): + mascot_id = str(ids[0]) + + if mascot_art_id != mascot_id: + for child in mascot_card.get_children(): + if child != mascot_button: + mascot_card.remove_child(child) + child.queue_free() + mascot_art = _make_mascot(mascot_id) + mascot_art.mouse_filter = Control.MOUSE_FILTER_IGNORE + mascot_card.add_child(mascot_art) + mascot_button.move_to_front() + mascot_art_id = mascot_id + _apply_mascot_scale() + + var guest := _mascot_guest(mascot_id) + mascot_caption.text = "%s · %s" % [ + str(guest.get("name", mascot_id)), + str(guest.get("role", "Guest")) + ] + if mascot_cycling: + var stories: Array = guest.get("stories", []) + if stories.is_empty(): + mascot_note.text = "Always in · tap to cycle" + else: + var line := str(stories[0]) + mascot_note.text = line if line.length() <= 52 else (line.substr(0, 49) + "…") + else: + mascot_note.text = "Guest of the day · tap to cycle" diff --git a/scripts/Main.gd b/scripts/Main.gd index 80d9414..320f162 100644 --- a/scripts/Main.gd +++ b/scripts/Main.gd @@ -88,7 +88,7 @@ func _ready() -> void: settings_sheet = SettingsSheetScene.instantiate() add_child(settings_sheet) - settings_sheet.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + _center_control(settings_sheet) settings_sheet.visible = false settings_sheet.closed.connect(close_settings) settings_sheet.restart_requested.connect(_on_restart_requested) @@ -149,9 +149,21 @@ func _update_music() -> void: music_player.stop() +## Keep the 360dp design centered on wide screens instead of stretching it. +func _center_control(control: Control) -> void: + control.anchor_left = 0.5 + control.anchor_right = 0.5 + control.anchor_top = 0.0 + control.anchor_bottom = 1.0 + control.offset_left = -180 + control.offset_right = 180 + control.offset_top = 0 + control.offset_bottom = 0 + + func _add_screen(screen: Control) -> void: add_child(screen) - screen.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + _center_control(screen) screen.visible = false diff --git a/tools/qa_ui.gd b/tools/qa_ui.gd index 00eb46a..739ddef 100644 --- a/tools/qa_ui.gd +++ b/tools/qa_ui.gd @@ -67,13 +67,13 @@ func _test_reset_fallback(main, save) -> void: save.save_game() save.progress_changed.emit() await process_frame - _check(main.home.mascot_caption.text.find("Pepper") >= 0, "Home caption should follow the chosen avatar") + _check(main.home.avatar_portrait_id == "pepper", "Home avatar button should follow the chosen avatar") save.reset_progress() await process_frame _check(save.selected_frame() == "plain", "reset should clear a room-locked frame") _check(save.selected_avatar() == "crumb", "reset should clear a locked guest avatar") - _check(main.home.mascot_caption.text.find("Crumb") >= 0, "Home caption should return to Crumb") + _check(main.home.avatar_portrait_id == "crumb", "Home avatar button should return to Crumb") func _test_screen_cycle(main) -> void: @@ -507,6 +507,17 @@ func _test_v09(main, save) -> void: for i in range(4): save.record_guest_visit("pepper") _check(save.story_line_count("pepper") == 3, "seventh visit should reveal the final line") + main.show_screen("home", false) + await process_frame + var mascot_before := str(main.home.mascot_id) + _check(not mascot_before.is_empty(), "Home should show a featured guest") + _check(main.home.mascot_note.text.find("Guest of the day") >= 0, "Home should label the daily guest") + main.home.mascot_button.pressed.emit() + await process_frame + _check(main.home.mascot_cycling, "tapping the mascot should start cycling") + _check(str(main.home.mascot_id) != mascot_before, "tapping should show another guest") + main.show_screen("guest_book", false) + await process_frame main.guest_book._show_detail(Guests.by_id("pepper")) await process_frame _check(main.guest_book.detail_story_box.get_child_count() >= 3, "guest detail should show the story")