mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
Fill wide screens with the map and the loading screen instead of black bars
The full map's width was held at 2250 by AppMap_00_MiniMap's size keys (they win over the layout's sizes): wide_anim sets them to 2250 / k, so the map is drawn across a 32:9 screen; the layer tabs and the time and position move to the screen's edges. The loading map is a capture of the 3 x 3 world map tiles of 840 units around the player's tile (TOTK_DUMP: nine 840x840 tile draws into the capture), so a capture wider than about 1680 shows black where the player stands near a tile's edge: loading_map keeps it at most 1660 wide from the screen's left edge, moves the map's slide keys (LoadingFade_00_BarIn and BarOut) with it, and widens the side panel, a window whose frame keeps its proportions, to the screen's right edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66bb3c749a
commit
9932ac2892
2 files changed
+73
-12
No files matched your search
@@ -156,10 +156,12 @@ class RealArchiveTest(unittest.TestCase):
|
||||
ui.apply(full, members, width, height)
|
||||
expected = bytearray(original)
|
||||
baseline['apply'](expected, members, width, height)
|
||||
# The map, the Purah Pad's frame and the loading screen changed on purpose after it (the map and the
|
||||
# loading map fill the screen, the frame keeps its width); every other layout is still byte for byte.
|
||||
for name in ('AppMap_00', 'AppMenuOverlay_00', 'LoadingFade_00'):
|
||||
lo, hi = members[f'blyt/{name}.bflyt']
|
||||
# The map (its layout and the minimap animation's width keys), the Purah Pad's frame and the loading screen
|
||||
# changed on purpose after it (the maps fill the screen, the frame keeps its width); the rest is byte for byte.
|
||||
for member in ('blyt/AppMap_00.bflyt', 'blyt/AppMenuOverlay_00.bflyt', 'blyt/LoadingFade_00.bflyt',
|
||||
'anim/AppMap_00_MiniMap.bflan', 'anim/LoadingFade_00_BarIn.bflan',
|
||||
'anim/LoadingFade_00_BarOut.bflan'):
|
||||
lo, hi = members[member]
|
||||
expected[lo:hi] = full[lo:hi]
|
||||
self.assertEqual(full, expected)
|
||||
for cap, extension in ((16 / 9, 0), (21 / 9, 300)):
|
||||
|
||||
@@ -61,6 +61,22 @@ def hud_extent(k, hud_aspect):
|
||||
inner = 1 / ((16 / 9) / hud_aspect) - 1 # 1 / kc - 1
|
||||
return 960 * inner, 960 * k * inner
|
||||
|
||||
# The loading screen's map is a capture of the world map that the game draws as the 3 x 3 tiles of 840 units around the
|
||||
# player's tile (measured with TOTK_DUMP at 3840x1080: nine 840x840 tile draws into the capture), so only 840 units
|
||||
# either side of the player are certain to hold map; wider, the capture shows black beside the tiles where the player
|
||||
# stands near a tile's edge. At 16:9 it is 1470 wide (the screen's 1920 less 450), its left edge 23 units past the
|
||||
# screen's, and the side panel (a window, so its frame keeps its proportions at any width) covers its right 237 units.
|
||||
LOADING_MAP_MAX = 1660
|
||||
|
||||
def loading_map(k):
|
||||
"""(width, shift, panel width) of the loading screen's map capture and side panel for k = 16:9 over the aspect: the
|
||||
map as wide as the screen allows up to LOADING_MAP_MAX, its left edge where 16:9 has it relative to the screen's
|
||||
edge (shift: how far its centre moves from x -248), and the panel from the map's right part to the screen's edge."""
|
||||
width = min(1920 / k - 450, max(1470, LOADING_MAP_MAX))
|
||||
centre = -960 / k - 23 + width / 2
|
||||
panel = 960 / k - (centre + width / 2 - 237)
|
||||
return width, centre + 248, panel
|
||||
|
||||
def edits(k, hud_aspect):
|
||||
"""(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. hud_aspect: the
|
||||
@@ -72,7 +88,9 @@ def edits(k, hud_aspect):
|
||||
out = [
|
||||
('AppAlbum_00', 'N_FadeInOut_00', 'scale_x', k), ('AppAlbum_00', 'N_Open_01', 'scale_x', wide),
|
||||
*[('AppMap_00', f'N_BlurInOut_0{i}', 'scale_x', wide) for i in range(4)],
|
||||
('AppMap_00', 'N_MiniMap_00', 'x', -270 * (1 - k)),
|
||||
# With the map as wide as the screen, the layer tabs go to its left edge and the time, temperature and
|
||||
# position to its right edge, as at 16:9 (neither position is animated; AppMap_00_MiniMap keys their visibility).
|
||||
('AppMap_00', 'N_MiniMap_00', 'x', -w), ('AppMap_00', 'N_AllMapTime_00', 'x', w),
|
||||
# The map: the panes that cut it out and its black backing are 2250 wide, so under the 16:9 root the world map
|
||||
# ended short of the screen's sides and black bars showed there. They take the screen's width in the root's
|
||||
# units instead (a size, not a scale: the map inside keeps its proportions and more of it shows), and so do the
|
||||
@@ -90,17 +108,17 @@ def edits(k, hud_aspect):
|
||||
('CameraSystemWindow_00', 'T_Text_00', 'scale_x', k),
|
||||
('ChallengeLog_00', 'C_CaptureUp_00', 'x', OFF), ('ChallengeLog_00', 'C_CaptureUp_01', 'x', OFF),
|
||||
('GameOver_00', 'P_BG_00', 'scale_x', wide),
|
||||
# The loading screen: the map on the left runs from the screen's left edge to under the side panel, which stays
|
||||
# at the right edge at its own width. The map's capture panes and their pictures get the wider size (1470 at
|
||||
# 16:9: the screen's 1920 less 450), so more of the map shows instead of a stretched one; the backgrounds and
|
||||
# the bar span the screen.
|
||||
# The loading screen: the map starts at the screen's left edge and the side panel ends at its right edge, each
|
||||
# unstretched. See loading_map for the widths.
|
||||
('LoadingFade_00', 'N_Logo_00', 'x', w),
|
||||
('LoadingFade_00', 'N_Status_00', 'x', w), ('LoadingFade_00', 'N_Tips_00', 'x', -w),
|
||||
('LoadingFade_00', 'P_BG_00', 'scale_x', wide), ('LoadingFade_00', 'P_BG_01', 'scale_x', wide),
|
||||
('LoadingFade_00', 'P_Grid_00', 'scale_x', wide), ('LoadingFade_00', 'P_Bar_00', 'scale_x', wide),
|
||||
*[('LoadingFade_00', pane, 'w', 1920 / k - 450) for pane in ('C_CaptureMap_00', 'C_CaptureMap_01',
|
||||
'P_CaptureMap_00', 'P_CaptureMap_01')],
|
||||
('LoadingFade_00', 'W_SideBGDeco_00', 'x', 960 / k), ('LoadingFade_00', 'P_SideBGDeco_00', 'x', 960 / k),
|
||||
*[('LoadingFade_00', pane, 'w', loading_map(k)[0]) for pane in ('C_CaptureMap_00', 'C_CaptureMap_01',
|
||||
'P_CaptureMap_00', 'P_CaptureMap_01')],
|
||||
('LoadingFade_00', 'N_Map_00', 'x', -248 + loading_map(k)[1]),
|
||||
('LoadingFade_00', 'W_SideBGDeco_00', 'x', 960 / k), ('LoadingFade_00', 'W_SideBGDeco_00', 'w', loading_map(k)[2]),
|
||||
('LoadingFade_00', 'P_SideBGDeco_00', 'x', 960 / k),
|
||||
('MessageLog_01', 'P_Capture_00', 'scale_x', wide), ('OwnedHorseList_00', 'N_BG_00', 'scale_x', wide),
|
||||
('PaCommonBtnTitle_00', 'B_Hit_00', 'x', OFF), ('PaCommonBtnTitle_00', 'N_Cursor_00', 'x', OFF),
|
||||
('PaLargeDungeonMap_00', 'P_BG_00', 'scale_x', wide), ('PaMessageBtn_00', 'B_Hit_00', 'x', OFF),
|
||||
@@ -219,6 +237,45 @@ def anim_keys(blarc, lo, pane, tag, target):
|
||||
pos += size
|
||||
return out
|
||||
|
||||
FLPA_SIZE_X = 8 # BFLAN FLPA target: the pane's width
|
||||
|
||||
# The map's panes that AppMap_00_MiniMap sizes: in the full map they hold the width 2250 in its keys (the minimap
|
||||
# shrinks them), and the animation's keys win over the layout's size, so a wider screen still cut the map at 2250.
|
||||
MAP_SIZED = ('N_IconArea_00', 'N_Cut_00', 'N_Capture_00', 'P_MapCapture_00', 'Black8_01', 'N_Cut_01', 'N_Cut_02')
|
||||
|
||||
def wide_anim(blarc, members, k, changed):
|
||||
"""The animation keys that hold the full map's width, for a canvas wider than 16:9: 2250 becomes 2250 / k, the
|
||||
screen's width in the 16:9 root's units plus the same margin, as edits() does for the layout's sizes."""
|
||||
member = 'anim/AppMap_00_MiniMap.bflan'
|
||||
if member not in members: raise SystemExit(f'AppMap_00_MiniMap: no animation {member} in the archive')
|
||||
lo = members[member][0]
|
||||
if blarc[lo:lo + 4] != b'FLAN': return # tests/hud_layout_test.py's synthetic archive: fixed-offset keys only
|
||||
found = 0
|
||||
for pane in MAP_SIZED:
|
||||
for keys in anim_keys(blarc, lo, pane, b'FLPA', FLPA_SIZE_X):
|
||||
for key in keys:
|
||||
if abs(struct.unpack_from('<f', blarc, key + 4)[0] - 2250) < 1e-3:
|
||||
struct.pack_into('<f', blarc, key + 4, 2250 / k); found += 1
|
||||
if found < len(MAP_SIZED): raise SystemExit(f'AppMap_00_MiniMap: {found} width keys of 2250, expected at least {len(MAP_SIZED)}')
|
||||
changed.add(member)
|
||||
|
||||
def loading_anim(blarc, members, k, changed):
|
||||
"""The loading screen's map slides by 24 units when the bar comes in and goes out (LoadingFade_00_BarIn: x -278 to
|
||||
-302, BarOut: -302 to -326); the keys move with the map's centre (loading_map)."""
|
||||
shift = loading_map(k)[1]
|
||||
for name, shipped in (('LoadingFade_00_BarIn', (-278, -302)), ('LoadingFade_00_BarOut', (-302, -326))):
|
||||
member = f'anim/{name}.bflan'
|
||||
mini = members.get('anim/AppMap_00_MiniMap.bflan')
|
||||
if mini and blarc[mini[0]:mini[0] + 4] != b'FLAN': return # tests/hud_layout_test.py's synthetic archive
|
||||
if member not in members: raise SystemExit(f'{name}: no animation {member} in the archive')
|
||||
lo = members[member][0]
|
||||
curves = anim_keys(blarc, lo, 'N_Map_00', b'FLPA', 0)
|
||||
keys = [key for curve in curves for key in curve]
|
||||
values = tuple(round(struct.unpack_from('<f', blarc, key + 4)[0], 3) for key in keys)
|
||||
if values != shipped: raise SystemExit(f'{name} N_Map_00 x: keys {values}, expected {shipped}')
|
||||
for key in keys: struct.pack_into('<f', blarc, key + 4, struct.unpack_from('<f', blarc, key + 4)[0] + shift)
|
||||
changed.add(member)
|
||||
|
||||
def tall_anim(blarc, members, k, changed):
|
||||
"""The animation keys that hold positions or zooms on the screen's height, for a canvas narrower than 16:9."""
|
||||
h = 540 * (1 / k - 1)
|
||||
@@ -336,4 +393,6 @@ def apply(blarc, members, width, height, hud_aspect=None):
|
||||
have = struct.unpack_from('<f', blarc, lo + offset)[0]
|
||||
if abs(have - shipped) >= 1e-4: raise SystemExit(f'{anim} +{offset}: {have}, expected {shipped}')
|
||||
struct.pack_into('<f', blarc, lo + offset, value); changed.add(member)
|
||||
wide_anim(blarc, members, k, changed)
|
||||
loading_anim(blarc, members, k, changed)
|
||||
return sorted(changed)
|
||||
Reference in new issue
Block a user