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
|
SilphCo9F_Script:
call SilphCo9Script_5d7d1
call EnableAutoTextBoxDrawing
ld hl, SilphCo9TrainerHeaders
ld de, SilphCo9F_ScriptPointers
ld a, [wSilphCo9FCurScript]
call ExecuteCurMapScriptInTable
ld [wSilphCo9FCurScript], a
ret
SilphCo9Script_5d7d1:
ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
ld hl, SilphCo9GateCoords
call SilphCo9Script_5d837
call SilphCo9Script_5d863
CheckEvent EVENT_SILPH_CO_9_UNLOCKED_DOOR1
jr nz, .asm_5d7f8
push af
ld a, $5f
ld [wNewTileBlockID], a
lb bc, 4, 1
predef ReplaceTileBlock
pop af
.asm_5d7f8
CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR2, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
jr nz, .asm_5d80b
push af
ld a, $54
ld [wNewTileBlockID], a
lb bc, 2, 9
predef ReplaceTileBlock
pop af
.asm_5d80b
CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR3, EVENT_SILPH_CO_9_UNLOCKED_DOOR2
jr nz, .asm_5d81e
push af
ld a, $54
ld [wNewTileBlockID], a
lb bc, 5, 9
predef ReplaceTileBlock
pop af
.asm_5d81e
CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR4, EVENT_SILPH_CO_9_UNLOCKED_DOOR3
ret nz
ld a, $5f
ld [wNewTileBlockID], a
lb bc, 6, 5
predef_jump ReplaceTileBlock
SilphCo9GateCoords:
dbmapcoord 1, 4
dbmapcoord 9, 2
dbmapcoord 9, 5
dbmapcoord 5, 6
db -1 ; end
SilphCo9Script_5d837:
push hl
ld hl, wCardKeyDoorY
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
xor a
ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_5d843
ld a, [hli]
cp $ff
jr z, .asm_5d85f
push hl
ld hl, hUnlockedSilphCoDoors
inc [hl]
pop hl
cp b
jr z, .asm_5d854
inc hl
jr .asm_5d843
.asm_5d854
ld a, [hli]
cp c
jr nz, .asm_5d843
ld hl, wCardKeyDoorY
xor a
ld [hli], a
ld [hl], a
ret
.asm_5d85f
xor a
ldh [hUnlockedSilphCoDoors], a
ret
SilphCo9Script_5d863:
EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
jr nz, .next1
SetEventReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ret
.next1
cp $2
jr nz, .next2
SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR2, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ret
.next2
cp $3
jr nz, .next3
SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR3, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ret
.next3
cp $4
ret nz
SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR4, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ret
SilphCo9F_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
SilphCo9F_TextPointers:
dw SilphCo9Text1
dw SilphCo9Text2
dw SilphCo9Text3
dw SilphCo9Text4
SilphCo9TrainerHeaders:
def_trainers 2
SilphCo9TrainerHeader0:
trainer EVENT_BEAT_SILPH_CO_9F_TRAINER_0, 4, SilphCo9BattleText1, SilphCo9EndBattleText1, SilphCo9AfterBattleText1
SilphCo9TrainerHeader1:
trainer EVENT_BEAT_SILPH_CO_9F_TRAINER_1, 2, SilphCo9BattleText2, SilphCo9EndBattleText2, SilphCo9AfterBattleText2
SilphCo9TrainerHeader2:
trainer EVENT_BEAT_SILPH_CO_9F_TRAINER_2, 4, SilphCo9BattleText3, SilphCo9EndBattleText3, SilphCo9AfterBattleText3
db -1 ; end
SilphCo9Text1:
text_asm
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
jr nz, .asm_5d8dc
ld hl, SilphCo9Text_5d8e5
call PrintText
predef HealParty
call GBFadeOutToWhite
call Delay3
call GBFadeInFromWhite
ld hl, SilphCo9Text_5d8ea
call PrintText
jr .asm_5d8e2
.asm_5d8dc
ld hl, SilphCo9Text_5d8ef
call PrintText
.asm_5d8e2
jp TextScriptEnd
SilphCo9Text_5d8e5:
text_far _SilphCo9Text_5d8e5
text_end
SilphCo9Text_5d8ea:
text_far _SilphCo9Text_5d8ea
text_end
SilphCo9Text_5d8ef:
text_far _SilphCo9Text_5d8ef
text_end
SilphCo9Text2:
text_asm
ld hl, SilphCo9TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
SilphCo9Text3:
text_asm
ld hl, SilphCo9TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
SilphCo9Text4:
text_asm
ld hl, SilphCo9TrainerHeader2
call TalkToTrainer
jp TextScriptEnd
SilphCo9BattleText1:
text_far _SilphCo9BattleText1
text_end
SilphCo9EndBattleText1:
text_far _SilphCo9EndBattleText1
text_end
SilphCo9AfterBattleText1:
text_far _SilphCo9AfterBattleText1
text_end
SilphCo9BattleText2:
text_far _SilphCo9BattleText2
text_end
SilphCo9EndBattleText2:
text_far _SilphCo9EndBattleText2
text_end
SilphCo9AfterBattleText2:
text_far _SilphCo9AfterBattleText2
text_end
SilphCo9BattleText3:
text_far _SilphCo9BattleText3
text_end
SilphCo9EndBattleText3:
text_far _SilphCo9EndBattleText3
text_end
SilphCo9AfterBattleText3:
text_far _SilphCo9AfterBattleText3
text_end
|