mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Logic to manage PAL_OW_MISC (#3)
This commit is contained in:
parent
ce4ca85494
commit
16e7328439
@ -74,3 +74,12 @@ DIE_SIZE EQU DIE_WIDTH * DIE_HEIGHT
|
||||
DIE_NUMBER_WIDTH EQU 2
|
||||
DIE_NUMBER_HEIGHT EQU 2
|
||||
DIE_NUMBER_SIZE EQU DIE_NUMBER_WIDTH * DIE_NUMBER_HEIGHT
|
||||
|
||||
; PAL_OW_MISC groups (high nybble of wCurOverworldMiscPal)
|
||||
const_def 0, $10
|
||||
const PAL_OW_MISC_BOARD_MENU_ITEMS
|
||||
const PAL_OW_MISC_BOARD_DICE
|
||||
const PAL_OW_MISC_BOARD_COINS
|
||||
DEF NUM_PAL_OW_MISC_PAL_GROUPS EQU const_value / $10
|
||||
|
||||
PAL_OW_MISC_PAL_GROUP_MASK EQU %11110000
|
||||
|
@ -72,7 +72,7 @@
|
||||
- **refreshscreen**: RefreshScreen
|
||||
- **reloadmappart**: LoadScreenTilemapAndAttrmapPals + GetMovementPermissions + HDMATransferTilemapAndAttrmap_OverworldEffect + UpdateSprites. Similar to refreshscreen, but does not reanchor. On the other hand, it refreshes movement permissions. Often used after a block change or field move, which can affect collisions.
|
||||
|
||||
## Board behavior
|
||||
## Changes
|
||||
|
||||
### RAM addresses
|
||||
|
||||
@ -96,6 +96,7 @@
|
||||
- Addresses within *wPlayerData* ~ *wPlayerDataEnd*: preserved on save. Includes:
|
||||
- **wUnlockedLevels**: flag array that tracks progression regarding which levels have been unlocked.
|
||||
- **wUnlockedTechniques**: flag array that tracks progression regarding which techniques have been unlocked.
|
||||
- **wCurOverworldMiscPal**
|
||||
|
||||
- These addresses share memory region with string buffers from *wStringBuffer3* onwards. They are placed in memory in the following order.
|
||||
- **wTempSpaceStruct**: Temporary scope. Same structure as *wCurSpaceStruct*
|
||||
|
@ -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
|
||||
|
11
gfx/board/coins.pal
Executable file
11
gfx/board/coins.pal
Executable file
@ -0,0 +1,11 @@
|
||||
; gain coins
|
||||
RGB 31, 31, 31
|
||||
RGB 19, 23, 31
|
||||
RGB 27, 17, 03
|
||||
RGB 00, 00, 00
|
||||
|
||||
; lose coins
|
||||
RGB 31, 31, 31
|
||||
RGB 31, 20, 18
|
||||
RGB 27, 17, 03
|
||||
RGB 00, 00, 00
|
5
gfx/board/dice.pal
Executable file
5
gfx/board/dice.pal
Executable file
@ -0,0 +1,5 @@
|
||||
; die 1
|
||||
RGB 31, 31, 31
|
||||
RGB 10, 10, 31
|
||||
RGB 00, 00, 21
|
||||
RGB 00, 00, 00
|
@ -2521,6 +2521,8 @@ wRepelEffect:: db ; If a Repel is in use, it contains the nr of steps it's still
|
||||
wBikeStep:: dw
|
||||
wKurtApricornQuantity:: db
|
||||
|
||||
wCurOverworldMiscPal:: db
|
||||
|
||||
wPlayerDataEnd::
|
||||
|
||||
wCurMapData::
|
||||
|
Loading…
Reference in New Issue
Block a user