From 5037adc55f12805533943cc0170968c95da0b8db Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 21 Mar 2021 20:09:34 -0400 Subject: [PATCH] Clean up some macro definitions --- constants/item_constants.asm | 16 +++++++++------- macros/scripts/audio.asm | 4 ++-- macros/scripts/battle_anims.asm | 10 +++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/constants/item_constants.asm b/constants/item_constants.asm index fc24deb05..55b89cfcd 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -200,6 +200,11 @@ NUM_ITEMS EQU const_value - 1 __tmhm_value__ = 1 +add_tmnum: MACRO +\1_TMNUM EQU __tmhm_value__ +__tmhm_value__ = __tmhm_value__ + 1 +ENDM + add_tm: MACRO ; Defines three constants: ; - TM_\1: the item id, starting at $bf @@ -217,8 +222,7 @@ endc MOVE_FOR_TM = \1 PURGE MOVE_FOR_TM const TM_\1 -\1_TMNUM EQU __tmhm_value__ -__tmhm_value__ = __tmhm_value__ + 1 + add_tmnum \1 ENDM ; see data/moves/tmhm_moves.asm for moves @@ -295,8 +299,7 @@ MOVE_FOR_HM = \1 PURGE MOVE_FOR_HM PURGE HM_VALUE const HM_\1 -\1_TMNUM EQU __tmhm_value__ -__tmhm_value__ = __tmhm_value__ + 1 + add_tmnum \1 ENDM add_hm CUT ; f3 @@ -321,8 +324,7 @@ endc MOVE_FOR_MT = \1 PURGE MOVE_FOR_MT PURGE MT_VALUE -\1_TMNUM EQU __tmhm_value__ -__tmhm_value__ = __tmhm_value__ + 1 + add_tmnum \1 ENDM add_mt FLAMETHROWER @@ -330,7 +332,7 @@ ENDM add_mt ICE_BEAM NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1 -NUM_TM_HM_TUTOR EQU __tmhm_value__ - 1 +NUM_TM_HM_TUTOR EQU NUM_TMS + NUM_HMS + NUM_TUTORS const ITEM_FA ; fa diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index 127f2d1e3..e28dee7e1 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -50,8 +50,8 @@ FIRST_MUSIC_CMD EQU const_value const octave_cmd ; $d0 octave: MACRO - assert 0 < (\1) && (\1) < 8, "octave must be 1-8" - db octave_cmd | 8 - (\1) ; octave + assert 1 <= (\1) && (\1) <= 8, "octave must be 1-8" + db octave_cmd + 8 - (\1) ; octave ENDM const_skip 7 ; all octave values diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm index 6dc21e5fc..9754574f7 100644 --- a/macros/scripts/battle_anims.asm +++ b/macros/scripts/battle_anims.asm @@ -1,12 +1,12 @@ -anim_wait: MACRO - assert (\1) < $d0, "anim_wait argument must be less than $d0" - db \1 -ENDM - ; BattleAnimCommands indexes (see engine/battle_anims/anim_commands.asm) const_def $d0 FIRST_BATTLE_ANIM_CMD EQU const_value +anim_wait: MACRO + assert (\1) < FIRST_BATTLE_ANIM_CMD, "anim_wait argument must be less than {FIRST_BATTLE_ANIM_CMD}" + db \1 +ENDM + const anim_obj_command ; $d0 anim_obj: MACRO db anim_obj_command