summaryrefslogtreecommitdiff
path: root/engine/items
diff options
context:
space:
mode:
author2Tie <foxman95@ymail.com>2018-11-29 01:50:18 -0700
committer2Tie <foxman95@ymail.com>2018-11-29 01:50:18 -0700
commit7564f1a7c2a24d4c0c03c7910378adc7cec73749 (patch)
tree86b741b87c60758a83c7713890d1d0fbcf73ba71 /engine/items
parente32b8420675450097b25078612235de3d2635ea7 (diff)
Disassembled the rest of the code in bank 4 as far as i can tell. Lines 899, 1538, and 1631 in engine/menu/start_menu.asm have hardcoded jumps that i couldn't figure out how to make work myself.
Diffstat (limited to 'engine/items')
-rw-r--r--engine/items/tmhm.asm50
1 files changed, 50 insertions, 0 deletions
diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm
new file mode 100644
index 0000000..d2c4872
--- /dev/null
+++ b/engine/items/tmhm.asm
@@ -0,0 +1,50 @@
+INCLUDE "constants.asm"
+
+SECTION "engine/items/tmhm.asm", ROMX
+
+CanLearnTMHMMove: ; 04:528f
+; Gets the index of TM or HM with move ID wce32,
+; then checks the corresponding flag in wMonDexIndex'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, [wMonDexIndex]
+ ld [wCurSpecies], a
+ call GetMonHeader
+ 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: ; 04:52C1
+; 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 \ No newline at end of file