summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-03-21 20:09:39 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-03-21 20:09:39 -0400
commitb4ee57c480cf937ccd68495e7f4a56b3edbeddd8 (patch)
tree428c8cf9ad413f7e4d7ffb03f417a9ff0eb94abb
parentaa3a3224c6077e7f7c9e05b402ecd5e023aac88f (diff)
Clean up some macro definitions
-rw-r--r--constants/item_constants.asm13
-rw-r--r--macros/scripts/audio.asm2
-rw-r--r--macros/scripts/battle_anims.asm10
3 files changed, 14 insertions, 11 deletions
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 84a00b98..519104f8 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
@@ -308,7 +311,7 @@ ENDM
add_hm WATERFALL ; f9
NUM_HMS EQU __tmhm_value__ - NUM_TMS - 1
-NUM_TM_HM EQU __tmhm_value__ - 1
+NUM_TM_HM EQU NUM_TMS + NUM_HMS
const ITEM_FA ; fa
diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm
index 127f2d1e..171f50f4 100644
--- a/macros/scripts/audio.asm
+++ b/macros/scripts/audio.asm
@@ -51,7 +51,7 @@ 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
+ 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 6dc21e5f..9754574f 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