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
|
PokemonTower7F_Script:
call EnableAutoTextBoxDrawing
ld hl, PokemonTower7TrainerHeaders
ld de, PokemonTower7F_ScriptPointers
ld a, [wPokemonTower7FCurScript]
call ExecuteCurMapScriptInTable
ld [wPokemonTower7FCurScript], a
ret
PokemonTower7Script_60d18:
xor a
ld [wJoyIgnore], a
ld [wPokemonTower7FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower7F_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw PokemonTower7Script2
dw PokemonTower7Script3
dw PokemonTower7Script4
PokemonTower7Script2:
ld hl, wFlags_0xcd60
res 0, [hl]
ld a, [wIsInBattle]
cp $ff
jp z, PokemonTower7Script_60d18
call EndTrainerBattle
ld a, $f0
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call PokemonTower7Script_60db6
ld a, $3
ld [wPokemonTower7FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower7Script3:
ld a, [wd730]
bit 0, a
ret nz
ld hl, wMissableObjectList
ld a, [wSpriteIndex]
ld b, a
.missableObjectsListLoop
ld a, [hli]
cp b ; search for sprite ID in missing objects list
ld a, [hli]
jr nz, .missableObjectsListLoop
ld [wMissableObjectIndex], a ; remove missable object
predef HideObject
xor a
ld [wJoyIgnore], a
ld [wSpriteIndex], a
ld [wTrainerHeaderFlagBit], a
ld [wUnusedDA38], a
ld a, $0
ld [wPokemonTower7FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower7Script4:
ld a, $ff
ld [wJoyIgnore], a
ld a, HS_POKEMON_TOWER_7F_MR_FUJI
ld [wMissableObjectIndex], a
predef HideObject
ld a, SPRITE_FACING_UP
ld [wSpritePlayerStateData1FacingDirection], a
ld a, MR_FUJIS_HOUSE
ldh [hWarpDestinationMap], a
ld a, $1
ld [wDestinationWarpID], a
ld a, LAVENDER_TOWN
ld [wLastMap], a
ld hl, wd72d
set 3, [hl]
ld a, $0
ld [wPokemonTower7FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower7Script_60db6:
ld hl, CoordsData_60de3
ld a, [wSpriteIndex]
dec a
swap a
ld d, $0
ld e, a
add hl, de
ld a, [wYCoord]
ld b, a
ld a, [wXCoord]
ld c, a
.asm_60dcb
ld a, [hli]
cp b
jr nz, .asm_60dde
ld a, [hli]
cp c
jr nz, .asm_60ddf
ld a, [hli]
ld d, [hl]
ld e, a
ld a, [wSpriteIndex]
ldh [hSpriteIndex], a
jp MoveSprite
.asm_60dde
inc hl
.asm_60ddf
inc hl
inc hl
jr .asm_60dcb
CoordsData_60de3:
map_coord_movement 9, 12, MovementData_60e13
map_coord_movement 10, 11, MovementData_60e1b
map_coord_movement 11, 11, MovementData_60e22
map_coord_movement 12, 11, MovementData_60e22
map_coord_movement 12, 10, MovementData_60e28
map_coord_movement 11, 9, MovementData_60e30
map_coord_movement 10, 9, MovementData_60e22
map_coord_movement 9, 9, MovementData_60e22
map_coord_movement 9, 8, MovementData_60e37
map_coord_movement 10, 7, MovementData_60e22
map_coord_movement 11, 7, MovementData_60e22
map_coord_movement 12, 7, MovementData_60e22
MovementData_60e13:
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_LEFT
db -1 ; end
MovementData_60e1b:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
MovementData_60e22:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
MovementData_60e28:
db NPC_MOVEMENT_LEFT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
MovementData_60e30:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_LEFT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
MovementData_60e37:
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
PokemonTower7F_TextPointers:
dw PokemonTower7Text1
dw PokemonTower7Text2
dw PokemonTower7Text3
dw PokemonTower7FujiText
PokemonTower7TrainerHeaders:
def_trainers
PokemonTower7TrainerHeader0:
trainer EVENT_BEAT_POKEMONTOWER_7_TRAINER_0, 3, PokemonTower7BattleText1, PokemonTower7EndBattleText1, PokemonTower7AfterBattleText1
PokemonTower7TrainerHeader1:
trainer EVENT_BEAT_POKEMONTOWER_7_TRAINER_1, 3, PokemonTower7BattleText2, PokemonTower7EndBattleText2, PokemonTower7AfterBattleText2
PokemonTower7TrainerHeader2:
trainer EVENT_BEAT_POKEMONTOWER_7_TRAINER_2, 3, PokemonTower7BattleText3, PokemonTower7EndBattleText3, PokemonTower7AfterBattleText3
db -1 ; end
PokemonTower7Text1:
text_asm
ld hl, PokemonTower7TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
PokemonTower7Text2:
text_asm
ld hl, PokemonTower7TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
PokemonTower7Text3:
text_asm
ld hl, PokemonTower7TrainerHeader2
call TalkToTrainer
jp TextScriptEnd
PokemonTower7FujiText:
text_asm
ld hl, TowerRescueFujiText
call PrintText
SetEvent EVENT_RESCUED_MR_FUJI
SetEvent EVENT_RESCUED_MR_FUJI_2
ld a, HS_MR_FUJIS_HOUSE_MR_FUJI
ld [wMissableObjectIndex], a
predef ShowObject
ld a, HS_SAFFRON_CITY_E
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_SAFFRON_CITY_F
ld [wMissableObjectIndex], a
predef ShowObject
ld a, $4
ld [wPokemonTower7FCurScript], a
ld [wCurMapScript], a
jp TextScriptEnd
TowerRescueFujiText:
text_far _TowerRescueFujiText
text_end
PokemonTower7BattleText1:
text_far _PokemonTower7BattleText1
text_end
PokemonTower7EndBattleText1:
text_far _PokemonTower7EndBattleText1
text_end
PokemonTower7AfterBattleText1:
text_far _PokemonTower7AfterBattleText1
text_end
PokemonTower7BattleText2:
text_far _PokemonTower7BattleText2
text_end
PokemonTower7EndBattleText2:
text_far _PokemonTower7EndBattleText2
text_end
PokemonTower7AfterBattleText2:
text_far _PokemonTower7AfterBattleText2
text_end
PokemonTower7BattleText3:
text_far _PokemonTower7BattleText3
text_end
PokemonTower7EndBattleText3:
text_far _PokemonTower7EndBattleText3
text_end
PokemonTower7AfterBattleText3:
text_far _PokemonTower7AfterBattleText3
text_end
|