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,5 @@
|
||||
BugCatchingContestantEventFlagTable:
|
||||
; there are NUM_BUG_CONTESTANTS entries
|
||||
table_width 2, BugCatchingContestantEventFlagTable
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_1A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_2A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_3A
|
||||
@@ -10,3 +10,4 @@ BugCatchingContestantEventFlagTable:
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_8A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_9A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_10A
|
||||
assert_table_length NUM_BUG_CONTESTANTS
|
||||
|
@@ -1,5 +1,5 @@
|
||||
BugContestantPointers:
|
||||
; there are NUM_BUG_CONTESTANTS + 1 entries
|
||||
table_width 2, BugContestantPointers
|
||||
dw BugContestant_BugCatcherDon ; this reverts back to the player
|
||||
dw BugContestant_BugCatcherDon
|
||||
dw BugContestant_BugCatcherEd
|
||||
@@ -11,6 +11,7 @@ BugContestantPointers:
|
||||
dw BugContestant_BugCatcherJosh
|
||||
dw BugContestant_YoungsterSamuel
|
||||
dw BugContestant_SchoolboyKipp
|
||||
assert_table_length NUM_BUG_CONTESTANTS + 1
|
||||
|
||||
; contestant format:
|
||||
; db class, id
|
||||
|
@@ -1,5 +1,6 @@
|
||||
ElevatorFloorNames:
|
||||
; entries correspond to FLOOR_* constants
|
||||
table_width 2, ElevatorFloorNames
|
||||
dw .B4F
|
||||
dw .B3F
|
||||
dw .B2F
|
||||
@@ -16,6 +17,7 @@ ElevatorFloorNames:
|
||||
dw ._10F
|
||||
dw ._11F
|
||||
dw .ROOF
|
||||
assert_table_length NUM_FLOORS
|
||||
|
||||
.B4F: db "B4F@"
|
||||
.B3F: db "B3F@"
|
||||
|
@@ -6,6 +6,7 @@ ENDM
|
||||
|
||||
EngineFlags:
|
||||
; entries correspond to ENGINE_* constants
|
||||
table_width 3, EngineFlags
|
||||
|
||||
; pokegear
|
||||
engine_flag wPokegearFlags, POKEGEAR_RADIO_CARD_F
|
||||
@@ -197,3 +198,5 @@ EngineFlags:
|
||||
|
||||
engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F
|
||||
engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F
|
||||
|
||||
assert_table_length NUM_ENGINE_FLAGS
|
||||
|
@@ -1,6 +1,7 @@
|
||||
HappinessChanges:
|
||||
; entries correspond to HAPPINESS_* constants
|
||||
; change if happiness < 100, change if happiness < 200, change otherwise
|
||||
table_width 3, HappinessChanges
|
||||
; change if happiness < 100, change if happiness < 200, change otherwise
|
||||
db +5, +3, +2 ; Gained a level
|
||||
db +5, +3, +2 ; Vitamin
|
||||
db +1, +1, +0 ; X Item
|
||||
@@ -20,3 +21,4 @@ HappinessChanges:
|
||||
db -15, -15, -20 ; Used Revival Herb (bitter)
|
||||
db +3, +3, +1 ; Grooming
|
||||
db +10, +6, +4 ; Gained a level in the place where it was caught
|
||||
assert_table_length NUM_HAPPINESS_CHANGES
|
||||
|
@@ -8,6 +8,7 @@ ENDM
|
||||
|
||||
NPCTrades:
|
||||
; entries correspond to NPCTRADE_* constants
|
||||
table_width NPCTRADE_STRUCT_LENGTH, NPCTrades
|
||||
npctrade TRADE_DIALOGSET_COLLECTOR, ABRA, MACHOP, "MUSCLE@@@@@", $37, $66, GOLD_BERRY, 37460, "MIKE@@@@@@@", TRADE_GENDER_EITHER
|
||||
npctrade TRADE_DIALOGSET_COLLECTOR, BELLSPROUT, ONIX, "ROCKY@@@@@@", $96, $66, BITTER_BERRY, 48926, "KYLE@@@@@@@", TRADE_GENDER_EITHER
|
||||
npctrade TRADE_DIALOGSET_HAPPY, KRABBY, VOLTORB, "VOLTY@@@@@@", $98, $88, PRZCUREBERRY, 29189, "TIM@@@@@@@@", TRADE_GENDER_EITHER
|
||||
@@ -15,3 +16,4 @@ NPCTrades:
|
||||
npctrade TRADE_DIALOGSET_NEWBIE, HAUNTER, XATU, "PAUL@@@@@@@", $96, $86, MYSTERYBERRY, 15616, "CHRIS@@@@@@", TRADE_GENDER_EITHER
|
||||
npctrade TRADE_DIALOGSET_GIRL, CHANSEY, AERODACTYL, "AEROY@@@@@@", $96, $66, GOLD_BERRY, 26491, "KIM@@@@@@@@", TRADE_GENDER_EITHER
|
||||
npctrade TRADE_DIALOGSET_COLLECTOR, DUGTRIO, MAGNETON, "MAGGIE@@@@@", $96, $66, METAL_COAT, 50082, "FOREST@@@@@", TRADE_GENDER_EITHER
|
||||
assert_table_length NUM_NPC_TRADES
|
||||
|
@@ -1,9 +1,12 @@
|
||||
NUM_ODD_EGGS EQU 14
|
||||
|
||||
prob: MACRO
|
||||
prob_total = prob_total + (\1)
|
||||
dw prob_total * $ffff / 100
|
||||
ENDM
|
||||
|
||||
OddEggProbabilities:
|
||||
table_width 2, OddEggProbabilities
|
||||
prob_total = 0
|
||||
; Pichu
|
||||
prob 8
|
||||
@@ -26,8 +29,10 @@ prob_total = 0
|
||||
; Tyrogue
|
||||
prob 10
|
||||
prob 1
|
||||
assert_table_length NUM_ODD_EGGS
|
||||
|
||||
OddEggs:
|
||||
table_width NICKNAMED_MON_STRUCT_LENGTH, OddEggs
|
||||
|
||||
db PICHU
|
||||
db NO_ITEM
|
||||
@@ -392,3 +397,5 @@ OddEggs:
|
||||
bigdw 9 ; SAtk
|
||||
bigdw 9 ; SDef
|
||||
db "EGG@@@@@@@@"
|
||||
|
||||
assert_table_length NUM_ODD_EGGS
|
||||
|
Reference in New Issue
Block a user