summaryrefslogtreecommitdiff
path: root/engine/items
diff options
context:
space:
mode:
authorPokeglitch <39797359+Pokeglitch@users.noreply.github.com>2018-06-17 07:40:24 -0400
committerGitHub <noreply@github.com>2018-06-17 07:40:24 -0400
commit246f56fd6b882b637559647a943aed976cd9e191 (patch)
treefbd06cb8df0c436c7ae28304db702af78bb867c0 /engine/items
parentc0b094e17a77eb54d6111b6f90ad559e3ffe919f (diff)
parent5b559fd49b42e0c959f5a6373640b0734e3fd602 (diff)
Merge pull request #21 from Pokeglitch/master
More bank 3 routines, plus teleport/spawn
Diffstat (limited to 'engine/items')
-rwxr-xr-xengine/items/inventory.asm41
1 files changed, 30 insertions, 11 deletions
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm
index 4a95bac..9c5a1ec 100755
--- a/engine/items/inventory.asm
+++ b/engine/items/inventory.asm
@@ -6,9 +6,7 @@ _ReceiveItem: ; 03:4AA1
call DoesHLEqualwNumBagItems
jp nz, PutItemInPocket
push hl
- ld hl, CheckItemPocket
- ld a, BANK(CheckItemPocket)
- call FarCall_hl
+ callab CheckItemPocket
ld a, [wItemAttributeParamBuffer]
dec a
ld hl, .Pockets
@@ -47,9 +45,7 @@ _TossItem: ; 03:4AE0
call DoesHLEqualwNumBagItems
jr nz, .remove_item
push hl
- ld hl, CheckItemPocket
- ld a, BANK(CheckItemPocket)
- call FarCall_hl
+ callab CheckItemPocket
ld a, [wItemAttributeParamBuffer]
dec a
ld hl, .Pockets
@@ -90,9 +86,7 @@ _CheckItem: ; 03:4B1E
call DoesHLEqualwNumBagItems
jr nz, .not_bag
push hl
- ld hl, CheckItemPocket
- ld a, BANK(CheckItemPocket)
- call FarCall_hl
+ callab CheckItemPocket
ld a, [wItemAttributeParamBuffer]
dec a
ld hl, .Pockets
@@ -570,10 +564,34 @@ 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, .finish
+ inc c
+ cp ITEM_E1 - ITEM_TM01 - 1 ; TM05-28
+ jr c, .finish
+ inc c
+ cp ITEM_FF - ITEM_TM01 - 2 ; End of list
+ jr nc, .not_machine
+.finish
+ add c
+ add ITEM_TM01
+ ld c, a
+ scf
+ ret
+.not_machine
+ and a
+ ret
SECTION "_CheckTossableItem", ROMX[$53AD], BANK[$03]
-; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be removed from the bag.
+; Return 1 in wItemAttributeParamBuffer and
+; carry if wCurItem can't be removed from the bag.
_CheckTossableItem: ; 03:53AD
ld a, ITEMATTR_PERMISSIONS
call GetItemAttr
@@ -582,7 +600,8 @@ _CheckTossableItem: ; 03:53AD
and a
ret
-; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be selected.
+; Return 1 in wItemAttributeParamBuffer
+; and carry if wCurItem can't be selected.
CheckSelectableItem: ; 03:53B8
ld a, ITEMATTR_PERMISSIONS
call GetItemAttr