From 78b7d92e934a2e9045bc48dcad5121c02371c77a Mon Sep 17 00:00:00 2001 From: gamer147 Date: Mon, 6 Jul 2026 14:52:40 -0400 Subject: [PATCH] feat(a2a): CJK font for the message window; mark A2a done in the slice plan Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/phase-a-slice-plan.md | 12 ++++++++++++ godot/Main.cs | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/docs/phase-a-slice-plan.md b/docs/phase-a-slice-plan.md index 7692086..be801be 100644 --- a/docs/phase-a-slice-plan.md +++ b/docs/phase-a-slice-plan.md @@ -169,6 +169,18 @@ on-disk `AGF2BMP2AGF.exe`. Resolve just-enough `call-script`/state so the scene' hand-set the preconditions). Deliverable: **the chosen scene playable in Godot** — bg + dialogue + a choice + voice — matching A0's text. +### A2a — Interactive dialogue loop ✅ DONE (2026-07-06) +Godot 4.7 (.NET, `S:/Godot/Godot_v4.7-stable_mono_win64`) project in `godot/` referencing `Age.Engine` +in-process. VM gained one hook (`IHost.WaitForInput`, opcode 0x72); suspend/resume via a worker thread + +blocking `SemaphoreSlim` in `GodotAdvHost`, UI marshalled with `CallDeferred`. Plays SC0000 page-by-page, +pauses at wait-for-input, resumes on click/Enter. **Headless self-test** (`--headless -- --selftest`) +asserts the emitted 186-line offset sequence == `build/vm0-trace.json`; A1 engine tests stay 7/7. +Toolchain: `godot --headless --path godot --import` → `dotnet build godot/Himegari.csproj` → +`godot --headless --path godot [-- --selftest]`. Spec/plan: +`docs/superpowers/{specs,plans}/2026-07-06-a2a-godot-dialogue*.md`. +**Next = A2b:** background via `AGF2BMP2AGF.exe`, `play-voice`/`play-bgm`, choices → VM globals, +just-enough `call-script`/state (unlocks richer scenes). + --- ## Risks / open questions for A0 diff --git a/godot/Main.cs b/godot/Main.cs index 515a0ac..730515b 100644 --- a/godot/Main.cs +++ b/godot/Main.cs @@ -26,6 +26,22 @@ public partial class Main : Godot.Control _status.OffsetLeft = 40; _status.OffsetTop = -60; AddChild(_status); + // Best-effort CJK font so the visual isn't tofu (headless self-test doesn't depend on it). + foreach (var fp in new[] { "C:/Windows/Fonts/YuGothM.ttc", "C:/Windows/Fonts/YuGothR.ttc", + "C:/Windows/Fonts/msgothic.ttc", "C:/Windows/Fonts/meiryo.ttc" }) + { + if (!System.IO.File.Exists(fp)) continue; + try + { + var ff = new FontFile { Data = System.IO.File.ReadAllBytes(fp) }; + _text.AddThemeFontOverride("font", ff); + _status.AddThemeFontOverride("font", ff); + _text.AddThemeFontSizeOverride("font_size", 22); + break; + } + catch { /* fall back to the default font */ } + } + _selftest = System.Array.IndexOf(OS.GetCmdlineUserArgs(), "--selftest") >= 0; var table = OpcodeTableJson.Load(Paths.OpcodesJson);