shithub: pokered

ref: 98f09b6d26b1f83bdf1779cfe63a73b8a4265aef
dir: /engine/get_bag_item_quantity.asm/

View raw version
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