Keep world markers over their target at game resolutions of another shape than 16:9

The wide and tall UI overlays scale each layout's root pane on the stretched axis. The lock-on arrow, the name label
of the item or character in front of Link, enemy life bars and notices, and speech balloons are moved in code to the
target's projected position on a pane under that root, so the position was scaled as well: on 32:9 these markers sat
at half their distance from the middle of the screen, short of what they point at.

Those four layouts keep their root at scale 1 and give the scale to the panes under it that the code does not move and
no animation scales, so the markers land on their target and keep their 16:9 proportions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Takeya SaitoandClaude Opus 5.5 committed 2026-11-02 12:46:20 +00:00
1 parent 49c19b20d0
commit 4933725112
1 file changed
+23 -2
+23 -2
View File
@@ -22,6 +22,19 @@ FIELD = {'x': 44, 'y': 48, 'scale_x': 68, 'scale_y': 72}
KEEP_ROOT = {'AppMenuBG_00', 'PauseMenuBG_00', 'ShopMenuParasailBG_00', 'ShortCutBG_00', 'TitleMenuBG_00', 'EventFade_00',
'EventFadeWipe_00', 'CameraShutter_00', 'PaAppPictureBookDetail_00', 'AppMenuOverlay_00'}
# Layouts whose markers the game places over a point in the world (the lock-on arrow, the name of the item or character
# in front of Link, enemy life bars and notices, speech balloons): the code moves a pane under the root to the target's
# projected position in the 1920x1080 grid, which spans the whole canvas. Under a scaled root that position would be
# scaled too, so the marker lands short of its target, toward the middle of the screen (at half the distance on 32:9).
# Their root keeps scale 1 and the scale goes one level down instead, to the panes listed here: ones the code does not
# move and no animation scales, so the markers keep their 16:9 proportions.
MARKER_ROOT = {
'AttentionBalloon_00': ('C_Capture_00', 'N_InOut_00'), # N_PosRoot_00 moves; N_InOut_00 animates y and alpha
'AttentionLockOn_00': ('N_Offset_00',), # N_PosRoot_00 moves; N_Offset_00 animates y
'EnemyInfo_00': ('Pa_EnemyLife_00', 'Pa_EnemyNotice_00'), # the parts move; N_EnemyLifeArea_* stay screen-sized
'BalloonMessage_00': ('Pa_BalloonMessage_00',),
}
def edits(k, hud_corner):
"""(layout, pane, field, value) for the aspect: k = 16/9 over the aspect (the root's scale), w = how far a 1920-wide
layout's edge moves out in its own units (960 * (1 / k - 1)). OFF moves a pane out of sight."""
@@ -222,8 +235,8 @@ def apply(blarc, members, width, height, hud_corner=True):
assert k < 1, 'only for canvases of another shape than 16:9'
root_scale = 'scale_x' if wide else 'scale_y'
changed, layouts = set(), {}
unknown = sorted(n for n in KEEP_ROOT if f'blyt/{n}.bflyt' not in members)
if unknown: raise SystemExit(f'KEEP_ROOT names no layout: {unknown}')
unknown = sorted(n for n in KEEP_ROOT | MARKER_ROOT.keys() if f'blyt/{n}.bflyt' not in members)
if unknown: raise SystemExit(f'KEEP_ROOT or MARKER_ROOT names no layout: {unknown}')
def pane_offset(layout, pane):
member = f'blyt/{layout}.bflyt'
if member not in members: raise SystemExit(f'{layout}: no layout {member} in the archive')
@@ -232,6 +245,14 @@ def apply(blarc, members, width, height, hud_corner=True):
return find_pane(layouts[member], layout, pane)
for member in sorted(m for m in members if m.startswith('blyt/') and m.endswith('.bflyt')):
if member[5:-6] in KEEP_ROOT: continue
if member[5:-6] in MARKER_ROOT: # the root stays at 1, its listed panes take the scale
layout = member[5:-6]
for pane in ('RootPane',) + MARKER_ROOT[layout]:
at = pane_offset(layout, pane) + FIELD[root_scale]
have = struct.unpack_from('<f', blarc, at)[0]
if abs(have - 1.0) > 1e-3: raise SystemExit(f'{layout} {pane} {root_scale}: {have}, expected 1.0')
if pane != 'RootPane': struct.pack_into('<f', blarc, at, k)
continue
at = pane_offset(member[5:-6], 'RootPane') + FIELD[root_scale]
have = struct.unpack_from('<f', blarc, at)[0]
if abs(have - 1.0) > 1e-3: raise SystemExit(f'{member[5:-6]} RootPane {root_scale}: {have}, expected 1.0')