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
|
CeruleanGymScript: ; 5c6b3 (17:46b3)
ld hl, $d126
bit 6, [hl]
res 6, [hl]
call nz, CeruleanGymScript_5c6d0
call EnableAutoTextBoxDrawing
ld hl, CeruleanGymTrainerHeaders
ld de, CeruleanGymScriptPointers
ld a, [W_CERULEANGYMCURSCRIPT]
call ExecuteCurMapScriptInTable
ld [W_CERULEANGYMCURSCRIPT], a
ret
CeruleanGymScript_5c6d0: ; 5c6d0 (17:46d0)
ld hl, Gym2CityName ; $46d9
ld de, Gym2LeaderName ; $46e7
jp LoadGymLeaderAndCityName
Gym2CityName: ; 5c6d9 (17:46d9)
db "CERULEAN CITY@"
Gym2LeaderName: ; 5c6e7 (17:46e7)
db "MISTY@"
CeruleanGymScript_5c6ed: ; 5c6ed (17:46ed)
xor a
ld [wJoyIgnore], a
ld [W_CERULEANGYMCURSCRIPT], a
ld [W_CURMAPSCRIPT], a
ret
CeruleanGymScriptPointers: ; 5c6f8 (17:46f8)
dw CheckFightingMapTrainers
dw Func_324c
dw EndTrainerBattle
dw CeruleanGymScript3
CeruleanGymScript3: ; 5c700 (17:4700)
ld a, [W_ISINBATTLE] ; $d057
cp $ff
jp z, CeruleanGymScript_5c6ed
ld a, $f0
ld [wJoyIgnore], a
CeruleanGymScript_5c70d: ; 5c70d (17:470d)
ld a, $5
ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
call DisplayTextID
ld hl, $d75e
set 7, [hl]
ld bc, (TM_11 << 8) | 1
call GiveItem
jr nc, .BagFull
ld a, $6
ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
call DisplayTextID
ld hl, $d75e
set 6, [hl]
jr .asm_5c736
.BagFull
ld a, $7
ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
call DisplayTextID
.asm_5c736
ld hl, W_OBTAINEDBADGES
set 1, [hl]
ld hl, $d72a
set 1, [hl]
; deactivate gym trainers
ld hl, $d75e
set 2, [hl]
set 3, [hl]
jp CeruleanGymScript_5c6ed
CeruleanGymTextPointers: ; 5c74a (17:474a)
dw CeruleanGymText1
dw CeruleanGymText2
dw CeruleanGymText3
dw CeruleanGymText4
dw CeruleanGymText5
dw CeruleanGymText6
dw CeruleanGymText7
CeruleanGymTrainerHeaders: ; 5c758 (17:4758)
CeruleanGymTrainerHeader0: ; 5c758 (17:4758)
db $2 ; flag's bit
db ($3 << 4) ; trainer's view range
dw $d75e ; flag's byte
dw CeruleanGymBattleText1 ; 0x47e9 TextBeforeBattle
dw CeruleanGymAfterBattleText1 ; 0x47f3 TextAfterBattle
dw CeruleanGymEndBattleText1 ; 0x47ee TextEndBattle
dw CeruleanGymEndBattleText1 ; 0x47ee TextEndBattle
CeruleanGymTrainerHeader1: ; 5c764 (17:4764)
db $3 ; flag's bit
db ($3 << 4) ; trainer's view range
dw $d75e ; flag's byte
dw CeruleanGymBattleText2 ; 0x4802 TextBeforeBattle
dw CeruleanGymAfterBattleText2 ; 0x480c TextAfterBattle
dw CeruleanGymEndBattleText2 ; 0x4807 TextEndBattle
dw CeruleanGymEndBattleText2 ; 0x4807 TextEndBattle
db $ff
CeruleanGymText1: ; 5c771 (17:4771)
db $08 ; asm
ld a, [$d75e]
bit 7, a
jr z, .asm_10854 ; 0x5c777
bit 6, a
jr nz, .asm_37a1b ; 0x5c77b
call z, CeruleanGymScript_5c70d
call DisableWaitingAfterTextDisplay
jr .asm_95b04 ; 0x5c783
.asm_37a1b ; 0x5c785
ld hl, CeruleanGymText_5c7c3
call PrintText
jr .asm_95b04 ; 0x5c78b
.asm_10854 ; 0x5c78d
ld hl, CeruleanGymText_5c7be
call PrintText
ld hl, $d72d
set 6, [hl]
set 7, [hl]
ld hl, CeruleanGymText_5c7d8
ld de, CeruleanGymText_5c7d8
call PreBattleSaveRegisters
ldh a, [$8c]
ld [$cf13], a
call EngageMapTrainer
call InitBattleEnemyParameters
ld a, $2
ld [$d05c], a
xor a
ldh [$b4], a
ld a, $3
ld [W_CERULEANGYMCURSCRIPT], a
.asm_95b04 ; 0x5c7bb
jp TextScriptEnd
CeruleanGymText_5c7be: ; 5c7be (17:47be)
TX_FAR _CeruleanGymText_5c7be
db "@"
CeruleanGymText_5c7c3: ; 5c7c3 (17:47c3)
TX_FAR _CeruleanGymText_5c7c3
db "@"
CeruleanGymText5: ; 5c7c8 (17:47c8)
TX_FAR _CeruleanGymText_5c7c8
db "@"
CeruleanGymText6: ; 5c7cd (17:47cd)
ReceivedTM11Text: ; 5c7cd (17:47cd)
TX_FAR _ReceivedTM11Text
db $0B, "@"
CeruleanGymText7: ; 5c7d3 (17:47d3)
TX_FAR _CeruleanGymText_5c7d3
db "@"
CeruleanGymText_5c7d8: ; 5c7d8 (17:47d8)
TX_FAR _CeruleanGymText_5c7d8
db $11, $6, "@"
CeruleanGymText2: ; 5c7df (17:47df)
db $08 ; asm
ld hl, CeruleanGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
CeruleanGymBattleText1: ; 5c7e9 (17:47e9)
TX_FAR _CeruleanGymBattleText1
db "@"
CeruleanGymEndBattleText1: ; 5c7ee (17:47ee)
TX_FAR _CeruleanGymEndBattleText1
db "@"
CeruleanGymAfterBattleText1: ; 5c7f3 (17:47f3)
TX_FAR _CeruleanGymAfterBattleText1
db "@"
CeruleanGymText3: ; 5c7f8 (17:47f8)
db $08 ; asm
ld hl, CeruleanGymTrainerHeader1
call TalkToTrainer
jp TextScriptEnd
CeruleanGymBattleText2: ; 5c802 (17:4802)
TX_FAR _CeruleanGymBattleText2
db "@"
CeruleanGymEndBattleText2: ; 5c807 (17:4807)
TX_FAR _CeruleanGymEndBattleText2
db "@"
CeruleanGymAfterBattleText2: ; 5c80c (17:480c)
TX_FAR _CeruleanGymAfterBattleText2
db "@"
CeruleanGymText4: ; 5c811 (17:4811)
db $08 ; asm
ld a, [$d75e]
bit 7, a
jr nz, .asm_f80ce ; 0x5c817
ld hl, CeruleanGymText_5c82a
call PrintText
jr .asm_18a31 ; 0x5c81f
.asm_f80ce ; 0x5c821
ld hl, CeruleanGymText_5c82f
call PrintText
.asm_18a31 ; 0x5c827
jp TextScriptEnd
CeruleanGymText_5c82a: ; 5c82a (17:482a)
TX_FAR _CeruleanGymText_5c82a
db "@"
CeruleanGymText_5c82f: ; 5c82f (17:482f)
TX_FAR _CeruleanGymText_5c82f
db "@"
|