pret / pokecrystal

Disassembly of Pokémon Crystal
https://pret.github.io/pokecrystal/
2.06k stars 770 forks source link

Bug: Closing textboxes overlapping tiles $80+ glitches out for a frame #1102

Open Rangi42 opened 6 months ago

Rangi42 commented 6 months ago

The overworld engine puts tiles $80-$FF in VRAM bank 1. When a textbox is overlapping them and it closes, there can be a one-frame flash of glitches tiles as the VRAM is updated. Setting a breakpoint on call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap can help notice it, as reported by NickJam.

image

image

mid-kid commented 6 months ago

Can this even be fixed without a significant refactor to the way tiles are updated?

Rangi42 commented 6 months ago

"Fix: Refactor how tiles are updated to avoid this." or "No fix exists yet" are still valid ways to document that the bug exists.

xCrystal commented 6 months ago

You can avoid this by overlaying the window (which is using the tilemap with no text tiles) during the transition, by writing $00 to hWY either just before or just after the call to OverworldTextModeSwitch (depending on if you want the text to last an extra frame or not).