summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/items/tms.asm12
1 files changed, 9 insertions, 3 deletions
diff --git a/engine/items/tms.asm b/engine/items/tms.asm
index 7d00f7f3..9621e550 100755
--- a/engine/items/tms.asm
+++ b/engine/items/tms.asm
@@ -1,5 +1,5 @@
; tests if mon [wcf91] can learn move [wMoveNum]
-CanLearnTM: ; 1373e (4:773e)
+CanLearnTM: ; 122f0 (4:62f0)
ld a, [wcf91]
ld [wd0b5], a
call GetMonHeader
@@ -11,6 +11,8 @@ CanLearnTM: ; 1373e (4:773e)
ld hl, TechnicalMachines
.findTMloop
ld a, [hli]
+ cp $ff ; reached terminator?
+ jr z, .done
cp b
jr z, .TMfoundLoop
inc c
@@ -19,10 +21,14 @@ CanLearnTM: ; 1373e (4:773e)
pop hl
ld b, FLAG_TEST
predef_jump FlagActionPredef
-
+.done
+ pop hl
+ ld c, 0
+ ret
+
; converts TM/HM number in wd11e into move number
; HMs start at 51
-TMToMove: ; 13763 (4:7763)
+TMToMove: ; 1231d (4:631d)
ld a, [wd11e]
dec a
ld hl, TechnicalMachines