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:
@@ -7,6 +7,7 @@ ENDM
|
||||
|
||||
Emotes:
|
||||
; entries correspond to EMOTE_* constants
|
||||
table_width EMOTE_LENGTH, Emotes
|
||||
emote ShockEmote, 4, $f8
|
||||
emote QuestionEmote, 4, $f8
|
||||
emote HappyEmote, 4, $f8
|
||||
@@ -19,3 +20,4 @@ Emotes:
|
||||
emote FishingRodGFX, 2, $fc
|
||||
emote BoulderDustGFX, 2, $fe
|
||||
emote GrassRustleGFX, 1, $fe
|
||||
assert_table_length NUM_EMOTES
|
||||
|
@@ -1,5 +1,6 @@
|
||||
Facings:
|
||||
; entries correspond to FACING_* constants
|
||||
; entries correspond to FACING_* constants (see constants/map_object_constants.asm)
|
||||
table_width 2, Facings
|
||||
dw FacingStepDown0
|
||||
dw FacingStepDown1
|
||||
dw FacingStepDown2
|
||||
@@ -32,10 +33,8 @@ Facings:
|
||||
dw FacingBoulderDust2
|
||||
dw FacingGrass1
|
||||
dw FacingGrass2
|
||||
.End
|
||||
dw 0
|
||||
|
||||
NUM_FACINGS EQU (Facings.End - Facings) / 2
|
||||
assert_table_length NUM_FACINGS
|
||||
dw 0 ; end
|
||||
|
||||
; Tables used as a reference to transform OAM data.
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
SpriteMovementData::
|
||||
; entries correspond to SPRITEMOVEDATA_* constants
|
||||
table_width NUM_SPRITEMOVEDATA_FIELDS, SpriteMovementData
|
||||
|
||||
; SPRITEMOVEDATA_00
|
||||
db SPRITEMOVEFN_00 ; movement function
|
||||
@@ -304,3 +305,5 @@ SpriteMovementData::
|
||||
db 0 ; flags1
|
||||
db 0 ; flags2
|
||||
db 0 ; palette flags
|
||||
|
||||
assert_table_length NUM_SPRITEMOVEDATA + 1
|
||||
|
@@ -1,5 +1,6 @@
|
||||
SpriteMons:
|
||||
; entries correspond to SPRITE_* constants past SPRITE_POKEMON
|
||||
table_width 1, SpriteMons
|
||||
db UNOWN
|
||||
db GEODUDE
|
||||
db GROWLITHE
|
||||
@@ -35,3 +36,4 @@ SpriteMons:
|
||||
db GYARADOS
|
||||
db LUGIA
|
||||
db HO_OH
|
||||
assert_table_length NUM_POKEMON_SPRITES
|
||||
|
@@ -6,6 +6,7 @@ ENDM
|
||||
|
||||
OverworldSprites:
|
||||
; entries correspond to SPRITE_* constants
|
||||
table_width NUM_SPRITEDATA_FIELDS, OverworldSprites
|
||||
overworld_sprite ChrisSpriteGFX, 12, WALKING_SPRITE, PAL_OW_RED
|
||||
overworld_sprite ChrisBikeSpriteGFX, 12, WALKING_SPRITE, PAL_OW_RED
|
||||
overworld_sprite GameboyKidSpriteGFX, 12, STANDING_SPRITE, PAL_OW_GREEN
|
||||
@@ -108,3 +109,4 @@ OverworldSprites:
|
||||
overworld_sprite EnteiSpriteGFX, 4, STILL_SPRITE, PAL_OW_RED
|
||||
overworld_sprite RaikouSpriteGFX, 4, STILL_SPRITE, PAL_OW_RED
|
||||
overworld_sprite StandingYoungsterSpriteGFX, 12, STANDING_SPRITE, PAL_OW_BLUE
|
||||
assert_table_length NUM_OVERWORLD_SPRITES
|
||||
|
Reference in New Issue
Block a user