aboutsummaryrefslogtreecommitdiffstats
path: root/engine/items/get_bag_item_quantity.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-02 23:30:21 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-02 23:30:21 -0400
commitf275790aec4a796ed969b099364abfdf25385967 (patch)
treec56edfd01a61e9aa0e3c3ee8a046e66b5a1984e4 /engine/items/get_bag_item_quantity.asm
parentActually run .travis/webhook.sh (diff)
downloadpokeyellow-f275790aec4a796ed969b099364abfdf25385967.tar.gz
pokeyellow-f275790aec4a796ed969b099364abfdf25385967.tar.xz
pokeyellow-f275790aec4a796ed969b099364abfdf25385967.zip
Add subdirectories to engine/ similar to pokecrystal
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