summaryrefslogtreecommitdiff
path: root/scripts/fuchsiagym.asm
blob: 789c2367a3484b4fd224028462a7243e8113d731 (plain)
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
FuchsiaGymScript: ; 7543d (1d:543d)
	call FuchsiaGymScript_75453
	call EnableAutoTextBoxDrawing
	ld hl, FuchsiaGymTrainerHeaders
	ld de, FuchsiaGymScriptPointers
	ld a, [W_FUCHSIAGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_FUCHSIAGYMCURSCRIPT], a
	ret

FuchsiaGymScript_75453: ; 75453 (1d:5453)
	ld hl, $D126
	bit 6, [hl]
	res 6, [hl]
	ret z
	ld hl, Gym5CityName
	ld de, Gym5LeaderName
	call LoadGymLeaderAndCityName
	ret

Gym5CityName: ; 75465 (1d:5465)
	db "FUCHSIA CITY@"
Gym5LeaderName: ; 75472 (1d:5472)
	db "KOGA@"

FuchsiaGymScript_75477: ; 75477 (1d:5477)
	xor a
	ld [wJoypadForbiddenButtonsMask], a
	ld [W_FUCHSIAGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

FuchsiaGymScriptPointers: ; 75482 (1d:5482)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle
	dw FuchsiaGymScript3

FuchsiaGymScript3: ; 7548a (1d:548a)
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, FuchsiaGymScript_75477
	ld a, $f0
	ld [wJoypadForbiddenButtonsMask], a
FuchsiaGymScript3_75497: ; 75497 (1d:5497)
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
	call DisplayTextID
	ld hl, $d792
	set 1, [hl]
	ld bc, (TM_06 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
	call DisplayTextID
	ld hl, $d792
	set 0, [hl]
	jr .asm_754c0
.BagFull
	ld a, $b
	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
	call DisplayTextID
.asm_754c0
	ld hl, W_OBTAINEDBADGES
	set 4, [hl]
	ld hl, $d72a
	set 4, [hl]

	; deactivate gym trainers
	ld a, [$d792]
	or %11111100
	ld [$d792], a

	jp FuchsiaGymScript_75477

FuchsiaGymTextPointers: ; 754d5 (1d:54d5)
	dw FuchsiaGymText1
	dw FuchsiaGymText2
	dw FuchsiaGymText3
	dw FuchsiaGymText4
	dw FuchsiaGymText5
	dw FuchsiaGymText6
	dw FuchsiaGymText7
	dw FuchsiaGymText8
	dw FuchsiaGymText9
	dw FuchsiaGymText10
	dw FuchsiaGymText11

FuchsiaGymTrainerHeaders: ; 754eb (1d:54eb)
FuchsiaGymTrainerHeader0: ; 754eb (1d:54eb)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText1 ; 0x55ae TextBeforeBattle
	dw FuchsiaGymAfterBattleText1 ; 0x55b8 TextAfterBattle
	dw FuchsiaGymEndBattleText1 ; 0x55b3 TextEndBattle
	dw FuchsiaGymEndBattleText1 ; 0x55b3 TextEndBattle

FuchsiaGymTrainerHeader2: ; 754f7 (1d:54f7)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText2 ; 0x55c7 TextBeforeBattle
	dw FuchsiaGymAfterBattleText2 ; 0x55d1 TextAfterBattle
	dw FuchsiaGymEndBattleText2 ; 0x55cc TextEndBattle
	dw FuchsiaGymEndBattleText2 ; 0x55cc TextEndBattle

FuchsiaGymTrainerHeader3: ; 75503 (1d:5503)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText3 ; 0x55e0 TextBeforeBattle
	dw FuchsiaGymAfterBattleText3 ; 0x55ea TextAfterBattle
	dw FuchsiaGymEndBattleText3 ; 0x55e5 TextEndBattle
	dw FuchsiaGymEndBattleText3 ; 0x55e5 TextEndBattle

FuchsiaGymTrainerHeader4: ; 7550f (1d:550f)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText4 ; 0x55f9 TextBeforeBattle
	dw FuchsiaGymAfterBattleText4 ; 0x5603 TextAfterBattle
	dw FuchsiaGymEndBattleText4 ; 0x55fe TextEndBattle
	dw FuchsiaGymEndBattleText4 ; 0x55fe TextEndBattle

FuchsiaGymTrainerHeader5: ; 7551b (1d:551b)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText5 ; 0x5612 TextBeforeBattle
	dw FuchsiaGymAfterBattleText5 ; 0x561c TextAfterBattle
	dw FuchsiaGymEndBattleText5 ; 0x5617 TextEndBattle
	dw FuchsiaGymEndBattleText5 ; 0x5617 TextEndBattle

FuchsiaGymTrainerHeader6: ; 75527 (1d:5527)
	db $7 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText6 ; 0x562b TextBeforeBattle
	dw FuchsiaGymAfterBattleText6 ; 0x5635 TextAfterBattle
	dw FuchsiaGymEndBattleText6 ; 0x5630 TextEndBattle
	dw FuchsiaGymEndBattleText6 ; 0x5630 TextEndBattle

	db $ff

FuchsiaGymText1: ; 75534 (1d:5534)
	db $08 ; asm
	ld a, [$d792]
	bit 1, a
	jr z, .asm_181b6 ; 0x7553a
	bit 0, a
	jr nz, .asm_adc3b ; 0x7553e
	call z, FuchsiaGymScript3_75497
	call DisableWaitingAfterTextDisplay
	jr .asm_e84c6 ; 0x75546
.asm_adc3b ; 0x75548
	ld hl, UnnamedText_7558b
	call PrintText
	jr .asm_e84c6 ; 0x7554e
.asm_181b6 ; 0x75550
	ld hl, UnnamedText_75581
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_75586
	ld de, UnnamedText_75586
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $5
	ld [$d05c], a
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_FUCHSIAGYMCURSCRIPT], a
.asm_e84c6 ; 0x7557e
	jp TextScriptEnd

UnnamedText_75581: ; 75581 (1d:5581)
	TX_FAR _UnnamedText_75581
	db "@"

UnnamedText_75586: ; 75586 (1d:5586)
	TX_FAR _UnnamedText_75586
	db "@"

UnnamedText_7558b: ; 7558b (1d:558b)
	TX_FAR _UnnamedText_7558b
	db "@"

FuchsiaGymText9: ; 75590 (1d:5590)
	TX_FAR _UnnamedText_75590
	db "@"

FuchsiaGymText10: ; 75595 (1d:5595)
	TX_FAR _ReceivedTM06Text
	db $11

TM06ExplanationText: ; 7559a (1d:559a)
	TX_FAR _TM06ExplanationText
	db "@"

FuchsiaGymText11: ; 7559f (1d:559f)
	TX_FAR _TM06NoRoomText
	db "@"

FuchsiaGymText2: ; 755a4 (1d:55a4)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText1: ; 755ae (1d:55ae)
	TX_FAR _FuchsiaGymBattleText1
	db "@"

FuchsiaGymEndBattleText1: ; 755b3 (1d:55b3)
	TX_FAR _FuchsiaGymEndBattleText1
	db "@"

FuchsiaGymAfterBattleText1: ; 755b8 (1d:55b8)
	TX_FAR _FuchsiaGymAfterBattleText1
	db "@"

FuchsiaGymText3: ; 755bd (1d:55bd)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText2: ; 755c7 (1d:55c7)
	TX_FAR _FuchsiaGymBattleText2
	db "@"

FuchsiaGymEndBattleText2: ; 755cc (1d:55cc)
	TX_FAR _FuchsiaGymEndBattleText2
	db "@"

FuchsiaGymAfterBattleText2: ; 755d1 (1d:55d1)
	TX_FAR _FuchsiaGymAfterBattleText2
	db "@"

FuchsiaGymText4: ; 755d6 (1d:55d6)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText3: ; 755e0 (1d:55e0)
	TX_FAR _FuchsiaGymBattleText3
	db "@"

FuchsiaGymEndBattleText3: ; 755e5 (1d:55e5)
	TX_FAR _FuchsiaGymEndBattleText3
	db "@"

FuchsiaGymAfterBattleText3: ; 755ea (1d:55ea)
	TX_FAR _FuchsiaGymAfterBattleText3
	db "@"

FuchsiaGymText5: ; 755ef (1d:55ef)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText4: ; 755f9 (1d:55f9)
	TX_FAR _FuchsiaGymBattleText4
	db "@"

FuchsiaGymEndBattleText4: ; 755fe (1d:55fe)
	TX_FAR _FuchsiaGymEndBattleText4
	db "@"

FuchsiaGymAfterBattleText4: ; 75603 (1d:5603)
	TX_FAR _FuchsiaGymAfterBattleText4
	db "@"

FuchsiaGymText6: ; 75608 (1d:5608)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText5: ; 75612 (1d:5612)
	TX_FAR _FuchsiaGymBattleText5
	db "@"

FuchsiaGymEndBattleText5: ; 75617 (1d:5617)
	TX_FAR _FuchsiaGymEndBattleText5
	db "@"

FuchsiaGymAfterBattleText5: ; 7561c (1d:561c)
	TX_FAR _FuchsiaGymAfterBattleText5
	db "@"

FuchsiaGymText7: ; 75621 (1d:5621)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText6: ; 7562b (1d:562b)
	TX_FAR _FuchsiaGymBattleText6
	db "@"

FuchsiaGymEndBattleText6: ; 75630 (1d:5630)
	TX_FAR _FuchsiaGymEndBattleText6
	db "@"

FuchsiaGymAfterBattleText6: ; 75635 (1d:5635)
	TX_FAR _FuchsiaGymAfterBattleText6
	db "@"

FuchsiaGymText8: ; 7563a (1d:563a)
	db $08 ; asm
	ld a, [$d792]
	bit 1, a
	ld hl, UnnamedText_75653
	jr nz, .asm_50671 ; 0x75643
	ld hl, UnnamedText_7564e
.asm_50671 ; 0x75648
	call PrintText
	jp TextScriptEnd

UnnamedText_7564e: ; 7564e (1d:564e)
	TX_FAR _UnnamedText_7564e
	db "@"

UnnamedText_75653: ; 75653 (1d:5653)
	TX_FAR _UnnamedText_75653
	db "@"