pokecrystal-board/home/window.asm

128 lines
2.3 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
RefreshScreen::
call ClearMenuAndWindowData
ldh a, [hROMBank]
2013-09-18 18:40:48 -07:00
push af
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; aka BANK(LoadFont_NoOAMUpdate)
2013-09-18 18:40:48 -07:00
rst Bankswitch
2016-05-04 19:34:09 -07:00
call ReanchorBGMap_NoOAMUpdate
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call HideWindow_EnableLCDInt
2013-09-18 18:40:48 -07:00
pop af
rst Bankswitch
ret
2018-06-24 07:09:41 -07:00
CloseText::
ldh a, [hOAMUpdate]
2013-09-18 18:40:48 -07:00
push af
ld a, $1
ldh [hOAMUpdate], a
2015-10-24 07:34:19 -07:00
call ClearMenuAndWindowData
2013-09-18 18:40:48 -07:00
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
2013-09-18 18:40:48 -07:00
xor a
ldh [hBGMapMode], a
call SafeUpdateSprites
2013-09-18 18:40:48 -07:00
ld a, $90
ldh [hWY], a
call UpdatePlayerSprite
2023-07-31 10:30:40 -07:00
xor a
ldh [hBGMapMode], a
pop af
ldh [hOAMUpdate], a
ld hl, wVramState
res 6, [hl]
ret
OpenText2bpp::
call ClearMenuAndWindowData
ldh a, [hROMBank]
push af
ld a, BANK(ReanchorBGMap_NoOAMUpdate)
rst Bankswitch
ld hl, wTextboxFlags
set TEXT_2BPP_F, [hl]
; assumes that the overworld 2bpp font and frame are loaded when calling this
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox2bpp
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ; transfer bgmap
call HideWindow_EnableLCDInt
pop af
rst Bankswitch
2013-09-18 18:40:48 -07:00
ret
OpenText1bpp::
call ClearMenuAndWindowData
ldh a, [hROMBank]
2013-09-18 18:40:48 -07:00
push af
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; aka BANK(LoadFont_NoOAMUpdate)
2013-09-18 18:40:48 -07:00
rst Bankswitch
; note: 1bpp text is NOT compatible with the overworld HUD enabled because it uses 2bpp font tiles.
ld hl, wTextboxFlags
res TEXT_2BPP_F, [hl]
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox1bpp
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ; transfer bgmap
call LoadFont_NoOAMUpdate ; load 1bpp font and frame, hide window
2013-09-18 18:40:48 -07:00
pop af
rst Bankswitch
ret
HDMATransferTilemapAndAttrmap_OpenAndCloseMenu::
ldh a, [hOAMUpdate]
2013-09-18 18:40:48 -07:00
push af
ld a, $1
ldh [hOAMUpdate], a
farcall _HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
2013-09-18 18:40:48 -07:00
pop af
ldh [hOAMUpdate], a
2013-09-18 18:40:48 -07:00
ret
2018-06-24 07:09:41 -07:00
SafeUpdateSprites::
ldh a, [hOAMUpdate]
2013-09-18 18:40:48 -07:00
push af
ldh a, [hBGMapMode]
2013-09-18 18:40:48 -07:00
push af
xor a
ldh [hBGMapMode], a
2013-09-18 18:40:48 -07:00
ld a, $1
ldh [hOAMUpdate], a
call UpdateSprites
2013-09-18 18:40:48 -07:00
xor a
ldh [hOAMUpdate], a
2013-09-18 18:40:48 -07:00
call DelayFrame
pop af
ldh [hBGMapMode], a
2013-09-18 18:40:48 -07:00
pop af
ldh [hOAMUpdate], a
2013-09-18 18:40:48 -07:00
ret
HideWindow_EnableLCDInt::
ld a, $90
ldh [hWY], a
2023-08-29 09:33:20 -07:00
ldh a, [hWindowHUDLY]
and a
ld a, 1 << rSTAT_INT_HBLANK
jr z, .ok
ld a, 1 << rSTAT_INT_LYC
.ok
ldh [rSTAT], a
ret