New and improved Poke Ball colour palettes

This commit is contained in:
Martha Schilling 2024-03-26 10:11:57 +00:00
parent adb9e3c540
commit 44db4d67ed
3 changed files with 76 additions and 35 deletions

View file

@ -431,33 +431,11 @@ BattleAnimFunction_PokeBallBlocked:
ret
GetBallAnimPal:
ld hl, BallColors
ldh a, [rSVBK]
push af
ld a, BANK(wCurItem)
ldh [rSVBK], a
ld a, [wCurItem]
ld e, a
pop af
ldh [rSVBK], a
.IsInArray:
ld a, [hli]
cp -1
jr z, .load
cp e
jr z, .load
inc hl
jr .IsInArray
.load
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PALETTE
add hl, bc
ld [hl], a
ld [hl], PAL_BATTLE_OB_RED
ret
INCLUDE "data/battle_anims/ball_colors.asm"
BattleAnimFunction_Ember:
call BattleAnim_AnonJumptable
.anon_dw

View file

@ -104,6 +104,8 @@ GetBattleAnimOAMPointer:
LoadBattleAnimGFX:
push hl
cp ANIM_GFX_POKE_BALL
call z, .LoadBallPalette
ld l, a
ld h, 0
add hl, hl
@ -123,6 +125,53 @@ LoadBattleAnimGFX:
pop bc
ret
.LoadBallPalette:
; save the current WRAM bank
ld a, [rSVBK]
push af
; switch to the WRAM bank of wCurItem so we can read it
ld a, BANK(wCurItem)
ld [rSVBK], a
; store the current item in b
ld a, [wCurItem]
ld b, a
; seek for the BallColors entry matching the current item
ld hl, BallColors
.loop
ld a, [hli]
cp b ; did we find the current ball?
jr z, .done
cp -1 ; did we reach the end of the list?
jr z, .done
rept PAL_COLOR_SIZE * 2
inc hl ; skip over the two RGB colors to the next entry
endr
jr .loop
.done
; switch to the WRAM bank of wOBPals2 so we can write to it
ld a, BANK(wOBPals2)
ld [rSVBK], a
; load the RGB colors into the middle two colors of PAL_BATTLE_OB_RED
ld de, wOBPals2 palette PAL_BATTLE_OB_RED color 1
rept PAL_COLOR_SIZE * 2 - 1
ld a, [hli]
ld [de], a
inc de
endr
ld a, [hl]
ld [de], a
; apply the updated colors to the palette RAM
ld a, $1
ldh [hCGBPalUpdate], a
; restore the previous WRAM bank
pop af
ld [rSVBK], a
; restore the graphics index to be loaded
ld a, ANIM_GFX_POKE_BALL
ret
INCLUDE "data/battle_anims/ball_colors.asm"
INCLUDE "data/battle_anims/framesets.asm"
INCLUDE "data/battle_anims/oam.asm"