Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/scripts/BikeShop.asm
1270 views
1
BikeShop_Script:
2
jp EnableAutoTextBoxDrawing
3
4
BikeShop_TextPointers:
5
def_text_pointers
6
dw_const BikeShopClerkText, TEXT_BIKESHOP_CLERK
7
dw_const BikeShopMiddleAgedWomanText, TEXT_BIKESHOP_MIDDLE_AGED_WOMAN
8
dw_const BikeShopYoungsterText, TEXT_BIKESHOP_YOUNGSTER
9
10
BikeShopClerkText:
11
text_asm
12
CheckEvent EVENT_GOT_BICYCLE
13
jr z, .dontHaveBike
14
ld hl, BikeShopClerkHowDoYouLikeYourBicycleText
15
call PrintText
16
jp .Done
17
.dontHaveBike
18
ld b, BIKE_VOUCHER
19
call IsItemInBag
20
jr z, .dontHaveVoucher
21
ld hl, BikeShopClerkOhThatsAVoucherText
22
call PrintText
23
lb bc, BICYCLE, 1
24
call GiveItem
25
jr nc, .BagFull
26
ld a, BIKE_VOUCHER
27
ldh [hItemToRemoveID], a
28
farcall RemoveItemByID
29
SetEvent EVENT_GOT_BICYCLE
30
ld hl, BikeShopExchangedVoucherText
31
call PrintText
32
jr .Done
33
.BagFull
34
ld hl, BikeShopBagFullText
35
call PrintText
36
jr .Done
37
.dontHaveVoucher
38
ld hl, BikeShopClerkWelcomeText
39
call PrintText
40
xor a
41
ld [wCurrentMenuItem], a
42
ld [wLastMenuItem], a
43
ld a, PAD_A | PAD_B
44
ld [wMenuWatchedKeys], a
45
ld a, $1
46
ld [wMaxMenuItem], a
47
ld a, $2
48
ld [wTopMenuItemY], a
49
ld a, $1
50
ld [wTopMenuItemX], a
51
ld hl, wStatusFlags5
52
set BIT_NO_TEXT_DELAY, [hl]
53
hlcoord 0, 0
54
ld b, 4
55
ld c, 15
56
call TextBoxBorder
57
call UpdateSprites
58
hlcoord 2, 2
59
ld de, BikeShopMenuText
60
call PlaceString
61
hlcoord 8, 3
62
ld de, BikeShopMenuPrice
63
call PlaceString
64
ld hl, BikeShopClerkDoYouLikeItText
65
call PrintText
66
call HandleMenuInput
67
bit B_PAD_B, a
68
jr nz, .cancel
69
ld hl, wStatusFlags5
70
res BIT_NO_TEXT_DELAY, [hl]
71
ld a, [wCurrentMenuItem]
72
and a
73
jr nz, .cancel
74
ld hl, BikeShopCantAffordText
75
call PrintText
76
.cancel
77
ld hl, BikeShopComeAgainText
78
call PrintText
79
.Done
80
jp TextScriptEnd
81
82
BikeShopMenuText:
83
db "BICYCLE"
84
next "CANCEL@"
85
86
BikeShopMenuPrice:
87
db "¥1000000@"
88
89
BikeShopClerkWelcomeText:
90
text_far _BikeShopClerkWelcomeText
91
text_end
92
93
BikeShopClerkDoYouLikeItText:
94
text_far _BikeShopClerkDoYouLikeItText
95
text_end
96
97
BikeShopCantAffordText:
98
text_far _BikeShopCantAffordText
99
text_end
100
101
BikeShopClerkOhThatsAVoucherText:
102
text_far _BikeShopClerkOhThatsAVoucherText
103
text_end
104
105
BikeShopExchangedVoucherText:
106
text_far _BikeShopExchangedVoucherText
107
sound_get_key_item
108
text_end
109
110
BikeShopComeAgainText:
111
text_far _BikeShopComeAgainText
112
text_end
113
114
BikeShopClerkHowDoYouLikeYourBicycleText:
115
text_far _BikeShopClerkHowDoYouLikeYourBicycleText
116
text_end
117
118
BikeShopBagFullText:
119
text_far _BikeShopBagFullText
120
text_end
121
122
BikeShopMiddleAgedWomanText:
123
text_asm
124
ld hl, .Text
125
call PrintText
126
jp TextScriptEnd
127
128
.Text:
129
text_far _BikeShopMiddleAgedWomanText
130
text_end
131
132
BikeShopYoungsterText:
133
text_asm
134
CheckEvent EVENT_GOT_BICYCLE
135
ld hl, .CoolBikeText
136
jr nz, .gotBike
137
ld hl, .TheseBikesAreExpensiveText
138
.gotBike
139
call PrintText
140
jp TextScriptEnd
141
142
.TheseBikesAreExpensiveText:
143
text_far _BikeShopYoungsterTheseBikesAreExpensiveText
144
text_end
145
146
.CoolBikeText:
147
text_far _BikeShopYoungsterCoolBikeText
148
text_end
149
150