Load overworld font and frame via HDMA instead of copying to VRAM (#10)

This commit is contained in:
xCrystal 2023-08-12 21:14:46 +02:00
parent db26480ffd
commit c405c955ba
4 changed files with 24 additions and 30 deletions

View File

@ -88,32 +88,6 @@ OpenAndCloseMenu_HDMATransferTilemapAndAttrmap::
ei
ret
Mobile_OpenAndCloseMenu_HDMATransferTilemapAndAttrmap:
ld hl, .Function
jp CallInSafeGFXMode
.Function:
; Transfer wAttrmap and Tilemap to BGMap
; Fill vBGAttrs with $00
; Fill vBGTiles with $ff
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
ld c, $ff
decoord 0, 0
ld hl, wScratchTilemap
call PadMapForHDMATransfer
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
call HDMATransfer_Wait127Scanlines_toBGMap
ret
CallInSafeGFXMode:
ldh a, [hBGMapMode]
push af

View File

@ -1,12 +1,16 @@
_LoadOverworldFontAndFrame::
ld de, .OverworldFontGFX
ld hl, vTiles1
lb bc, BANK(.OverworldFontGFX), 112
call Get2bpp
lb bc, BANK(.OverworldFontGFX), 64
call Get2bppViaHDMA
ld de, .OverworldFontGFX + 64 * LEN_2BPP_TILE
ld hl, vTiles1 tile $40
lb bc, BANK(.OverworldFontGFX), 56
call Get2bppViaHDMA
ld de, .OverworldFontSpaceGFX
ld hl, vTiles2 tile " "
lb bc, BANK(.OverworldFontSpaceGFX), 1
call Get2bpp
call Get2bppViaHDMA
ld a, [wEnvironment]
maskbits NUM_ENVIRONMENTS
ld bc, OW_TEXTBOX_FRAME_TILES * LEN_2BPP_TILE
@ -16,7 +20,7 @@ _LoadOverworldFontAndFrame::
ld e, l
ld hl, vTiles0 tile "┌" ; $f0
lb bc, BANK(.OverworldFrames), OW_TEXTBOX_FRAME_TILES
call Get2bpp
call Get2bppViaHDMA
ret
.OverworldFontGFX:

View File

@ -72,6 +72,21 @@ LoadFont_NoOAMUpdate::
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
HDMATransfer_FillBGMap0WithBlack:
ldh a, [rSVBK]
push af

View File

@ -70,6 +70,7 @@ OpenText1bpp::
call SpeechTextbox1bpp
call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap ; anchor bgmap
call LoadFont_NoOAMUpdate ; load 1bpp font and frame, hide window
pop af
rst Bankswitch