Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/home/item.asm
1270 views
1
; uses an item
2
; UseItem is used with dummy items to perform certain other functions as well
3
; INPUT:
4
; [wCurItem] = item ID
5
; OUTPUT:
6
; [wActionResultOrTookBattleTurn] = success
7
; 00: unsuccessful
8
; 01: successful
9
; 02: not able to be used right now, no extra menu displayed (only certain items use this)
10
UseItem::
11
farjp UseItem_
12
13
; confirms the item toss and then tosses the item
14
; INPUT:
15
; hl = address of inventory (either wNumBagItems or wNumBoxItems)
16
; [wCurItem] = item ID
17
; [wWhichPokemon] = index of item within inventory
18
; [wItemQuantity] = quantity to toss
19
; OUTPUT:
20
; clears carry flag if the item is tossed, sets carry flag if not
21
TossItem::
22
ldh a, [hLoadedROMBank]
23
push af
24
ld a, BANK(TossItem_)
25
ldh [hLoadedROMBank], a
26
ld [rROMB], a
27
call TossItem_
28
pop de
29
ld a, d
30
ldh [hLoadedROMBank], a
31
ld [rROMB], a
32
ret
33
34
; checks if an item is a key item
35
; INPUT:
36
; [wCurItem] = item ID
37
; OUTPUT:
38
; [wIsKeyItem] = result
39
; 00: item is not key item
40
; 01: item is key item
41
IsKeyItem::
42
push hl
43
push de
44
push bc
45
farcall IsKeyItem_
46
pop bc
47
pop de
48
pop hl
49
ret
50
51