mirror of
https://github.com/pret/pokegold-spaceworld.git
synced 2026-09-08 08:56:24 -05:00
This uses catch-all files like main.asm to reduce the total quantity and size of build objects (from 1.1 GB to 70 MB). --------- Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
44 lines
518 B
NASM
44 lines
518 B
NASM
; Returns carry if user has the item
|
|
; and the amount in b
|
|
GetItemAmount:
|
|
call CheckAmountInItemPocket
|
|
ret c
|
|
call CheckAmountInKeyItems
|
|
ret c
|
|
ld b, 0
|
|
and a
|
|
ret
|
|
|
|
; Returns the amount of item b in b
|
|
CheckAmountInItemPocket:
|
|
ld hl, wItems
|
|
.loop
|
|
inc hl
|
|
ld a, [hli]
|
|
cp -1
|
|
ret z
|
|
cp b
|
|
jr nz, .loop
|
|
|
|
ld a, [hl]
|
|
ld b, a
|
|
scf
|
|
ret
|
|
|
|
; Returns the amount of item b in b
|
|
CheckAmountInKeyItems:
|
|
ld hl, wNumKeyItems
|
|
ld a, [hli]
|
|
and a
|
|
ret z
|
|
|
|
.loop
|
|
ld a, [hli]
|
|
cp -1
|
|
ret z
|
|
cp b
|
|
jr nz, .loop
|
|
ld b, 1
|
|
scf
|
|
ret
|