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-05 16:10:25 -0500
commit5454e1e0deefc6b4fc8c4de0e63314052fceebc0 (patch)
tree565805b252fa596aab3f80b3128ebc91b1fae540 /data/wild
parentb423e94be700cc6434465cf1dcccf0b677489192 (diff)
Verify data table sizes with table_width and assert_table_length macros
It also uncovered some off-by-one issues with defining some constants. A few structs now use rsreset/_RS to define their offset constants.
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.asm3
3 files changed, 9 insertions, 0 deletions
diff --git a/data/wild/fish.asm b/data/wild/fish.asm
index 1976c8f9..b849b933 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 bf3144bb..f3f44e0a 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 f2687339..4b877084 100644
--- a/data/wild/treemons.asm
+++ b/data/wild/treemons.asm
@@ -1,9 +1,12 @@
TreeMons:
; entries correspond to TREEMON_SET_* constants
+ table_width 2, TreeMons
dw TreeMonSet_None
dw TreeMonSet_Forest
dw TreeMonSet_Canyon
dw TreeMonSet_Rock
+ assert_table_length NUM_TREEMON_SETS
+; last two are unused/ignored
dw TreeMonSet_Unused
dw TreeMonSet_City