Logic to manage PAL_OW_MISC (#3)

This commit is contained in:
xCrystal
2024-01-03 17:24:26 +01:00
parent ce4ca85494
commit 16e7328439
9 changed files with 101 additions and 17 deletions

View File

@@ -201,21 +201,12 @@ DrawBoardMenuTilesAndClearPriorityAttr:
jp FillBoxWithByte
ApplyBoardMenuSpritePalette:
ld hl, BoardMenuItemPals
ld a, [wBoardMenuCursorPosition]
ld bc, PALETTE_SIZE
call AddNTimes
or PAL_OW_MISC_BOARD_MENU_ITEMS
ld [wCurOverworldMiscPal], a
; write to wOBPals2 directly as well to avoid calling ApplyPals and overwriting other overworld pals
; writing to wOBPals1 is still necessary to make fading animations consistent
ld de, wOBPals1 palette PAL_OW_MISC
ld bc, PALETTE_SIZE
ld a, BANK(wOBPals1)
call FarCopyWRAM
ld hl, wOBPals1 palette PAL_OW_MISC
ld de, wOBPals2 palette PAL_OW_MISC
ld bc, PALETTE_SIZE
ld a, BANK(wOBPals1)
call FarCopyWRAM
farcall LoadOverworldMiscObjPal_ToObPals1And2
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
@@ -487,6 +478,3 @@ BoardMenu_CloseSubmenu:
farcall FadeInPalettesFromWhite
call EnableSpriteUpdates
ret
BoardMenuItemPals:
INCLUDE "gfx/board/menu.pal"

View File

@@ -321,6 +321,8 @@ UnionSpaceScript::
ret
PrintGainCoins:
ld a, PAL_OW_MISC_BOARD_COINS | 0
ld [wCurOverworldMiscPal], a
ld hl, wStringBuffer1
ld a, "<COIN>"
ld [hli], a
@@ -329,6 +331,8 @@ PrintGainCoins:
jr PrintGainOrLoseCoins
PrintLoseCoins:
ld a, PAL_OW_MISC_BOARD_COINS | 1
ld [wCurOverworldMiscPal], a
ld hl, wStringBuffer1
ld a, "<COIN>"
ld [hli], a
@@ -338,7 +342,12 @@ PrintLoseCoins:
PrintGainOrLoseCoins:
push hl
farcall LoadOverworldMiscObjPal_ToObPals2
ld a, TRUE
ldh [hCGBPalUpdate], a
pop hl
; fill string space with "@" to ensure that it is terminated with at least one "@"
push hl
ld a, "@"
ld c, MAX_DELTA_COINS_DIGITS + 1
.loop