Tinker with overworld HUD implementation in f386a63cf8 (#15)

This commit is contained in:
xCrystal 2023-08-30 19:23:51 +02:00
parent 236519fc55
commit 9f835560d7
4 changed files with 21 additions and 12 deletions

View File

@ -52,12 +52,13 @@
#### HUD #### HUD
- **EnableWindowHUD**: Configure LCD interrupt in LYC=LY mode with corresponding LYC - **EnableWindowHUD**: Configure LCD interrupt in LYC=LY mode with corresponding LYC.
- **DisableWindowHUD**: Configure LCD interrupt in hblank mode - **DisableWindowHUD**: Configure LCD interrupt in hblank mode
- **LoadHUD**: Load the HUD at wWhichHUD to the top of wTilemap and wAttrmap - **LoadHUD**: Load the HUD at wWhichHUD to the top of wTilemap and wAttrmap
- **LoadWindowHUD**: Like LoadHUD, but for HUDs that require a Window overlay. Only does anything if hWindowHUDLY is non-0 - **LoadWindowHUD**: Like LoadHUD, but for HUDs that require a Window overlay. Only does anything if hWindowHUDLY is non-0
- **ConstructOverworldHUDTilemap**: Draw the overworld HUD's tilemap into wOverworldHUDTiles - **ConstructOverworldHUDTilemap**: Draw the overworld HUD's tilemap into wOverworldHUDTiles
- **TransferOverworldHUDToBGMap**: Transfer overworld HUD to vBGMap1/vBGMap3 during v/hblank(s). Tilemap is read from wOverworldHUDTiles, attrmap is all PAL_BG_TEXT | PRIORITY. - **TransferOverworldHUDToBGMap**: Transfer overworld HUD to vBGMap1/vBGMap3 during v/hblank(s). Tilemap is read from wOverworldHUDTiles, attrmap is all PAL_BG_TEXT | PRIORITY.
- **RefreshOverworldHUD**: ConstructOverworldHUDTilemap + TransferOverworldHUDToBGMap
### Scripts ### Scripts

View File

@ -27,3 +27,15 @@ _LoadOverworldHUDAttrmap:
ld bc, SCREEN_WIDTH ld bc, SCREEN_WIDTH
ld a, PAL_BG_TEXT | PRIORITY ld a, PAL_BG_TEXT | PRIORITY
jp ByteFill jp ByteFill
_ConstructOverworldHUDTilemap::
ld hl, .Tilemap
ld de, wOverworldHUDTiles
ld bc, .TilemapEnd - .Tilemap ; SCREEN_WIDTH
call CopyBytes
ret
.Tilemap:
db "▶- ▶- ▶ ▶ "
.TilemapEnd:
assert .TilemapEnd - .Tilemap == wOverworldHUDTilesEnd - wOverworldHUDTiles

View File

@ -127,7 +127,6 @@ EnterMap:
.dontresetpoison .dontresetpoison
call ConstructOverworldHUDTilemap call ConstructOverworldHUDTilemap
call TransferOverworldHUDToBGMap
call EnableOverworldHUD call EnableOverworldHUD
xor a ; end map entry xor a ; end map entry

View File

@ -3,10 +3,11 @@ OVERWORLD_HUD_HEIGHT EQU 8
EnableOverworldHUD:: EnableOverworldHUD::
ld a, HUD_OVERWORLD ld a, HUD_OVERWORLD
ld [wWhichHUD], a ld [wWhichHUD], a
call TransferOverworldHUDToBGMap
ld a, OVERWORLD_HUD_HEIGHT - 1 ld a, OVERWORLD_HUD_HEIGHT - 1
; fallthrough ; fallthrough
EnableWindowHUD: EnableWindowHUD::
ldh [hWindowHUDLY], a ldh [hWindowHUDLY], a
; configure LCD interrupt ; configure LCD interrupt
ldh [rLYC], a ldh [rLYC], a
@ -54,18 +55,14 @@ LoadHUD::
ConstructOverworldHUDTilemap:: ConstructOverworldHUDTilemap::
; draw the overworld HUD's tilemap into wOverworldHUDTiles ; draw the overworld HUD's tilemap into wOverworldHUDTiles
ld hl, .Tilemap farcall _ConstructOverworldHUDTilemap
ld de, wOverworldHUDTiles
ld bc, .TilemapEnd - .Tilemap ; SCREEN_WIDTH
call CopyBytes
ret ret
.Tilemap: RefreshOverworldHUD::
db "▶- ▶- ▶ ▶ " call ConstructOverworldHUDTilemap
.TilemapEnd: ; fallthrough
assert .TilemapEnd - .Tilemap == wOverworldHUDTilesEnd - wOverworldHUDTiles
TransferOverworldHUDToBGMap:: TransferOverworldHUDToBGMap:
; transfer overworld HUD to vBGMap1/vBGMap3 during v/hblank(s) ; transfer overworld HUD to vBGMap1/vBGMap3 during v/hblank(s)
; tilemap is read from wOverworldHUDTiles, attrmap is all PAL_BG_TEXT | PRIORITY ; tilemap is read from wOverworldHUDTiles, attrmap is all PAL_BG_TEXT | PRIORITY
ldh a, [rVBK] ldh a, [rVBK]