pokegold-spaceworld/engine/items/tmhm.asm
Narishma-gb e88fe24e15
Use the same Makefile build system as Gen 1+2 repos (#163)
This uses catch-all files like main.asm to reduce the total quantity and size of
build objects (from 1.1 GB to 70 MB).

---------

Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
2026-07-05 15:36:09 -04:00

47 lines
783 B
NASM

CanLearnTMHMMove:
; Gets the index of TM or HM with move ID wPutativeTMHMMove,
; then checks the corresponding flag in wCurPartySpecies's learnset.
; Sets register c to 1 if TM/HM is in learnset OR if debug is enabled.
ld a, [wDebugFlags]
ld c, 1
bit DEBUG_FIELD_F, a
ret nz
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld hl, wMonHLearnset
push hl
ld a, [wPutativeTMHMMove]
ld b, a
ld c, 0
ld hl, TMHMMoves
.loop
ld a, [hli]
cp b
jr z, .jump
inc c
jr .loop
.jump
pop hl
ld b, CHECK_FLAG
push de
ld d, 0
predef SmallFarFlagAction
pop de
ret
GetTMHMMove:
; converts TM/HM list index to TM/HM move ID
ld a, [wNamedObjectIndexBuffer]
dec a
ld hl, TMHMMoves
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
ret