Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/scripts/CinnabarLabFossilRoom.asm
1270 views
1
CinnabarLabFossilRoom_Script:
2
jp EnableAutoTextBoxDrawing
3
4
CinnabarLabFossilRoom_TextPointers:
5
def_text_pointers
6
dw_const CinnabarLabFossilRoomScientist1Text, TEXT_CINNABARLABFOSSILROOM_SCIENTIST1
7
dw_const CinnabarLabFossilRoomScientist2Text, TEXT_CINNABARLABFOSSILROOM_SCIENTIST2
8
9
Lab4Script_GetFossilsInBag:
10
; construct a list of all fossils in the player's bag
11
xor a
12
ld [wFilteredBagItemsCount], a
13
ld de, wFilteredBagItems
14
ld hl, FossilsList
15
.loop
16
ld a, [hli]
17
and a
18
jr z, .done
19
push hl
20
push de
21
ld [wTempByteValue], a
22
ld b, a
23
predef GetQuantityOfItemInBag
24
pop de
25
pop hl
26
ld a, b
27
and a
28
jr z, .loop
29
; A fossil is in the bag
30
ld a, [wTempByteValue]
31
ld [de], a
32
inc de
33
push hl
34
ld hl, wFilteredBagItemsCount
35
inc [hl]
36
pop hl
37
jr .loop
38
.done
39
ld a, $ff
40
ld [de], a
41
ret
42
43
FossilsList:
44
db DOME_FOSSIL
45
db HELIX_FOSSIL
46
db OLD_AMBER
47
db 0 ; end
48
49
CinnabarLabFossilRoomScientist1Text:
50
text_asm
51
CheckEvent EVENT_GAVE_FOSSIL_TO_LAB
52
jr nz, .check_done_reviving
53
ld hl, .Text
54
call PrintText
55
call Lab4Script_GetFossilsInBag
56
ld a, [wFilteredBagItemsCount]
57
and a
58
jr z, .no_fossils
59
farcall GiveFossilToCinnabarLab
60
jr .done
61
.no_fossils
62
ld hl, .NoFossilsText
63
call PrintText
64
.done
65
jp TextScriptEnd
66
.check_done_reviving
67
CheckEventAfterBranchReuseA EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_GAVE_FOSSIL_TO_LAB
68
jr z, .done_reviving
69
ld hl, .GoForAWalkText
70
call PrintText
71
jr .done
72
.done_reviving
73
call LoadFossilItemAndMonNameBank1D
74
ld hl, .FossilIsBackToLifeText
75
call PrintText
76
SetEvent EVENT_LAB_HANDING_OVER_FOSSIL_MON
77
ld a, [wFossilMon]
78
ld b, a
79
ld c, 30
80
call GivePokemon
81
jr nc, .done
82
ResetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_LAB_HANDING_OVER_FOSSIL_MON
83
jr .done
84
85
.Text:
86
text_far _CinnabarLabFossilRoomScientist1Text
87
text_end
88
89
.NoFossilsText:
90
text_far _CinnabarLabFossilRoomScientist1NoFossilsText
91
text_end
92
93
.GoForAWalkText:
94
text_far _CinnabarLabFossilRoomScientist1GoForAWalkText
95
text_end
96
97
.FossilIsBackToLifeText:
98
text_far _CinnabarLabFossilRoomScientist1FossilIsBackToLifeText
99
text_end
100
101
CinnabarLabFossilRoomScientist2Text:
102
text_asm
103
ld a, TRADE_FOR_SAILOR
104
ld [wWhichTrade], a
105
predef DoInGameTradeDialogue
106
jp TextScriptEnd
107
108
LoadFossilItemAndMonNameBank1D:
109
farjp LoadFossilItemAndMonName
110
111