2017-12-15 04:00:54 +00:00
|
|
|
; Used in data/pokemon/base_stats/*.asm
|
2017-12-14 05:36:24 +00:00
|
|
|
|
2017-12-28 12:23:44 +00:00
|
|
|
define: MACRO
|
2015-06-30 02:24:45 +00:00
|
|
|
if !def(\1)
|
2017-12-28 12:23:44 +00:00
|
|
|
\1 EQUS \2
|
2015-06-30 02:24:45 +00:00
|
|
|
endc
|
2017-12-28 21:31:16 +00:00
|
|
|
ENDM
|
2015-06-30 02:24:45 +00:00
|
|
|
|
|
|
|
const_value = 0
|
|
|
|
|
|
|
|
add_tm: MACRO
|
|
|
|
if !def(TM01)
|
|
|
|
TM01 = const_value
|
|
|
|
enum_start 1
|
|
|
|
endc
|
|
|
|
define _\@_1, "TM_\1"
|
|
|
|
const _\@_1
|
|
|
|
enum \1_TMNUM
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
add_hm: MACRO
|
|
|
|
if !def(HM01)
|
|
|
|
HM01 = const_value
|
|
|
|
endc
|
|
|
|
define _\@_1, "HM_\1"
|
|
|
|
const _\@_1
|
|
|
|
enum \1_TMNUM
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
add_mt: MACRO
|
|
|
|
enum \1_TMNUM
|
|
|
|
ENDM
|
|
|
|
|
2017-12-09 18:28:23 +00:00
|
|
|
; N TMs/HMs need (N+7)/8 bytes for their bit flags.
|
|
|
|
; The rgbasm integers tms1, tms2, tms3 each hold 3 bytes, or 24 bits.
|
2015-06-30 02:24:45 +00:00
|
|
|
tmhm: MACRO
|
2017-12-09 18:28:23 +00:00
|
|
|
tms1 = 0
|
|
|
|
tms2 = 0
|
|
|
|
tms3 = 0
|
|
|
|
rept _NARG
|
2015-06-30 02:24:45 +00:00
|
|
|
if def(\1_TMNUM)
|
2017-12-09 18:28:23 +00:00
|
|
|
if \1_TMNUM < 24 + 1
|
|
|
|
tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
|
|
|
|
elif \1_TMNUM < 48 + 1
|
|
|
|
tms2 = tms2 | (1 << ((\1_TMNUM) - 1 - 24))
|
2015-06-30 02:24:45 +00:00
|
|
|
else
|
2017-12-09 18:28:23 +00:00
|
|
|
tms3 = tms3 | (1 << ((\1_TMNUM) - 1 - 48))
|
2015-06-30 02:24:45 +00:00
|
|
|
endc
|
|
|
|
else
|
|
|
|
fail "\1 is not a TM, HM, or move tutor move"
|
|
|
|
endc
|
|
|
|
shift
|
2017-12-09 18:28:23 +00:00
|
|
|
endr
|
2015-06-30 02:24:45 +00:00
|
|
|
|
2017-12-09 18:28:23 +00:00
|
|
|
rept 3
|
|
|
|
db tms1 & $ff
|
|
|
|
tms1 = tms1 >> 8
|
|
|
|
endr
|
|
|
|
rept 3
|
|
|
|
db tms2 & $ff
|
|
|
|
tms2 = tms2 >> 8
|
|
|
|
endr
|
|
|
|
rept 2
|
|
|
|
db tms3 & $ff
|
|
|
|
tms3 = tms3 >> 8
|
|
|
|
endr
|
2015-06-30 02:24:45 +00:00
|
|
|
ENDM
|