summaryrefslogtreecommitdiff
path: root/engine/items/get_bag_item_quantity.asm
blob: f10df1a0a9c465ff854657cc5d3a3cded4b882f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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