Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/scripts/CeladonMartRoof.asm
1270 views
1
CeladonMartRoof_Script:
2
jp EnableAutoTextBoxDrawing
3
4
CeladonMartRoofScript_GetDrinksInBag:
5
; construct a list of all drinks in the player's bag
6
xor a
7
ld [wFilteredBagItemsCount], a
8
ld de, wFilteredBagItems
9
ld hl, CeladonMartRoofDrinkList
10
.loop
11
ld a, [hli]
12
and a
13
jr z, .done
14
push hl
15
push de
16
ld [wTempByteValue], a
17
ld b, a
18
predef GetQuantityOfItemInBag
19
pop de
20
pop hl
21
ld a, b
22
and a
23
jr z, .loop
24
; A drink is in the bag
25
ld a, [wTempByteValue]
26
ld [de], a
27
inc de
28
push hl
29
ld hl, wFilteredBagItemsCount
30
inc [hl]
31
pop hl
32
jr .loop
33
.done
34
ld a, $ff
35
ld [de], a
36
ret
37
38
CeladonMartRoofDrinkList:
39
db FRESH_WATER
40
db SODA_POP
41
db LEMONADE
42
db 0 ; end
43
44
CeladonMartRoofScript_GiveDrinkToGirl:
45
ld hl, wStatusFlags5
46
set BIT_NO_TEXT_DELAY, [hl]
47
ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText
48
call PrintText
49
xor a
50
ld [wCurrentMenuItem], a
51
ld a, PAD_A | PAD_B
52
ld [wMenuWatchedKeys], a
53
ld a, [wFilteredBagItemsCount]
54
dec a
55
ld [wMaxMenuItem], a
56
ld a, 2
57
ld [wTopMenuItemY], a
58
ld a, 1
59
ld [wTopMenuItemX], a
60
ld a, [wFilteredBagItemsCount]
61
dec a
62
ld bc, 2
63
ld hl, 3
64
call AddNTimes
65
dec l
66
ld b, l
67
ld c, 12
68
hlcoord 0, 0
69
call TextBoxBorder
70
call UpdateSprites
71
call CeladonMartRoofScript_PrintDrinksInBag
72
ld hl, wStatusFlags5
73
res BIT_NO_TEXT_DELAY, [hl]
74
call HandleMenuInput
75
bit B_PAD_B, a
76
ret nz
77
ld hl, wFilteredBagItems
78
ld a, [wCurrentMenuItem]
79
ld d, 0
80
ld e, a
81
add hl, de
82
ld a, [hl]
83
ldh [hItemToRemoveID], a
84
cp FRESH_WATER
85
jr z, .gaveFreshWater
86
cp SODA_POP
87
jr z, .gaveSodaPop
88
; gave Lemonade
89
CheckEvent EVENT_GOT_TM49
90
jr nz, .alreadyGaveDrink
91
ld hl, CeladonMartRoofLittleGirlYayLemonadeText
92
call PrintText
93
call RemoveItemByIDBank12
94
lb bc, TM_TRI_ATTACK, 1
95
call GiveItem
96
jr nc, .bagFull
97
ld hl, CeladonMartRoofLittleGirlReceivedTM49Text
98
call PrintText
99
SetEvent EVENT_GOT_TM49
100
ret
101
.gaveSodaPop
102
CheckEvent EVENT_GOT_TM48
103
jr nz, .alreadyGaveDrink
104
ld hl, CeladonMartRoofLittleGirlYaySodaPopText
105
call PrintText
106
call RemoveItemByIDBank12
107
lb bc, TM_ROCK_SLIDE, 1
108
call GiveItem
109
jr nc, .bagFull
110
ld hl, CeladonMartRoofLittleGirlReceivedTM48Text
111
call PrintText
112
SetEvent EVENT_GOT_TM48
113
ret
114
.gaveFreshWater
115
CheckEvent EVENT_GOT_TM13
116
jr nz, .alreadyGaveDrink
117
ld hl, CeladonMartRoofLittleGirlYayFreshWaterText
118
call PrintText
119
call RemoveItemByIDBank12
120
lb bc, TM_ICE_BEAM, 1
121
call GiveItem
122
jr nc, .bagFull
123
ld hl, CeladonMartRoofLittleGirlReceivedTM13Text
124
call PrintText
125
SetEvent EVENT_GOT_TM13
126
ret
127
.bagFull
128
ld hl, CeladonMartRoofLittleGirlNoRoomText
129
jp PrintText
130
.alreadyGaveDrink
131
ld hl, CeladonMartRoofLittleGirlImNotThirstyText
132
jp PrintText
133
134
RemoveItemByIDBank12:
135
farjp RemoveItemByID
136
137
CeladonMartRoofLittleGirlGiveHerWhichDrinkText:
138
text_far _CeladonMartRoofLittleGirlGiveHerWhichDrinkText
139
text_end
140
141
CeladonMartRoofLittleGirlYayFreshWaterText:
142
text_far _CeladonMartRoofLittleGirlYayFreshWaterText
143
text_waitbutton
144
text_end
145
146
CeladonMartRoofLittleGirlReceivedTM13Text:
147
text_far _CeladonMartRoofLittleGirlReceivedTM13Text
148
sound_get_item_1
149
text_far _CeladonMartRoofLittleGirlTM13ExplanationText
150
text_waitbutton
151
text_end
152
153
CeladonMartRoofLittleGirlYaySodaPopText:
154
text_far _CeladonMartRoofLittleGirlYaySodaPopText
155
text_waitbutton
156
text_end
157
158
CeladonMartRoofLittleGirlReceivedTM48Text:
159
text_far _CeladonMartRoofLittleGirlReceivedTM48Text
160
sound_get_item_1
161
text_far _CeladonMartRoofLittleGirlTM48ExplanationText
162
text_waitbutton
163
text_end
164
165
CeladonMartRoofLittleGirlYayLemonadeText:
166
text_far _CeladonMartRoofLittleGirlYayLemonadeText
167
text_waitbutton
168
text_end
169
170
CeladonMartRoofLittleGirlReceivedTM49Text:
171
text_far _CeladonMartRoofLittleGirlReceivedTM49Text
172
sound_get_item_1
173
text_far _CeladonMartRoofLittleGirlTM49ExplanationText
174
text_waitbutton
175
text_end
176
177
CeladonMartRoofLittleGirlNoRoomText:
178
text_far _CeladonMartRoofLittleGirlNoRoomText
179
text_waitbutton
180
text_end
181
182
CeladonMartRoofLittleGirlImNotThirstyText:
183
text_far _CeladonMartRoofLittleGirlImNotThirstyText
184
text_waitbutton
185
text_end
186
187
CeladonMartRoofScript_PrintDrinksInBag:
188
ld hl, wFilteredBagItems
189
xor a
190
ldh [hItemCounter], a
191
.loop
192
ld a, [hli]
193
cp $ff
194
ret z
195
push hl
196
ld [wNamedObjectIndex], a
197
call GetItemName
198
hlcoord 2, 2
199
ldh a, [hItemCounter]
200
ld bc, SCREEN_WIDTH * 2
201
call AddNTimes
202
ld de, wNameBuffer
203
call PlaceString
204
ld hl, hItemCounter
205
inc [hl]
206
pop hl
207
jr .loop
208
209
CeladonMartRoof_TextPointers:
210
def_text_pointers
211
dw_const CeladonMartRoofSuperNerdText, TEXT_CELADONMARTROOF_SUPER_NERD
212
dw_const CeladonMartRoofLittleGirlText, TEXT_CELADONMARTROOF_LITTLE_GIRL
213
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE1
214
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE2
215
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE3
216
dw_const CeladonMartRoofCurrentFloorSignText, TEXT_CELADONMARTROOF_CURRENT_FLOOR_SIGN
217
218
CeladonMartRoofSuperNerdText:
219
text_far _CeladonMartRoofSuperNerdText
220
text_end
221
222
CeladonMartRoofLittleGirlText:
223
text_asm
224
call CeladonMartRoofScript_GetDrinksInBag
225
ld a, [wFilteredBagItemsCount]
226
and a
227
jr z, .noDrinksInBag
228
ld a, 1
229
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
230
ld hl, .GiveHerADrinkText
231
call PrintText
232
call YesNoChoice
233
ld a, [wCurrentMenuItem]
234
and a
235
jr nz, .done
236
call CeladonMartRoofScript_GiveDrinkToGirl
237
jr .done
238
.noDrinksInBag
239
ld hl, .ImThirstyText
240
call PrintText
241
.done
242
jp TextScriptEnd
243
244
.ImThirstyText:
245
text_far _CeladonMartRoofLittleGirlImThirstyText
246
text_end
247
248
.GiveHerADrinkText:
249
text_far _CeladonMartRoofLittleGirlGiveHerADrinkText
250
text_end
251
252
CeladonMartRoofVendingMachineText:
253
script_vending_machine
254
255
CeladonMartRoofCurrentFloorSignText:
256
text_far _CeladonMartRoofCurrentFloorSignText
257
text_end
258
259