diff options
author | Pokeglitch <pokeglitchx@gmail.com> | 2018-06-13 21:05:24 -0400 |
---|---|---|
committer | Pokeglitch <pokeglitchx@gmail.com> | 2018-06-13 21:05:24 -0400 |
commit | b84c9c4974c6e9fecfab0cbdee9879815c62dff0 (patch) | |
tree | f6cd5ba969dc6b7fd790a634780e8cce431612d2 /engine/items | |
parent | f7f29000a85389291798ec5d97b51dc65e7b500e (diff) |
Extracted a few more bank 3 routines
Diffstat (limited to 'engine/items')
-rwxr-xr-x | engine/items/inventory.asm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 4a95bac..3a397eb 100755 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -570,6 +570,29 @@ GetTMHMNumber: ; 03:4CFF .not_machine
and a
ret
+
+GetNumberedTMHM: ; 03:4D1A
+; Return the item id of a TM/HM by number c.
+ ld a, c
+ ld c, 0
+; Adjust for any dummy items.
+ cp ITEM_C8 - ITEM_TM01 ; TM01-04
+ jr c, .adjust
+ inc c
+ cp ITEM_E1 - ITEM_TM01 - 1 ; TM28 - TM05
+ jr c, .adjust
+ inc c
+ cp ITEM_FF - ITEM_TM01 - 2 ; End of list
+ jr nc, .dont_adjust
+.adjust
+ add c
+ add ITEM_TM01
+ ld c, a
+ scf
+ ret
+.dont_adjust
+ and a
+ ret
SECTION "_CheckTossableItem", ROMX[$53AD], BANK[$03]
|