Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/events/pick_up_item.asm
1271 views
1
PickUpItem:
2
call EnableAutoTextBoxDrawing
3
4
ldh a, [hSpriteIndex]
5
ld b, a
6
ld hl, wMissableObjectList
7
.missableObjectsListLoop
8
ld a, [hli]
9
cp $ff
10
ret z
11
cp b
12
jr z, .isMissable
13
inc hl
14
jr .missableObjectsListLoop
15
16
.isMissable
17
ld a, [hl]
18
ldh [hMissableObjectIndex], a
19
20
ld hl, wMapSpriteExtraData
21
ldh a, [hSpriteIndex]
22
dec a
23
add a
24
ld d, 0
25
ld e, a
26
add hl, de
27
ld a, [hl]
28
ld b, a ; item
29
ld c, 1 ; quantity
30
call GiveItem
31
jr nc, .BagFull
32
33
ldh a, [hMissableObjectIndex]
34
ld [wMissableObjectIndex], a
35
predef HideObject
36
ld a, 1
37
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
38
ld hl, FoundItemText
39
jr .print
40
41
.BagFull
42
ld hl, NoMoreRoomForItemText
43
.print
44
call PrintText
45
ret
46
47
FoundItemText:
48
text_far _FoundItemText
49
sound_get_item_1
50
text_end
51
52
NoMoreRoomForItemText:
53
text_far _NoMoreRoomForItemText
54
text_end
55
56