From 5647ca687b92954dcf37a6ea6bfbc9a341c32de4 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Wed, 4 Nov 2020 00:06:44 -0600 Subject: Sync with pokered --- engine/items/get_bag_item_quantity.asm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 engine/items/get_bag_item_quantity.asm (limited to 'engine/items/get_bag_item_quantity.asm') 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 -- cgit v1.3.1-sl0p