Improve use of palette macro and use PAL_* constants (#1087)

* Improve use of palette macro and use PAL_* constants

* Use proper constant for battle stats (#1088)

* Add suggestions about function names and variables

* Add colors macro

---------

Co-authored-by: vulcandth <vulcandth@gmail.com>
This commit is contained in:
Idain 2023-11-17 14:24:09 -04:00 committed by GitHub
parent 75f0ad3955
commit 2907d65a47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 39 deletions

View File

@ -2076,10 +2076,10 @@ BattleBGEffect_FadeMonsToBlackRepeating:
add hl, de
ld a, [hli]
push hl
call BGEffects_LoadBGPal1_OBPal0
call BGEffects_LoadEnemyPals
pop hl
ld a, [hl]
call BGEffects_LoadBGPal0_OBPal1
call BGEffects_LoadPlayerPals
ret
.player_2
@ -2087,17 +2087,17 @@ BattleBGEffect_FadeMonsToBlackRepeating:
add hl, de
ld a, [hli]
push hl
call BGEffects_LoadBGPal0_OBPal1
call BGEffects_LoadPlayerPals
pop hl
ld a, [hl]
call BGEffects_LoadBGPal1_OBPal0
call BGEffects_LoadEnemyPals
ret
.cgb_two
ld a, $e4
call BGEffects_LoadBGPal0_OBPal1
call BGEffects_LoadPlayerPals
ld a, $e4
call BGEffects_LoadBGPal1_OBPal0
call BGEffects_LoadEnemyPals
call EndBattleBGEffect
ret
@ -2507,7 +2507,7 @@ BGEffect_RapidCyclePals:
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_cgb
call BGEffects_LoadBGPal0_OBPal1
call BGEffects_LoadPlayerPals
ret
.okay_2_cgb
@ -2518,7 +2518,7 @@ BGEffect_RapidCyclePals:
.two_cgb
ld a, $e4
call BGEffects_LoadBGPal0_OBPal1
call BGEffects_LoadPlayerPals
call EndBattleBGEffect
ret
@ -2538,7 +2538,7 @@ BGEffect_RapidCyclePals:
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_4_cgb
call BGEffects_LoadBGPal1_OBPal0
call BGEffects_LoadEnemyPals
ret
.okay_4_cgb
@ -2549,11 +2549,11 @@ BGEffect_RapidCyclePals:
.four_cgb
ld a, $e4
call BGEffects_LoadBGPal1_OBPal0
call BGEffects_LoadEnemyPals
call EndBattleBGEffect
ret
BGEffects_LoadBGPal0_OBPal1:
BGEffects_LoadPlayerPals:
ld h, a
ldh a, [rSVBK]
push af
@ -2562,13 +2562,13 @@ BGEffects_LoadBGPal0_OBPal1:
ld a, h
push bc
push af
ld hl, wBGPals2
ld de, wBGPals1
ld hl, wBGPals2 palette PAL_BATTLE_BG_PLAYER
ld de, wBGPals1 palette PAL_BATTLE_BG_PLAYER
ld b, a
ld c, $1
call CopyPals
ld hl, wOBPals2 palette 1
ld de, wOBPals1 palette 1
ld hl, wOBPals2 palette PAL_BATTLE_OB_PLAYER
ld de, wOBPals1 palette PAL_BATTLE_OB_PLAYER
pop af
ld b, a
ld c, $1
@ -2580,7 +2580,7 @@ BGEffects_LoadBGPal0_OBPal1:
ldh [hCGBPalUpdate], a
ret
BGEffects_LoadBGPal1_OBPal0:
BGEffects_LoadEnemyPals:
ld h, a
ldh a, [rSVBK]
push af
@ -2589,13 +2589,13 @@ BGEffects_LoadBGPal1_OBPal0:
ld a, h
push bc
push af
ld hl, wBGPals2 palette 1
ld de, wBGPals1 palette 1
ld hl, wBGPals2 palette PAL_BATTLE_BG_ENEMY
ld de, wBGPals1 palette PAL_BATTLE_BG_ENEMY
ld b, a
ld c, $1
call CopyPals
ld hl, wOBPals2
ld de, wOBPals1
ld hl, wOBPals2 palette PAL_BATTLE_OB_ENEMY
ld de, wOBPals1 palette PAL_BATTLE_OB_ENEMY
pop af
ld b, a
ld c, $1

View File

@ -729,7 +729,7 @@ CGBCopyBattleObjectPals: ; unreferenced
dec c
jr nz, .loop
ld hl, BattleObjectPals
ld de, wOBPals1 palette 2
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 2 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM

View File

@ -124,7 +124,7 @@ Palette_TextBG7:
INCLUDE "gfx/font/bg_text.pal"
Function49420::
ld hl, MansionPalette1 + 8 palettes
ld hl, MansionPalette1 palette 8
ld de, wBGPals1 palette PAL_BG_ROOF
ld bc, 1 palettes
ld a, BANK(wBGPals1)

View File

@ -168,14 +168,14 @@ FillWhiteBGColor:
ld e, a
ld a, [hli]
ld d, a
ld hl, wBGPals1 + 1 palettes
ld hl, wBGPals1 palette 1 color 0
ld c, 6
.loop
ld a, e
ld [hli], a
ld a, d
ld [hli], a
rept 6
rept 3 colors
inc hl
endr
dec c

View File

@ -22,6 +22,7 @@ DEF palblue EQUS "(1 << 10) *"
DEF palettes EQUS "* PALETTE_SIZE"
DEF palette EQUS "+ PALETTE_SIZE *"
DEF color EQUS "+ PAL_COLOR_SIZE *"
DEF colors EQUS "* PAL_COLOR_SIZE"
DEF tiles EQUS "* LEN_2BPP_TILE"
DEF tile EQUS "+ LEN_2BPP_TILE *"

View File

@ -641,7 +641,7 @@ Function894dc:
ld bc, 3 palettes
call CopyBytes
ld hl, .Pals345
ld de, wBGPals1 + 3 palettes
ld de, wBGPals1 palette 3
ld bc, 3 palettes
call CopyBytes
@ -2056,7 +2056,7 @@ Function89d0d:
jr nz, .loop
ld hl, .Palette2
ld de, wBGPals1 + 2 palettes
ld de, wBGPals1 palette 2
ld bc, 1 palettes
call CopyBytes
@ -3232,7 +3232,7 @@ Function8a5b6:
ld a, $5
ldh [rSVBK], a
ld hl, Palette_8a5e5
ld de, wBGPals1 + 4 palettes
ld de, wBGPals1 palette 4
ld bc, 3 palettes
call CopyBytes
ld hl, Palette_8a5fd
@ -3240,7 +3240,7 @@ Function8a5b6:
ld bc, 1 palettes
call CopyBytes
ld hl, Palette_8a605
ld de, wOBPals1 + 1 palettes
ld de, wOBPals1 palette 1
ld bc, 1 palettes
call CopyBytes
pop af

View File

@ -975,7 +975,7 @@ MobileTradeAnim_GiveTrademon1:
MobileTradeAnim_GiveTrademon2:
ld c, 40
ld hl, wBGPals2 + 1 palettes
ld hl, wBGPals2 palette 1
call Function1082f0
call Function108af4
call Function108b5a
@ -1069,12 +1069,12 @@ MobileTradeAnim_GetTrademon1:
MobileTradeAnim_GetTrademon2:
ld c, 20
ld hl, wBGPals2 + 1 palettes
ld hl, wBGPals2 palette 1
call Function1082fa
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ld c, 20
ld hl, wBGPals2 + 1 palettes
ld hl, wBGPals2 palette 1
call Function1082fa
call Function108af4
.asm_1088ad
@ -1439,8 +1439,8 @@ Function108b5a:
ld a, $5
ldh [rSVBK], a
ld de, palred 18 + palgreen 31 + palblue 15
ld hl, wBGPals2 + 4 palettes
ld c, $10
ld hl, wBGPals2 palette 4
ld c, 2 palettes
.loop
ld a, e
ld [hli], a
@ -1491,13 +1491,13 @@ Function108b98:
and $1
xor d
jr z, .asm_108bad
ld hl, Palette_108b98 + 1 palettes
ld hl, Palette_108b98 palette 1
jr .asm_108bb0
.asm_108bad
ld hl, Palette_108b98
.asm_108bb0
ld de, wBGPals1 + 7 palettes
ld de, wBGPals1 palette 7
ld bc, 8 palettes
call CopyBytes
pop af
@ -1724,7 +1724,7 @@ LoadMobileAdapterPalette:
ld hl, MobileAdapterPalettes
call AddNTimes
ld a, BANK(wBGPals1)
ld de, wBGPals1 + 4 palettes
ld de, wBGPals1 palette 4
ld bc, 1 palettes
call FarCopyWRAM
ret

View File

@ -515,7 +515,7 @@ Function1162cb:
ld a, $5
ldh [rSVBK], a
ld hl, PichuBorderMobileOBPalettes
ld de, wOBPals1 + 2 palettes
ld de, wOBPals1 palette 2
ld bc, 6 palettes
call CopyBytes
call SetPalettes

View File

@ -676,13 +676,13 @@ Function16cc18:
Function16cc25:
ld hl, Unknown_16cfa9
ld de, wBGPals1 + 1 palettes
ld de, wBGPals1 palette 1
call .CopyPal
ld hl, Unknown_16cfb1
ld de, wOBPals1
call .CopyPal
ld hl, Unknown_16cfb9
ld de, wOBPals1 + 1 palettes
ld de, wOBPals1 palette 1
call .CopyPal
ret