Window HUD: Prevent more Window flickering in blocks that disable interrupts (#15)

This commit is contained in:
xCrystal
2023-08-28 17:31:39 +02:00
parent fd6f02036e
commit f289d5621d
8 changed files with 71 additions and 185 deletions

View File

@@ -41,6 +41,18 @@ HDMATransferTilemapAndAttrmap_OverworldEffect::
call PadTilemapForHDMATransfer
call DelayFrame
ldh a, [hWindowHUD]
and a
jr z, .go
; wait until LCD interrupt has ocurred this frame ([rLY] - [hWindowHUD] >= 0)
.wait_lcd
; ldh a, [hWindowHUD]
ld b, a
ldh a, [rLY]
sub b
jr c, .wait_lcd
.go
; Transfer Attrmap and Tilemap to BG map
di
ldh a, [rVBK]
@@ -74,6 +86,18 @@ _HDMATransferTilemapAndAttrmap_OpenAndCloseMenu::
call PadTilemapForHDMATransfer
call DelayFrame
ldh a, [hWindowHUD]
and a
jr z, .go
; wait until LCD interrupt has ocurred this frame ([rLY] - [hWindowHUD] >= 0)
.wait_lcd
; ldh a, [hWindowHUD]
ld b, a
ldh a, [rLY]
sub b
jr c, .wait_lcd
.go
; Transfer Attrmap and Tilemap to BG map
di
ldh a, [rVBK]
@@ -252,6 +276,18 @@ _continue_HDMATransfer:
cp d
jr nc, .ly_loop
ldh a, [hWindowHUD]
and a
jr z, .go
; wait until LCD interrupt has ocurred this frame ([rLY] - [hWindowHUD] >= 0)
.wait_lcd
; ldh a, [hWindowHUD]
ld b, a
ldh a, [rLY]
sub b
jr c, .wait_lcd
.go
di
; while [rSTAT] & 3: pass
.rstat_loop_1