ref: 5037adc55f12805533943cc0170968c95da0b8db
parent: 90ce12613935999ec0675317e73725521925d32e
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Mar 21 16:09:34 EDT 2021
Clean up some macro definitions
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -200,6 +200,11 @@
__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 @@
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 @@
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 @@
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 @@
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
--- a/macros/scripts/audio.asm
+++ b/macros/scripts/audio.asm
@@ -50,8 +50,8 @@
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
--- a/macros/scripts/battle_anims.asm
+++ b/macros/scripts/battle_anims.asm
@@ -1,11 +1,11 @@
-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