forked from pret/pokered
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoak_speech2.asm
executable file
·219 lines (207 loc) · 3.46 KB
/
oak_speech2.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
ChoosePlayerName:
call OakSpeechSlidePicRight
ld de, DefaultNamesPlayer
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
and a
jr z, .customName
ld hl, DefaultNamesPlayerList
call GetDefaultName
ld de, wPlayerName
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, wPlayerName
xor a ; NAME_PLAYER_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp "@"
jr z, .customName
call ClearScreen
call Delay3
ld de, RedPicFront
ld b, BANK(RedPicFront)
call IntroDisplayPicCenteredOrUpperRight
.done
ld hl, YourNameIsText
jp PrintText
YourNameIsText:
text_far _YourNameIsText
text_end
ChooseRivalName:
call OakSpeechSlidePicRight
ld de, DefaultNamesRival
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
and a
jr z, .customName
ld hl, DefaultNamesRivalList
call GetDefaultName
ld de, wRivalName
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, wRivalName
ld a, NAME_RIVAL_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp "@"
jr z, .customName
call ClearScreen
call Delay3
ld de, Rival1Pic
ld b, $13
call IntroDisplayPicCenteredOrUpperRight
.done
ld hl, HisNameIsText
jp PrintText
HisNameIsText:
text_far _HisNameIsText
text_end
OakSpeechSlidePicLeft:
push de
hlcoord 0, 0
lb bc, 12, 12
call ClearScreenArea ; clear the name list text box
ld c, 10
call DelayFrames
pop de
ld hl, wcd6d
ld bc, NAME_LENGTH
call CopyData
call Delay3
hlcoord 13, 4
lb de, 7, 6 * SCREEN_WIDTH + 5
ld a, $ff
jr OakSpeechSlidePicCommon
OakSpeechSlidePicRight:
hlcoord 5, 4
lb de, 7, 6 * SCREEN_WIDTH + 5
xor a
OakSpeechSlidePicCommon:
push hl
push de
push bc
ldh [hSlideDirection], a
ld a, d
ldh [hSlideAmount], a
ld a, e
ldh [hSlidingRegionSize], a
ld c, a
ldh a, [hSlideDirection]
and a
jr nz, .next
; If sliding right, point hl to the end of the pic's tiles.
ld d, 0
add hl, de
.next
ld d, h
ld e, l
.loop
xor a
ldh [hAutoBGTransferEnabled], a
ldh a, [hSlideDirection]
and a
jr nz, .slideLeft
; sliding right
ld a, [hli]
ld [hld], a
dec hl
jr .next2
.slideLeft
ld a, [hld]
ld [hli], a
inc hl
.next2
dec c
jr nz, .loop
ldh a, [hSlideDirection]
and a
jr z, .next3
; If sliding left, we need to zero the last tile in the pic (there is no need
; to take a corresponding action when sliding right because hl initially points
; to a 0 tile in that case).
xor a
dec hl
ld [hl], a
.next3
ld a, 1
ldh [hAutoBGTransferEnabled], a
call Delay3
ldh a, [hSlidingRegionSize]
ld c, a
ld h, d
ld l, e
ldh a, [hSlideDirection]
and a
jr nz, .slideLeft2
inc hl
jr .next4
.slideLeft2
dec hl
.next4
ld d, h
ld e, l
ldh a, [hSlideAmount]
dec a
ldh [hSlideAmount], a
jr nz, .loop
pop bc
pop de
pop hl
ret
DisplayIntroNameTextBox:
push de
hlcoord 0, 0
ld b, $a
ld c, $a
call TextBoxBorder
hlcoord 4, 0
ld de, .namestring
call PlaceString
pop de
hlcoord 2, 2
call PlaceString
call UpdateSprites
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
inc a
ld [wTopMenuItemX], a
ld [wMenuWatchedKeys], a ; A_BUTTON
inc a
ld [wTopMenuItemY], a
inc a
ld [wMaxMenuItem], a
jp HandleMenuInput
.namestring
db "NOMO@"
INCLUDE "data/player_names.asm"
GetDefaultName:
; a = name index
; hl = name list
ld b, a
ld c, 0
.loop
ld d, h
ld e, l
.innerLoop
ld a, [hli]
cp "@"
jr nz, .innerLoop
ld a, b
cp c
jr z, .foundName
inc c
jr .loop
.foundName
ld h, d
ld l, e
ld de, wcd6d
ld bc, $14
jp CopyData
INCLUDE "data/player_names_list.asm"
LinkMenuEmptyText:
text_end