CLOSES #455, CLOSES #487, CLOSES #501, CLOSES #540, CLOSES #585, CLOSES #591, CLOSES #593, CLOSES #595, CLOSES #597, CLOSES #599, CLOSES #600, CLOSES #606, CLOSES #607, CLOSES #610, CLOSES #613, CLOSES #616, CLOSES #620, CLOSES #626, CLOSES #632, CLOSES #633, CLOSES #647

This commit is contained in:
bryanthaboi
2026-08-02 08:17:16 -04:00
parent ebbc55c4d0
commit 35b3fa6d9c
87 changed files with 6349 additions and 285 deletions
+20 -1
View File
@@ -33,6 +33,13 @@ local MAX_COLS = 18
-- up: StateStack updates the top state only, so the overworld and its
-- ScriptRunner are frozen underneath (the Pewter JIGGLYPUFF dance drives
-- its spin off it, data/scripts/story5.lua, #249).
-- opts.stay: text that ends in `done` rather than `prompt` returns from
-- PrintText with the box still on screen while the caller keeps running
-- (_ViridianSchoolBlackboardText2, data/text/text_2.asm:646). Such a box
-- waits for nothing, shows no blinking arrow, and never pops itself --
-- whoever pushed it owns the pop. stay.onShown fires once, on the frame
-- the last page finishes typing, which is where the caller pushes whatever
-- goes on top of it (#591).
function TextBox.new(game, text, onDone, opts)
local self = setmetatable({}, TextBox)
self.game = game
@@ -41,6 +48,7 @@ function TextBox.new(game, text, onDone, opts)
self.defaultNo = opts and opts.defaultNo
self.choiceNoSound = opts and opts.noSound
self.auto = opts and opts.auto
self.stay = opts and opts.stay
local box = Theme.textBox or {}
self.boxTx = box.tx or BOX_TX
self.boxTy = box.ty or BOX_TY
@@ -187,6 +195,16 @@ function TextBox:update(dt)
return
end
if self.done then
-- opts.stay: the box is finished but stays up under whatever the caller
-- pushed over it; StateStack updates the top state only, so this runs
-- exactly once (#591)
if self.stay then
if not self.stayShown then
self.stayShown = true
if self.stay.onShown then self.stay.onShown() end
end
return
end
if self.auto then
if not self.autoStarted then
self.autoStarted = true
@@ -356,7 +374,8 @@ function TextBox:draw()
Font.drawCode(code, self.textX + (j - 1) * 8, y)
end
end
if (self.waiting or (self.done and not self.choice and not self.auto))
if (self.waiting or (self.done and not self.choice and not self.auto
and not self.stay))
and self.blink < 30 then
-- page-advance cursor: glyph $EE by default, the blinking down arrow
-- the original prints via `ld a, "▼"` (home/text.asm)