feat: UI LAYOUT option, centered by default

Edge docking and zoom-linked UI scaling shipped as unconditional
behaviour. Both are departures from how the port composed the screen, so
they become a setting instead: UI LAYOUT = CENTERED (the default) or
DYNAMIC.

CENTERED is a fixed letterbox. Elements stay where they were drawn in the
160x144 canvas, and the UI does not follow the survey zoom, so screen
furniture neither moves nor resizes under the player. That is what the
pre-anchoring builds did. DYNAMIC is the current behaviour, unchanged.

Both halves matter together: gating only the anchoring would stop the
dialogue box moving but leave it resizing with the zoom, which is the same
complaint in a different form.

Gated at Renderer:setUIAnchor and Renderer:uiScale rather than at each
caller, so one switch covers the dialogue box, its YES/NO, the START menu
and anything anchored later, and no caller knows the option exists.
Game.dynamicUI answers true only for an explicit "dynamic", so a save
written before this keeps the layout it already had.

Independent of it, deliberately: BATTLE SIZE still works under either mode
(uiFill overrides the scale later, in endFrame), and a battle still holds
its own prompts inside its screen under DYNAMIC.

Also includes the Oak intro fix (previously #674): the speech fills white
over the UI canvas while its dialogue box docks to the window edge, so
under DYNAMIC black showed between the two. letterboxWhite closes it, and
the shrink beat's replica box rides the same anchor as the real box it
stands in for.
This commit is contained in:
spiritsnails
2026-08-02 10:47:27 -06:00
parent 0f45bb5792
commit fe7dcf33ec
8 changed files with 319 additions and 0 deletions
+16
View File
@@ -315,6 +315,15 @@ end
-- everything else here: the text box and YES/NO a battle puts up are states
-- of their own sitting above it, and they are exactly the elements that must
-- stay inside the battle's composition rather than dock to the window.
-- UI LAYOUT: is edge docking switched on? Only the explicit "dynamic" turns
-- it on, so a save written before the option existed -- and any caller with no
-- save at all, which is most of the headless suites -- gets CENTERED, the
-- behaviour the port shipped with.
function Game.dynamicUI(save)
local options = save and save.options
return options ~= nil and options.uiLayout == "dynamic"
end
function Game.uiAnchorsHeldInStack(stack)
for i = #(stack and stack.states or {}), 1, -1 do
local state = stack.states[i]
@@ -415,6 +424,13 @@ function Game:draw()
Renderer.uiWorldHold = Renderer.battleDim ~= nil
-- ...and a battle keeps its dialogue box and YES/NO inside its own screen
-- instead of letting them dock to the window edge.
-- UI LAYOUT: CENTERED (the default) is a fixed letterbox -- every element
-- stays inside the 160x144 canvas and the UI does not follow the survey
-- zoom, so the screen furniture never moves or resizes under the player.
-- That is the composition the port shipped with. DYNAMIC opts into both
-- halves: the dialogue box docks to the window's bottom edge, the START
-- menu to its top right, and the whole UI steps down with the zoom.
Renderer.uiCentered = not Game.dynamicUI(self.save)
Renderer.uiAnchorHold = Game.uiAnchorsHeldInStack(self.stack)
Renderer:beginFrame(worldBelow)
for i = drawFrom, #self.stack.states do
+9
View File
@@ -228,6 +228,15 @@ function SaveData.defaultOptions()
-- "black" = plain black bars, "world" = the frozen overworld showing
-- through, dimmed. See BattleState:bgMode.
battleBg = "white",
-- UI LAYOUT: "centered" = a fixed letterbox. Every element sits where it
-- was drawn in the 160x144 canvas and the UI does not follow the survey
-- zoom, so nothing moves or resizes under the player. The original
-- composition. "dynamic" = the dialogue box docks to the window's bottom
-- edge, the START menu to its top right, and the UI steps down with the
-- zoom. Centered is the default: dynamic reads better zoomed out, but it
-- moves the screen furniture, so it is opt-in.
-- See Game.dynamicUI, Renderer:setUIAnchor and Renderer:uiScale.
uiLayout = "centered",
ruleset = "gen1_faithful",
-- 0-7 like the GB's NR50 master volume
musicVol = 7,