pokegold-spaceworld/engine/items/tmhm.asm
DrippingYellow ce247cc761
Some checks failed
CI / build (push) Has been cancelled
Adding bank14, good chunk of text transcribed and labelled in bank0d, renaming farcall to callab, and much more (#112)
* Sporadic constantifying and function naming

* Added bank 14

* Delete .DS_Store files

* Delete EOL whitespace

* Use Tab indents instead of four spaces

* Identify some routines

* Identify more stuff

* Identified party and box structs

* Identified wBattleMon and wEnemyMon structs

* Macro'd landmarks, cleaned up comments

---------

Co-authored-by: vulcandth <vulcandth@gmail.com>
2025-01-16 12:12:38 -06:00

51 lines
815 B
NASM

INCLUDE "constants.asm"
SECTION "engine/items/tmhm.asm", ROMX
CanLearnTMHMMove:
; Gets the index of TM or HM with move ID wce32,
; 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, 01
bit 1, a
ret nz
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld hl, wMonHLearnset
push hl
ld a, [wce32]
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, 2 ;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