You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Verify data table sizes with table_width and assert_table_length macros
This was discussed in #706 It also uncovered some off-by-one issues with defining some constants. A few structs now use rsreset/_RS to define their offset constants, as discussed in #739
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
TrainerClassAttributes:
|
||||
; entries correspond to trainer classes (see constants/trainer_constants.asm)
|
||||
table_width NUM_TRAINER_ATTRIBUTES, TrainerClassAttributes
|
||||
|
||||
; Falkner
|
||||
db NO_ITEM, NO_ITEM ; items
|
||||
@@ -402,3 +403,5 @@ TrainerClassAttributes:
|
||||
db 25 ; base reward
|
||||
dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY
|
||||
dw CONTEXT_USE | SWITCH_SOMETIMES
|
||||
|
||||
assert_table_length NUM_TRAINER_CLASSES
|
||||
|
@@ -1,5 +1,6 @@
|
||||
TrainerClassDVs:
|
||||
; entries correspond to trainer classes (see constants/trainer_constants.asm)
|
||||
table_width 2, TrainerClassDVs
|
||||
; atk,def,spd,spc
|
||||
dn 9, 10, 7, 7 ; FALKNER
|
||||
dn 8, 8, 8, 8 ; WHITNEY
|
||||
@@ -68,3 +69,4 @@ TrainerClassDVs:
|
||||
dn 9, 8, 8, 8 ; OFFICER
|
||||
dn 7, 14, 10, 8 ; GRUNTF
|
||||
dn 9, 8, 8, 8 ; MYSTICALMAN
|
||||
assert_table_length NUM_TRAINER_CLASSES
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
TrainerEncounterMusic::
|
||||
; entries correspond to trainer classes (see constants/trainer_constants.asm)
|
||||
table_width 1, TrainerEncounterMusic
|
||||
db MUSIC_HIKER_ENCOUNTER ; none
|
||||
db MUSIC_YOUNGSTER_ENCOUNTER ; falkner
|
||||
db MUSIC_LASS_ENCOUNTER ; whitney
|
||||
@@ -70,6 +71,7 @@ TrainerEncounterMusic::
|
||||
db MUSIC_HIKER_ENCOUNTER ; officer
|
||||
db MUSIC_ROCKET_ENCOUNTER ; gruntf
|
||||
db MUSIC_HIKER_ENCOUNTER ; mysticalman
|
||||
db MUSIC_HIKER_ENCOUNTER
|
||||
db MUSIC_HIKER_ENCOUNTER
|
||||
db MUSIC_HIKER_ENCOUNTER
|
||||
assert_table_length NUM_TRAINER_CLASSES + 1
|
||||
db MUSIC_HIKER_ENCOUNTER ; unused
|
||||
db MUSIC_HIKER_ENCOUNTER ; unused
|
||||
db MUSIC_HIKER_ENCOUNTER ; unused
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
BTTrainerClassGenders:
|
||||
; entries correspond to trainer classes
|
||||
table_width 1, BTTrainerClassGenders
|
||||
db MALE ; FALKNER
|
||||
db FEMALE ; WHITNEY
|
||||
db FEMALE ; BUGSY
|
||||
@@ -68,3 +69,4 @@ BTTrainerClassGenders:
|
||||
db MALE ; BLUE
|
||||
db MALE ; OFFICER
|
||||
db FEMALE ; GRUNTF
|
||||
assert_table_length NUM_TRAINER_CLASSES - 1 ; exclude MYSTICALMAN
|
||||
|
@@ -4,6 +4,8 @@ TrainerPalettes:
|
||||
; Each .gbcpal is generated from the corresponding .png, and
|
||||
; only the middle two colors are included, not black or white.
|
||||
|
||||
table_width PAL_COLOR_SIZE * 2, TrainerPalettes
|
||||
|
||||
PlayerPalette: ; Chris uses the same colors as Cal
|
||||
INCBIN "gfx/trainers/cal.gbcpal", middle_colors
|
||||
KrisPalette: ; Kris shares Falkner's palette
|
||||
@@ -74,3 +76,5 @@ INCBIN "gfx/trainers/blue.gbcpal", middle_colors
|
||||
INCBIN "gfx/trainers/officer.gbcpal", middle_colors
|
||||
INCBIN "gfx/trainers/grunt_f.gbcpal", middle_colors
|
||||
INCBIN "gfx/trainers/mysticalman.gbcpal", middle_colors
|
||||
|
||||
assert_table_length NUM_TRAINER_CLASSES + 1
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
TrainerGroups:
|
||||
; entries correspond to trainer classes (see constants/trainer_constants.asm)
|
||||
table_width 2, TrainerGroups
|
||||
dw FalknerGroup
|
||||
dw WhitneyGroup
|
||||
dw BugsyGroup
|
||||
@@ -69,3 +70,4 @@ TrainerGroups:
|
||||
dw OfficerGroup
|
||||
dw GruntFGroup
|
||||
dw MysticalmanGroup
|
||||
assert_table_length NUM_TRAINER_CLASSES
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
TrainerPicPointers::
|
||||
; entries correspond to trainer classes (see constants/trainer_constants.asm)
|
||||
table_width 3, TrainerPicPointers
|
||||
dba_pic FalknerPic
|
||||
dba_pic WhitneyPic
|
||||
dba_pic BugsyPic
|
||||
@@ -69,3 +70,4 @@ TrainerPicPointers::
|
||||
dba_pic OfficerPic
|
||||
dba_pic GruntfPic
|
||||
dba_pic MysticalmanPic
|
||||
assert_table_length NUM_TRAINER_CLASSES
|
||||
|
@@ -1,5 +1,6 @@
|
||||
BTTrainerClassSprites:
|
||||
; entries correspond to trainer classes
|
||||
table_width 1, BTTrainerClassSprites
|
||||
db SPRITE_FALKNER
|
||||
db SPRITE_WHITNEY
|
||||
db SPRITE_BUGSY
|
||||
@@ -66,3 +67,4 @@ BTTrainerClassSprites:
|
||||
db SPRITE_BLUE
|
||||
db SPRITE_OFFICER
|
||||
db SPRITE_ROCKET_GIRL
|
||||
assert_table_length NUM_TRAINER_CLASSES - 1 ; exclude MYSTICALMAN
|
||||
|
Reference in New Issue
Block a user