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-05 16:10:25 -0500 |
commit | 5454e1e0deefc6b4fc8c4de0e63314052fceebc0 (patch) | |
tree | 565805b252fa596aab3f80b3128ebc91b1fae540 /engine/overworld/map_objects.asm | |
parent | b423e94be700cc6434465cf1dcccf0b677489192 (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 'engine/overworld/map_objects.asm')
-rw-r--r-- | engine/overworld/map_objects.asm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index c30bc695..9da9cdb0 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -523,7 +523,8 @@ StepFunction_FromMovement: ret .Pointers: -; entries correspond to SPRITEMOVEFN_* constants +; entries correspond to SPRITEMOVEFN_* constants (see constants/map_object_constants.asm) + table_width 2, StepFunction_FromMovement.Pointers dw MovementFunction_Null ; 00 dw MovementFunction_RandomWalkY ; 01 dw MovementFunction_RandomWalkX ; 02 @@ -552,6 +553,7 @@ StepFunction_FromMovement: dw MovementFunction_SpinCounterclockwise ; 19 dw MovementFunction_BoulderDust ; 1a dw MovementFunction_ShakingGrass ; 1b + assert_table_length NUM_SPRITEMOVEFN MovementFunction_Null: ret @@ -1085,7 +1087,8 @@ _SetRandomStepDuration: ret StepTypesJumptable: -; entries correspond to STEP_TYPE_* constants +; entries correspond to STEP_TYPE_* constants (see constants/map_object_constants.asm) + table_width 2, StepTypesJumptable dw StepFunction_Reset ; 00 dw StepFunction_FromMovement ; 01 dw StepFunction_NPCWalk ; 02 @@ -1111,6 +1114,7 @@ StepTypesJumptable: dw StepFunction_16 ; 16 dw StepFunction_17 ; 17 dw StepFunction_Delete ; 18 + assert_table_length NUM_STEP_TYPES WaitStep_InPlace: ld hl, OBJECT_STEP_DURATION |