mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 18:30:50 +12:00

Also used in PureRGB. Gives the player the option to use another Repel after the last one runs out. I had to remove some debug features in order to fit it in, but it won't have an effect on the regular game. Hopefully.
39 lines
516 B
NASM
39 lines
516 B
NASM
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
|
|
|
|
GetIndexOfItemInBag:
|
|
; In: b = item ID
|
|
; Out: b = index of item in bag (FF if not)
|
|
call GetPredefRegisters
|
|
ld hl, wBagItems - 1
|
|
ld c, -1
|
|
.loop
|
|
inc c
|
|
inc hl
|
|
ld a, [hli]
|
|
cp $ff
|
|
jr z, .notInBag
|
|
cp b
|
|
jr nz, .loop
|
|
ld b, c
|
|
ret
|
|
.notInBag
|
|
ld b, a
|
|
ret
|