summaryrefslogtreecommitdiff
path: root/constants
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-06 16:53:05 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-06 16:53:05 -0400
commit43a92957899b0f14c1c60cb533f298d08c16a72b (patch)
tree6956a1321968c6ba8c8c08a5dc812f36d5d5aabc /constants
parentddf1163a2135f23ec3edf51086f8cb5f83147b21 (diff)
add_tm, add_hm, and add_mt define TM##_MOVE, HM##_MOVE, and MT##_MOVE constants, to avoid repeating the move names in tmhm_moves.asm
Diffstat (limited to 'constants')
-rw-r--r--constants/item_constants.asm44
1 files changed, 42 insertions, 2 deletions
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 98493a5a0..fa2b1a4d0 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -198,10 +198,22 @@
const ITEM_BE ; be
add_tm: MACRO
+; Defines three constants:
+; - TM_\1: the item id, starting at $bf
+; - \1_TMNUM: the learnable TM/HM flag, starting at 1
+; - TM##_MOVE: alias for the move id, equal to the value of \1
+; The first usage also defines TM01 as the first TM item id.
if !DEF(TM01)
TM01 EQU const_value
enum_start 1
endc
+if __enum__ < 10
+MOVE_FOR_TM EQUS "TM0{d:__enum__}_MOVE"
+else
+MOVE_FOR_TM EQUS "TM{d:__enum__}_MOVE"
+endc
+MOVE_FOR_TM = \1
+PURGE MOVE_FOR_TM
const TM_\1
enum \1_TMNUM
ENDM
@@ -259,12 +271,26 @@ ENDM
add_tm FIRE_PUNCH ; f0
add_tm FURY_CUTTER ; f1
add_tm NIGHTMARE ; f2
-NUM_TMS EQU const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
+NUM_TMS EQU __enum__ - 1
add_hm: MACRO
+; Defines three constants:
+; - HM_\1: the item id, starting at $f3
+; - \1_TMNUM: the learnable TM/HM flag, starting at 51
+; - HM##_MOVE: alias for the move id, equal to the value of \1
+; The first usage also defines HM01 as the first TM item id.
if !DEF(HM01)
HM01 EQU const_value
endc
+HM_VALUE EQU __enum__ - NUM_TMS
+if HM_VALUE < 10
+MOVE_FOR_HM EQUS "HM0{d:HM_VALUE}_MOVE"
+else
+MOVE_FOR_HM EQUS "HM{d:HM_VALUE}_MOVE"
+endc
+MOVE_FOR_HM = \1
+PURGE MOVE_FOR_HM
+PURGE HM_VALUE
const HM_\1
enum \1_TMNUM
ENDM
@@ -276,15 +302,29 @@ ENDM
add_hm FLASH ; f7
add_hm WHIRLPOOL ; f8
add_hm WATERFALL ; f9
-NUM_HMS EQU const_value - HM01
+NUM_HMS EQU __enum__ - NUM_TMS - 1
add_mt: MACRO
+; Defines two constants:
+; - \1_TMNUM: the learnable TM/HM flag, starting at 58
+; - MT##_MOVE: alias for the move id, equal to the value of \1
+MT_VALUE EQU __enum__ - NUM_TMS - NUM_HMS
+if MT_VALUE < 10
+MOVE_FOR_MT EQUS "MT0{d:MT_VALUE}_MOVE"
+else
+MOVE_FOR_MT EQUS "MT{d:MT_VALUE}_MOVE"
+endc
+MOVE_FOR_MT = \1
+PURGE MOVE_FOR_MT
+PURGE MT_VALUE
enum \1_TMNUM
ENDM
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
+NUM_TUTORS = __enum__ - NUM_TMS - NUM_HMS - 1
+
NUM_TM_HM_TUTOR EQU __enum__ - 1
const ITEM_FA ; fa