pokered/engine/items/tms.asm
yenatch 35f2bb90d4 Rename predef functions so they aren't excessive in length.
This is mostly because of an rgbasm bug that prevents macro arguments
from exceeding 16 characters, but the names were bad anyway.
2014-06-16 13:03:05 -07:00

37 lines
647 B
NASM
Executable file

; tests if mon [wcf91] can learn move [wd0e0]
CanLearnTM: ; 1373e (4:773e)
ld a, [wcf91]
ld [wd0b5], a
call GetMonHeader
ld hl, W_MONHLEARNSET
push hl
ld a, [wd0e0]
ld b, a
ld c, $0
ld hl, TechnicalMachines
.findTMloop
ld a, [hli]
cp b
jr z, .TMfoundLoop
inc c
jr .findTMloop
.TMfoundLoop
pop hl
ld b, $2 ; read corresponding bit from TM compatibility array
ld a, $10 ; FlagActionPredef
jp Predef
; converts TM/HM number in wd11e into move number
; HMs start at 51
TMToMove: ; 13763 (4:7763)
ld a, [wd11e]
dec a
ld hl, TechnicalMachines
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [wd11e], a
ret
INCLUDE "data/tms.asm"