diff options
| author | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 11:56:20 +0200 |
|---|---|---|
| committer | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 11:56:20 +0200 |
| commit | 89259e35e7d2105f5e85d3f813dc2cb522a7d277 (patch) | |
| tree | caefbe3df5b505fbc8623e0e8082d46ebc066c20 /tools/render_overworld.py | |
| parent | explore (P1): direction markers for legit connections (diff) | |
| download | pokeyellow-89259e35e7d2105f5e85d3f813dc2cb522a7d277.tar.gz pokeyellow-89259e35e7d2105f5e85d3f813dc2cb522a7d277.tar.xz pokeyellow-89259e35e7d2105f5e85d3f813dc2cb522a7d277.zip | |
explore: fix map rendering (compute the view pointer ourselves)
Root cause of the 'maps look wrong' bug: LoadMapData renders the view from
wCurrentTileBlockMapViewPointer, which the engine ONLY ever sets from warp /
connection / walk data (LoadDestinationWarpPosition, the connected-map handler,
advance_player_sprite) -- never from wXCoord/wYCoord. My old code set coords and
called LoadMapData, so every map was drawn from a STALE pointer left over from
the previous map: arbitrary, inconsistent windows.
Fix: after LoadMapData loads the block map into wOverworldMap, compute a centered
pointer directly --
stride = wCurMapWidth + MAP_BORDER*2
ptr = wOverworldMap + (height/2 + 1)*stride + width/2
-- clear wYBlockCoord/wXBlockCoord, and call LoadCurrentMapView to redraw. On
exit, save/restore the origin's real view pointer (+ block coords) before
reloading so the overworld comes back correctly.
Verified by DFS-traversing the whole connection graph and stitching 36 centered
maps into a coherent Kanto overworld image.
Diffstat (limited to 'tools/render_overworld.py')
0 files changed, 0 insertions, 0 deletions
