diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-03-03 22:22:41 -0500 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-03-04 00:15:03 -0500 |
| commit | 40902ffe244544d638567642e4e01b9c5801db23 (patch) | |
| tree | 4abf9ac20786fdf66bb298b3ec7935cef2c71d07 /data/moves | |
| parent | 9c17fb14c8068d6662b9ca1cb048ed206b6770ee (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/moves')
| -rw-r--r-- | data/moves/animations.asm | 4 | ||||
| -rw-r--r-- | data/moves/descriptions.asm | 3 | ||||
| -rw-r--r-- | data/moves/effects_pointers.asm | 2 | ||||
| -rw-r--r-- | data/moves/moves.asm | 4 | ||||
| -rw-r--r-- | data/moves/tmhm_moves.asm | 3 |
5 files changed, 15 insertions, 1 deletions
diff --git a/data/moves/animations.asm b/data/moves/animations.asm index bba0d186f..87b904c0f 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -1,5 +1,6 @@ BattleAnimations:: ; entries correspond to constants/move_constants.asm + table_width 2, BattleAnimations dw BattleAnim_0 dw BattleAnim_Pound dw BattleAnim_KarateChop @@ -252,10 +253,12 @@ BattleAnimations:: dw BattleAnim_RockSmash dw BattleAnim_Whirlpool dw BattleAnim_BeatUp + assert_table_length NUM_ATTACKS + 1 dw BattleAnim_252 dw BattleAnim_253 dw BattleAnim_254 dw BattleAnim_SweetScent2 + assert_table_length $100 ; $100 dw BattleAnim_ThrowPokeBall dw BattleAnim_SendOutMon @@ -279,6 +282,7 @@ BattleAnimations:: dw BattleAnim_Wobble dw BattleAnim_Shake dw BattleAnim_HitConfusion + assert_table_length NUM_BATTLE_ANIMS + 1 BattleAnim_0: BattleAnim_252: diff --git a/data/moves/descriptions.asm b/data/moves/descriptions.asm index 1d2e5b37f..697be13ee 100644 --- a/data/moves/descriptions.asm +++ b/data/moves/descriptions.asm @@ -1,5 +1,6 @@ MoveDescriptions:: ; entries correspond to move ids (see constants/move_constants.asm) + table_width 2, MoveDescriptions dw PoundDescription dw KarateChopDescription dw DoubleslapDescription @@ -251,11 +252,13 @@ MoveDescriptions:: dw RockSmashDescription dw WhirlpoolDescription dw BeatUpDescription + assert_table_length NUM_ATTACKS dw MoveFCDescription dw MoveFDDescription dw MoveFEDescription dw MoveFFDescription dw Move00Description + assert_table_length $100 MoveFCDescription: MoveFDDescription: diff --git a/data/moves/effects_pointers.asm b/data/moves/effects_pointers.asm index 94834de71..6f8fb2e99 100644 --- a/data/moves/effects_pointers.asm +++ b/data/moves/effects_pointers.asm @@ -1,5 +1,6 @@ MoveEffectsPointers: ; entries correspond to EFFECT_* constants + table_width 2, MoveEffectsPointers dw NormalHit dw DoSleep dw PoisonHit @@ -157,3 +158,4 @@ MoveEffectsPointers: dw BeatUp dw Fly dw DefenseCurl + assert_table_length NUM_MOVE_EFECTS diff --git a/data/moves/moves.asm b/data/moves/moves.asm index 49c17d9bc..31f9d27d0 100644 --- a/data/moves/moves.asm +++ b/data/moves/moves.asm @@ -11,7 +11,8 @@ move: MACRO ENDM Moves: -; entries correspond to constants/move_constants.asm +; entries correspond to move ids (see constants/move_constants.asm) + table_width MOVE_LENGTH, Moves move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0 move KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, 100, 25, 0 move DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, 85, 10, 0 @@ -263,3 +264,4 @@ Moves: move ROCK_SMASH, EFFECT_DEFENSE_DOWN_HIT, 20, FIGHTING, 100, 15, 50 move WHIRLPOOL, EFFECT_TRAP_TARGET, 15, WATER, 70, 15, 0 move BEAT_UP, EFFECT_BEAT_UP, 10, DARK, 100, 10, 0 + assert_table_length NUM_ATTACKS diff --git a/data/moves/tmhm_moves.asm b/data/moves/tmhm_moves.asm index 28f28c24d..7ecf9fec8 100644 --- a/data/moves/tmhm_moves.asm +++ b/data/moves/tmhm_moves.asm @@ -3,6 +3,7 @@ TMHMMoves: ; entries correspond to *_TMNUM constants (see constants/item_constants.asm) + table_width 1, TMHMMoves ; TMs n = 1 @@ -43,4 +44,6 @@ PURGE MOVE_FOR_MT n = n + 1 endr + assert_table_length NUM_TM_HM_TUTOR + db 0 ; end |
