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:
Rangi
2021-03-03 22:22:41 -05:00
parent 9c17fb14c8
commit 40902ffe24
148 changed files with 608 additions and 237 deletions

View File

@@ -5,10 +5,12 @@
const ROOF_AZALEA ; 2
const ROOF_OLIVINE ; 3
const ROOF_GOLDENROD ; 4
NUM_ROOFS EQU const_value
MapGroupRoofs:
; entries correspond to map groups
; values are indexes for Roofs (see below)
table_width 1, MapGroupRoofs
db -1 ; 0
db ROOF_OLIVINE ; 1 (Olivine)
db ROOF_AZALEA ; 2 (Mahogany)
@@ -36,11 +38,14 @@ MapGroupRoofs:
db ROOF_NEW_BARK ; 24 (New Bark)
db -1 ; 25
db ROOF_NEW_BARK ; 26 (Cherrygrove)
assert_table_length NUM_MAP_GROUPS + 1
Roofs:
; entries correspond to ROOF_* constants
table_width ROOF_LENGTH * LEN_2BPP_TILE, Roofs
INCBIN "gfx/tilesets/roofs/new_bark.2bpp"
INCBIN "gfx/tilesets/roofs/violet.2bpp"
INCBIN "gfx/tilesets/roofs/azalea.2bpp"
INCBIN "gfx/tilesets/roofs/olivine.2bpp"
INCBIN "gfx/tilesets/roofs/goldenrod.2bpp"
assert_table_length NUM_ROOFS