summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-03-11 16:28:52 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2021-03-11 16:31:40 -0500
commitdc17d58170e80c4679c391017492da613fea3236 (patch)
treef082094bb56a6cff255a34c5b1e43aaa3ee7c477
parent0d185fbd88a5fa3d205553555d75c1c0ee397ec6 (diff)
Verify script command table sizes
-rw-r--r--audio/engine.asm2
-rw-r--r--engine/battle_anims/anim_commands.asm2
-rw-r--r--engine/overworld/movement.asm2
-rw-r--r--engine/overworld/scripting.asm2
-rw-r--r--home/text.asm2
-rw-r--r--macros/scripts/battle_anims.asm1
-rw-r--r--macros/scripts/events.asm2
-rw-r--r--macros/scripts/movement.asm2
-rw-r--r--macros/scripts/text.asm2
9 files changed, 17 insertions, 0 deletions
diff --git a/audio/engine.asm b/audio/engine.asm
index 7a7d2f9a..9149223e 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1365,6 +1365,7 @@ ParseMusicCommand:
MusicCommands:
; entries correspond to audio constants (see macros/scripts/audio.asm)
+ table_width 2, MusicCommands
dw Music_Octave8
dw Music_Octave7
dw Music_Octave6
@@ -1413,6 +1414,7 @@ MusicCommands:
dw Music_Loop
dw Music_Call
dw Music_Ret
+ assert_table_length $100 - FIRST_MUSIC_CMD
MusicF1:
MusicF2:
diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm
index 9d9e6ef5..52245d6a 100644
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -302,6 +302,7 @@ RunBattleAnimCommand:
BattleAnimCommands::
; entries correspond to anim_* constants (see macros/scripts/battle_anims.asm)
+ table_width 2, BattleAnimCommands
dw BattleAnimCmd_Obj
dw BattleAnimCmd_1GFX
dw BattleAnimCmd_2GFX
@@ -350,6 +351,7 @@ BattleAnimCommands::
dw BattleAnimCmd_Loop
dw BattleAnimCmd_Call
dw BattleAnimCmd_Ret
+ assert_table_length $100 - FIRST_BATTLE_ANIM_CMD
BattleAnimCmd_E8:
BattleAnimCmd_E9:
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index 4c90c92d..795f0cdc 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -1,5 +1,6 @@
MovementPointers:
; entries correspond to movement_* constants (see macros/scripts/movement.asm)
+ table_width 2, MovementPointers
dw Movement_turn_head_down ; 00
dw Movement_turn_head_up ; 01
dw Movement_turn_head_left ; 02
@@ -89,6 +90,7 @@ MovementPointers:
dw Movement_tree_shake ; 56
dw Movement_rock_smash ; 57
dw Movement_return_dig ; 58
+ assert_table_length NUM_MOVEMENT_CMDS
Movement_teleport_from:
ld hl, OBJECT_STEP_TYPE
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index c2909437..631ee418 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -63,6 +63,7 @@ RunScriptCommand:
ScriptCommandTable:
; entries correspond to *_command constants (see macros/scripts/events.asm)
+ table_width 2, ScriptCommandTable
dw Script_scall ; 00
dw Script_farscall ; 01
dw Script_memcall ; 02
@@ -225,6 +226,7 @@ ScriptCommandTable:
dw Script_halloffame ; 9f
dw Script_credits ; a0
dw Script_warpfacing ; a1
+ assert_table_length NUM_EVENT_COMMANDS
StartScript:
ld hl, wScriptFlags
diff --git a/home/text.asm b/home/text.asm
index 5c90be52..36fda27b 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -613,6 +613,7 @@ DoTextUntilTerminator::
TextCommands::
; entries correspond to TX_* constants (see macros/scripts/text.asm)
+ table_width 2, TextCommands
dw TextCommand_START ; TX_START
dw TextCommand_RAM ; TX_RAM
dw TextCommand_BCD ; TX_BCD
@@ -636,6 +637,7 @@ TextCommands::
dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER
dw TextCommand_DAY ; TX_DAY
dw TextCommand_FAR ; TX_FAR
+ assert_table_length NUM_TEXT_CMDS
TextCommand_START::
; write text until "@"
diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm
index a6ebe431..6dc21e5f 100644
--- a/macros/scripts/battle_anims.asm
+++ b/macros/scripts/battle_anims.asm
@@ -5,6 +5,7 @@ ENDM
; BattleAnimCommands indexes (see engine/battle_anims/anim_commands.asm)
const_def $d0
+FIRST_BATTLE_ANIM_CMD EQU const_value
const anim_obj_command ; $d0
anim_obj: MACRO
diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm
index dc43eff3..64580a82 100644
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -1009,3 +1009,5 @@ warpfacing: MACRO
db \3 ; x
db \4 ; y
ENDM
+
+NUM_EVENT_COMMANDS EQU const_value
diff --git a/macros/scripts/movement.asm b/macros/scripts/movement.asm
index 2a8f034f..a21a2f1d 100644
--- a/macros/scripts/movement.asm
+++ b/macros/scripts/movement.asm
@@ -213,3 +213,5 @@ return_dig: MACRO
db movement_return_dig
db \1 ; length
ENDM
+
+NUM_MOVEMENT_CMDS EQU const_value
diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm
index f45b7fd1..252481ff 100644
--- a/macros/scripts/text.asm
+++ b/macros/scripts/text.asm
@@ -137,6 +137,8 @@ text_far: MACRO
db BANK(\1)
ENDM
+NUM_TEXT_CMDS EQU const_value
+
const_next $50
const TX_END ; $50