You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Logic to manage PAL_OW_MISC (#3)
This commit is contained in:
@@ -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"
|
||||
|
@@ -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
|
||||
|
@@ -699,7 +699,8 @@ LoadMapPals:
|
||||
ld de, wOBPals1
|
||||
ld hl, MapObjectDarknessPals
|
||||
ld bc, 7 palettes ; all but PAL_OW_MISC
|
||||
jp FarCopyWRAM
|
||||
call FarCopyWRAM
|
||||
jp LoadOverworldMiscObjPal_ToObPals1 ; PAL_OW_MISC
|
||||
|
||||
.not_darkness
|
||||
ld a, [wTimeOfDayPal]
|
||||
@@ -711,6 +712,7 @@ LoadMapPals:
|
||||
ld bc, 7 palettes ; all but PAL_OW_MISC
|
||||
ld a, BANK(wOBPals1)
|
||||
call FarCopyWRAM
|
||||
call LoadOverworldMiscObjPal_ToObPals1 ; PAL_OW_MISC
|
||||
|
||||
ld a, [wEnvironment]
|
||||
cp INDOOR_ENVIRONMENT
|
||||
@@ -763,6 +765,53 @@ LoadDarknessPalette:
|
||||
ld bc, 8 palettes
|
||||
jp FarCopyWRAM
|
||||
|
||||
LoadOverworldMiscObjPal_ToObPals1:
|
||||
call GetOverworldMiscObjPal
|
||||
ld de, wOBPals1 palette PAL_OW_MISC
|
||||
ld bc, PALETTE_SIZE
|
||||
ld a, BANK(wOBPals1)
|
||||
jp FarCopyWRAM
|
||||
|
||||
LoadOverworldMiscObjPal_ToObPals2:
|
||||
call GetOverworldMiscObjPal
|
||||
ld de, wOBPals2 palette PAL_OW_MISC
|
||||
ld bc, PALETTE_SIZE
|
||||
ld a, BANK(wOBPals1)
|
||||
jp FarCopyWRAM
|
||||
|
||||
LoadOverworldMiscObjPal_ToObPals1And2:
|
||||
call LoadOverworldMiscObjPal_ToObPals1
|
||||
ld hl, wOBPals1 palette PAL_OW_MISC
|
||||
ld de, wOBPals2 palette PAL_OW_MISC
|
||||
ld bc, PALETTE_SIZE
|
||||
ld a, BANK(wOBPals1)
|
||||
jp FarCopyWRAM
|
||||
|
||||
GetOverworldMiscObjPal:
|
||||
ld a, [wCurOverworldMiscPal]
|
||||
and PAL_OW_MISC_PAL_GROUP_MASK
|
||||
swap a
|
||||
ld hl, .OverworldMiscPalGroups
|
||||
ld bc, .pal_group_2 - .pal_group_1
|
||||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld a, [wCurOverworldMiscPal]
|
||||
and ~PAL_OW_MISC_PAL_GROUP_MASK
|
||||
ld bc, PALETTE_SIZE
|
||||
call AddNTimes
|
||||
ret
|
||||
|
||||
.OverworldMiscPalGroups:
|
||||
table_width 2, .OverworldMiscPalGroups
|
||||
.pal_group_1
|
||||
dw BoardMenuItemsPals
|
||||
.pal_group_2
|
||||
dw BoardDicePals
|
||||
dw BoardCoinsPals
|
||||
assert_table_length NUM_PAL_OW_MISC_PAL_GROUPS
|
||||
|
||||
INCLUDE "data/maps/environment_colors.asm"
|
||||
|
||||
PartyMenuBGMobilePalette:
|
||||
@@ -783,6 +832,15 @@ INCLUDE "gfx/overworld/npc_sprites_darkness.pal"
|
||||
MapObjectPals::
|
||||
INCLUDE "gfx/overworld/npc_sprites.pal"
|
||||
|
||||
BoardMenuItemsPals:
|
||||
INCLUDE "gfx/board/menu.pal"
|
||||
|
||||
BoardDicePals:
|
||||
INCLUDE "gfx/board/dice.pal"
|
||||
|
||||
BoardCoinsPals:
|
||||
INCLUDE "gfx/board/coins.pal"
|
||||
|
||||
RoofPals:
|
||||
table_width PAL_COLOR_SIZE * 4 * 2, RoofPals
|
||||
INCLUDE "gfx/tilesets/roofs.pal"
|
||||
|
@@ -173,6 +173,7 @@ StartMap:
|
||||
ld [hli], a ; wPrevWarp
|
||||
ld [hli], a ; wPrevMapGroup
|
||||
ld [hl], a ; wPrevMapNumber
|
||||
ld [wCurOverworldMiscPal], a
|
||||
|
||||
ld a, BANK(wDisabledSpacesBackups)
|
||||
ld [rSVBK], a
|
||||
|
Reference in New Issue
Block a user