Port 'add_tmnum' from pokecrystal

This commit is contained in:
Rangi 2021-04-19 16:30:07 -04:00
parent 8469421892
commit bcc4380d40

View file

@ -118,23 +118,25 @@ NUM_FLOORS EQU const_value - 1 - NUM_ITEMS
; match the actual number below. ; match the actual number below.
NUM_TMS EQU 50 NUM_TMS EQU 50
__tmhm_value__ = NUM_TMS + 1
add_tmnum: MACRO
\1_TMNUM EQU __tmhm_value__
__tmhm_value__ = __tmhm_value__ + 1
ENDM
add_hm: MACRO add_hm: MACRO
; Defines three constants: ; Defines three constants:
; - HM_\1: the item id, starting at $C4 ; - HM_\1: the item id, starting at $C4
; - \1_TMNUM: the learnable TM/HM flag, starting at 51 ; - \1_TMNUM: the learnable TM/HM flag, starting at 51
; - HM##_MOVE: alias for the move id, equal to the value of \1 ; - HM##_MOVE: alias for the move id, equal to the value of \1
; The first usage also defines HM01 as the first HM item id.
IF !DEF(HM01)
HM01 EQU const_value
__tmhm_value__ = NUM_TMS + 1
ENDC
const HM_\1 const HM_\1
\1_TMNUM EQU __tmhm_value__ HM_VALUE = __tmhm_value__ - NUM_TMS
__HM_VALUE = __tmhm_value__ - NUM_TMS HM{02d:HM_VALUE}_MOVE EQU \1
HM{02d:__HM_VALUE}_MOVE EQU \1 add_tmnum \1
__tmhm_value__ = __tmhm_value__ + 1
ENDM ENDM
HM01 EQU const_value
add_hm CUT ; $C4 add_hm CUT ; $C4
add_hm FLY ; $C5 add_hm FLY ; $C5
add_hm SURF ; $C6 add_hm SURF ; $C6
@ -142,22 +144,19 @@ ENDM
add_hm FLASH ; $C8 add_hm FLASH ; $C8
NUM_HMS EQU const_value - HM01 NUM_HMS EQU const_value - HM01
__tmhm_value__ = 1
add_tm: MACRO add_tm: MACRO
; Defines three constants: ; Defines three constants:
; - TM_\1: the item id, starting at $C9 ; - TM_\1: the item id, starting at $C9
; - \1_TMNUM: the learnable TM/HM flag, starting at 1 ; - \1_TMNUM: the learnable TM/HM flag, starting at 1
; - TM##_MOVE: alias for the move id, equal to the value of \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
__tmhm_value__ = 1
ENDC
const TM_\1 const TM_\1
\1_TMNUM EQU __tmhm_value__
TM{02d:__tmhm_value__}_MOVE EQU \1 TM{02d:__tmhm_value__}_MOVE EQU \1
__tmhm_value__ = __tmhm_value__ + 1 add_tmnum \1
ENDM ENDM
TM01 EQU const_value
add_tm MEGA_PUNCH ; $C9 add_tm MEGA_PUNCH ; $C9
add_tm RAZOR_WIND ; $CA add_tm RAZOR_WIND ; $CA
add_tm SWORDS_DANCE ; $CB add_tm SWORDS_DANCE ; $CB