summaryrefslogtreecommitdiff
path: root/data/wild
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-03-03 22:22:41 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2021-03-04 00:15:03 -0500
commit40902ffe244544d638567642e4e01b9c5801db23 (patch)
tree4abf9ac20786fdf66bb298b3ec7935cef2c71d07 /data/wild
parent9c17fb14c8068d6662b9ca1cb048ed206b6770ee (diff)
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
Diffstat (limited to 'data/wild')
-rw-r--r--data/wild/fish.asm2
-rw-r--r--data/wild/probabilities.asm4
-rw-r--r--data/wild/treemons.asm4
3 files changed, 9 insertions, 1 deletions
diff --git a/data/wild/fish.asm b/data/wild/fish.asm
index 1976c8f95..b849b933f 100644
--- a/data/wild/fish.asm
+++ b/data/wild/fish.asm
@@ -7,6 +7,7 @@ ENDM
FishGroups:
; entries correspond to FISHGROUP_* constants
+ table_width FISHGROUP_DATA_LENGTH, FishGroups
fishgroup 50 percent + 1, .Shore_Old, .Shore_Good, .Shore_Super
fishgroup 50 percent + 1, .Ocean_Old, .Ocean_Good, .Ocean_Super
fishgroup 50 percent + 1, .Lake_Old, .Lake_Good, .Lake_Super
@@ -20,6 +21,7 @@ FishGroups:
fishgroup 50 percent + 1, .Qwilfish_Old, .Qwilfish_Good, .Qwilfish_Super
fishgroup 50 percent + 1, .Remoraid_Old, .Remoraid_Good, .Remoraid_Super
fishgroup 50 percent + 1, .Qwilfish_NoSwarm_Old, .Qwilfish_NoSwarm_Good, .Qwilfish_NoSwarm_Super
+ assert_table_length NUM_FISHGROUPS
.Shore_Old:
db 70 percent + 1, MAGIKARP, 10
diff --git a/data/wild/probabilities.asm b/data/wild/probabilities.asm
index bf3144bbe..f3f44e0af 100644
--- a/data/wild/probabilities.asm
+++ b/data/wild/probabilities.asm
@@ -4,6 +4,7 @@ mon_prob: MACRO
ENDM
GrassMonProbTable:
+ table_width 2, GrassMonProbTable
mon_prob 30, 0 ; 30% chance
mon_prob 60, 1 ; 30% chance
mon_prob 80, 2 ; 20% chance
@@ -11,8 +12,11 @@ GrassMonProbTable:
mon_prob 95, 4 ; 5% chance
mon_prob 99, 5 ; 4% chance
mon_prob 100, 6 ; 1% chance
+ assert_table_length NUM_GRASSMON
WaterMonProbTable:
+ table_width 2, WaterMonProbTable
mon_prob 60, 0 ; 60% chance
mon_prob 90, 1 ; 30% chance
mon_prob 100, 2 ; 10% chance
+ assert_table_length NUM_WATERMON
diff --git a/data/wild/treemons.asm b/data/wild/treemons.asm
index a6b1922f3..c24df03c1 100644
--- a/data/wild/treemons.asm
+++ b/data/wild/treemons.asm
@@ -1,5 +1,6 @@
TreeMons:
; entries correspond to TREEMON_SET_* constants
+ table_width 2, TreeMons
dw TreeMonSet_City
dw TreeMonSet_Canyon
dw TreeMonSet_Town
@@ -8,7 +9,8 @@ TreeMons:
dw TreeMonSet_Lake
dw TreeMonSet_Forest
dw TreeMonSet_Rock
- dw TreeMonSet_City
+ assert_table_length NUM_TREEMON_SETS
+ dw TreeMonSet_City ; unused
; Two tables each (common, rare).
; Structure: