pokecrystal-board/engine/overworld/init_map.asm

121 lines
2.2 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
ReanchorBGMap_NoOAMUpdate::
call DelayFrame
ldh a, [hOAMUpdate]
push af
ld a, $1
ldh [hOAMUpdate], a
ldh a, [hBGMapMode]
push af
xor a
ldh [hBGMapMode], a
call .ReanchorBGMap
pop af
ldh [hBGMapMode], a
pop af
ldh [hOAMUpdate], a
2018-01-23 14:39:09 -08:00
ld hl, wVramState
set 6, [hl]
ret
.ReanchorBGMap:
xor a
ldh [hLCDCPointer], a
ldh [hBGMapMode], a
2023-08-29 09:33:20 -07:00
; prepare vBGMap1/vBGMap3 to be displayed while vBGMap0/vBGMap2 is reanchored.
; draw screen at wTilemap and wAttrmap and then transfer it.
ld a, $90
ldh [hWY], a
call LoadScreenTilemapAndAttrmapPals
2023-08-29 09:33:20 -07:00
call LoadWindowHUD
2017-12-28 04:32:33 -08:00
ld a, HIGH(vBGMap1)
call .LoadBGMapAddrIntoHRAM
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
2017-12-24 09:47:30 -08:00
farcall ApplyPals
2020-08-03 14:41:01 -07:00
ld a, TRUE
ldh [hCGBPalUpdate], a
2023-08-29 09:33:20 -07:00
; display window using vBGMap1/vBGMap3 while vBGMap0/vBGMap2 is reanchored.
; disable LCD interrupt to prevent cropping the window if window HUD is active
; (caller must re-enable when window is hidden again).
xor a
ldh [rSTAT], a
ldh [hBGMapMode], a
ldh [hWY], a
2017-12-24 09:47:30 -08:00
farcall HDMATransfer_FillBGMap0WithBlack ; no need to farcall
2017-12-28 04:32:33 -08:00
ld a, HIGH(vBGMap0)
call .LoadBGMapAddrIntoHRAM
2017-12-28 04:32:33 -08:00
xor a ; LOW(vBGMap0)
ld [wBGMapAnchor], a
2017-12-28 04:32:33 -08:00
ld a, HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a
xor a
ldh [hSCX], a
ldh [hSCY], a
call ApplyBGMapAnchorToObjects
ret
2018-06-24 07:09:41 -07:00
.LoadBGMapAddrIntoHRAM:
ldh [hBGMapAddress + 1], a
xor a
ldh [hBGMapAddress], a
ret
LoadFont_NoOAMUpdate::
ldh a, [hOAMUpdate]
push af
ld a, $1
ldh [hOAMUpdate], a
call LoadFrame
call HideWindow_EnableLCDInt
call SafeUpdateSprites
call LoadStandardFont
pop af
ldh [hOAMUpdate], a
ret
LoadOverworldFont_NoOAMUpdate::
ldh a, [hOAMUpdate]
push af
ld a, $1
ldh [hOAMUpdate], a
call LoadOverworldFontAndFrame
ld a, $90
ldh [hWY], a
call SafeUpdateSprites
pop af
ldh [hOAMUpdate], a
ret
2018-06-24 07:09:41 -07:00
HDMATransfer_FillBGMap0WithBlack:
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ldh [rSVBK], a
2018-01-18 23:30:19 -08:00
ld a, "■"
ld hl, wDecompressScratch
ld bc, wScratchAttrmap - wDecompressScratch
call ByteFill
ld a, HIGH(wDecompressScratch)
ldh [rHDMA1], a
ld a, LOW(wDecompressScratch)
ldh [rHDMA2], a
2024-01-03 07:58:53 -08:00
ld a, HIGH(vBGMap0 - STARTOF(VRAM))
ldh [rHDMA3], a
2024-01-03 07:58:53 -08:00
ld a, LOW(vBGMap0 - STARTOF(VRAM))
ldh [rHDMA4], a
ld a, $3f
ldh [hDMATransfer], a
call DelayFrame
pop af
ldh [rSVBK], a
ret