2018-06-24 07:09:41 -07:00
|
|
|
ReanchorBGMap_NoOAMUpdate::
|
2017-12-15 17:10:54 -08:00
|
|
|
call DelayFrame
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hOAMUpdate]
|
2017-12-15 17:10:54 -08:00
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
|
|
|
ldh a, [hBGMapMode]
|
2017-12-15 17:10:54 -08:00
|
|
|
push af
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-15 17:10:54 -08:00
|
|
|
|
|
|
|
call .ReanchorBGMap
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-15 17:10:54 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2020-06-17 19:12:04 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wVramState
|
2017-12-15 17:10:54 -08:00
|
|
|
set 6, [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.ReanchorBGMap:
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
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.
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, $90
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hWY], a
|
2024-02-10 15:16:00 -08:00
|
|
|
call LoadOverworldTilemapAndAttrmapPals
|
2023-08-29 09:33:20 -07:00
|
|
|
call LoadWindowHUD
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, HIGH(vBGMap1)
|
2017-12-15 17:10:54 -08:00
|
|
|
call .LoadBGMapAddrIntoHRAM
|
2024-02-10 15:16:00 -08:00
|
|
|
call HDMATransferTilemapAndAttrmap_Menu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ApplyPals
|
2020-08-03 14:41:01 -07:00
|
|
|
ld a, TRUE
|
2018-08-25 11:28:22 -07:00
|
|
|
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
|
2023-08-28 03:03:32 -07:00
|
|
|
; (caller must re-enable when window is hidden again).
|
2017-12-15 17:10:54 -08:00
|
|
|
xor a
|
2023-08-28 03:03:32 -07:00
|
|
|
ldh [rSTAT], a
|
2018-08-25 11:28:22 -07:00
|
|
|
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)
|
2017-12-15 17:10:54 -08:00
|
|
|
call .LoadBGMapAddrIntoHRAM
|
2017-12-28 04:32:33 -08:00
|
|
|
xor a ; LOW(vBGMap0)
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [wBGMapAnchor], a
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, HIGH(vBGMap0)
|
2017-12-15 17:10:54 -08:00
|
|
|
ld [wBGMapAnchor + 1], a
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call ApplyBGMapAnchorToObjects
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.LoadBGMapAddrIntoHRAM:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress + 1], a
|
2017-12-15 17:10:54 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|
|
|
|
|
2023-08-11 03:28:14 -07:00
|
|
|
LoadFont_NoOAMUpdate::
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hOAMUpdate]
|
2017-12-15 17:10:54 -08:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2017-12-15 17:10:54 -08:00
|
|
|
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2023-08-28 03:03:32 -07:00
|
|
|
call HideWindow_EnableLCDInt
|
2017-12-15 17:10:54 -08:00
|
|
|
call SafeUpdateSprites
|
|
|
|
call LoadStandardFont
|
2023-08-11 03:28:14 -07:00
|
|
|
|
|
|
|
pop af
|
|
|
|
ldh [hOAMUpdate], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|
|
|
|
|
2023-08-12 12:14:46 -07:00
|
|
|
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:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2017-12-15 17:10:54 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wDecompressScratch)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2017-12-15 17:10:54 -08:00
|
|
|
|
2018-01-18 23:30:19 -08:00
|
|
|
ld a, "■"
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, wDecompressScratch
|
2020-02-13 09:30:13 -08:00
|
|
|
ld bc, wScratchAttrmap - wDecompressScratch
|
2017-12-15 17:10:54 -08:00
|
|
|
call ByteFill
|
2017-12-25 10:40:10 -08:00
|
|
|
ld a, HIGH(wDecompressScratch)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rHDMA1], a
|
2017-12-25 10:40:10 -08:00
|
|
|
ld a, LOW(wDecompressScratch)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rHDMA2], a
|
2024-01-03 07:58:53 -08:00
|
|
|
ld a, HIGH(vBGMap0 - STARTOF(VRAM))
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rHDMA3], a
|
2024-01-03 07:58:53 -08:00
|
|
|
ld a, LOW(vBGMap0 - STARTOF(VRAM))
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rHDMA4], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ld a, $3f
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDMATransfer], a
|
2017-12-15 17:10:54 -08:00
|
|
|
call DelayFrame
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|