aboutsummaryrefslogtreecommitdiffstats
path: root/engine/get_bag_item_quantity.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 18:00:47 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 18:00:54 -0400
commitb6d2115df4b4f9d86be898292fca473222941f1d (patch)
tree530796fd3f2b356d6af8442d6f6b1352b08012e1 /engine/get_bag_item_quantity.asm
parentSplit bank1 up. (diff)
downloadpokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.tar.gz
pokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.tar.xz
pokeyellow-b6d2115df4b4f9d86be898292fca473222941f1d.zip
Split bank3 up.
Diffstat (limited to 'engine/get_bag_item_quantity.asm')
-rw-r--r--engine/get_bag_item_quantity.asm18
1 files changed, 18 insertions, 0 deletions
diff --git a/engine/get_bag_item_quantity.asm b/engine/get_bag_item_quantity.asm
new file mode 100644
index 00000000..2a462b5d
--- /dev/null
+++ b/engine/get_bag_item_quantity.asm
@@ -0,0 +1,18 @@
+GetQuantityOfItemInBag: ; f735 (3:7735)
+; 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 \ No newline at end of file