aboutsummaryrefslogtreecommitdiffstats
path: root/engine/items/get_bag_item_quantity.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/items/get_bag_item_quantity.asm
parentMerge pull request #55 from Deokishisu/patch-1 (diff)
downloadpokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip
Sync with pokered
Diffstat (limited to 'engine/items/get_bag_item_quantity.asm')
-rw-r--r--engine/items/get_bag_item_quantity.asm18
1 files changed, 18 insertions, 0 deletions
diff --git a/engine/items/get_bag_item_quantity.asm b/engine/items/get_bag_item_quantity.asm
new file mode 100644
index 00000000..f10df1a0
--- /dev/null
+++ b/engine/items/get_bag_item_quantity.asm
@@ -0,0 +1,18 @@
+GetQuantityOfItemInBag:
+; In: b = item ID
+; Out: b = how many of that item are in the bag
+ call GetPredefRegisters
+ ld hl, wNumBagItems
+.loop
+ inc hl
+ ld a, [hli]
+ cp $ff
+ jr z, .notInBag
+ cp b
+ jr nz, .loop
+ ld a, [hl]
+ ld b, a
+ ret
+.notInBag
+ ld b, 0
+ ret