-
Notifications
You must be signed in to change notification settings - Fork 1k
/
RocketHideoutB4F.asm
203 lines (180 loc) · 6 KB
/
RocketHideoutB4F.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
RocketHideoutB4F_Script:
call RocketHideoutB4FDoorCallbackScript
call EnableAutoTextBoxDrawing
ld hl, RocketHideout4TrainerHeaders
ld de, RocketHideoutB4F_ScriptPointers
ld a, [wRocketHideoutB4FCurScript]
call ExecuteCurMapScriptInTable
ld [wRocketHideoutB4FCurScript], a
ret
RocketHideoutB4FDoorCallbackScript:
ld hl, wCurrentMapScriptFlags
bit BIT_CUR_MAP_LOADED_1, [hl]
res BIT_CUR_MAP_LOADED_1, [hl]
ret z
CheckEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED
jr nz, .door_already_unlocked
CheckBothEventsSet EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0, EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_1, 1
jr z, .unlock_door
ld a, $2d ; Door block
jr .set_block
.unlock_door
ld a, SFX_GO_INSIDE
call PlaySound
SetEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED
.door_already_unlocked
ld a, $e ; Floor block
.set_block
ld [wNewTileBlockID], a
lb bc, 5, 12
predef_jump ReplaceTileBlock
RocketHideoutB4FSetDefaultScript:
xor a
ld [wJoyIgnore], a
ld [wRocketHideoutB4FCurScript], a
ld [wCurMapScript], a
ret
RocketHideoutB4F_ScriptPointers:
def_script_pointers
dw_const CheckFightingMapTrainers, SCRIPT_ROCKETHIDEOUTB4F_DEFAULT
dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_ROCKETHIDEOUTB4F_START_BATTLE
dw_const EndTrainerBattle, SCRIPT_ROCKETHIDEOUTB4F_END_BATTLE
dw_const RocketHideoutB4FBeatGiovanniScript, SCRIPT_ROCKETHIDEOUTB4F_BEAT_GIOVANNI
RocketHideoutB4FBeatGiovanniScript:
ld a, [wIsInBattle]
cp $ff
jp z, RocketHideoutB4FSetDefaultScript
call UpdateSprites
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI
ld a, TEXT_ROCKETHIDEOUTB4F_GIOVANNI_HOPE_WE_MEET_AGAIN
ldh [hTextID], a
call DisplayTextID
call GBFadeOutToBlack
ld a, HS_ROCKET_HIDEOUT_B4F_GIOVANNI
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_ROCKET_HIDEOUT_B4F_ITEM_4
ld [wMissableObjectIndex], a
predef ShowObject
call UpdateSprites
call GBFadeInFromBlack
xor a
ld [wJoyIgnore], a
ld hl, wCurrentMapScriptFlags
set BIT_CUR_MAP_LOADED_1, [hl]
ld a, SCRIPT_ROCKETHIDEOUTB4F_DEFAULT
ld [wRocketHideoutB4FCurScript], a
ld [wCurMapScript], a
ret
RocketHideoutB4F_TextPointers:
def_text_pointers
dw_const RocketHideoutB4FGiovanniText, TEXT_ROCKETHIDEOUTB4F_GIOVANNI
dw_const RocketHideoutB4FRocket1Text, TEXT_ROCKETHIDEOUTB4F_ROCKET1
dw_const RocketHideoutB4FRocket2Text, TEXT_ROCKETHIDEOUTB4F_ROCKET2
dw_const RocketHideoutB4FRocket3Text, TEXT_ROCKETHIDEOUTB4F_ROCKET3
dw_const PickUpItemText, TEXT_ROCKETHIDEOUTB4F_HP_UP
dw_const PickUpItemText, TEXT_ROCKETHIDEOUTB4F_TM_RAZOR_WIND
dw_const PickUpItemText, TEXT_ROCKETHIDEOUTB4F_IRON
dw_const PickUpItemText, TEXT_ROCKETHIDEOUTB4F_SILPH_SCOPE
dw_const PickUpItemText, TEXT_ROCKETHIDEOUTB4F_LIFT_KEY
dw_const RocketHideoutB4FGiovanniHopeWeMeetAgainText, TEXT_ROCKETHIDEOUTB4F_GIOVANNI_HOPE_WE_MEET_AGAIN
RocketHideout4TrainerHeaders:
def_trainers 2
RocketHideout4TrainerHeader0:
trainer EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0, 0, RocketHideoutB4FGiovanniBattleText, RocketHideoutB4FGiovanniEndBattleText, RocketHideoutB4FGiovanniAfterBattleText
RocketHideout4TrainerHeader1:
trainer EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_1, 0, RocketHideoutB4FRocket1BattleText, RocketHideoutB4FRocket1EndBattleText, RocketHideoutB4FRocket1AfterBattleText
RocketHideout4TrainerHeader2:
trainer EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2, 1, RocketHideoutB4FRocket2BattleText, RocketHideoutB4FRocket2EndBattleText, RocketHideoutB4FRocket2AfterBattleText
db -1 ; end
RocketHideoutB4FGiovanniText:
text_asm
CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI
jp nz, .beat_giovanni
ld hl, .ImpressedYouGotHereText
call PrintText
ld hl, wStatusFlags3
set BIT_TALKED_TO_TRAINER, [hl]
set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .WhatCannotBeText
ld de, .WhatCannotBeText
call SaveEndBattleTextPointers
ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
ldh [hJoyHeld], a
ld a, SCRIPT_ROCKETHIDEOUTB4F_BEAT_GIOVANNI
ld [wRocketHideoutB4FCurScript], a
ld [wCurMapScript], a
jr .done
.beat_giovanni
ld hl, RocketHideoutB4FGiovanniHopeWeMeetAgainText
call PrintText
.done
jp TextScriptEnd
.ImpressedYouGotHereText:
text_far _RocketHideoutB4FGiovanniImpressedYouGotHereText
text_end
.WhatCannotBeText:
text_far _RocketHideoutB4FGiovanniWhatCannotBeText
text_end
RocketHideoutB4FGiovanniHopeWeMeetAgainText:
text_far _RocketHideoutB4FGiovanniHopeWeMeetAgainText
text_end
RocketHideoutB4FRocket1Text:
text_asm
ld hl, RocketHideout4TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
RocketHideoutB4FGiovanniBattleText:
text_far _RocketHideoutB4FGiovanniBattleText
text_end
RocketHideoutB4FGiovanniEndBattleText:
text_far _RocketHideoutB4FGiovanniEndBattleText
text_end
RocketHideoutB4FGiovanniAfterBattleText:
text_far _RocketHideoutB4FGiovanniAfterBattleText
text_end
RocketHideoutB4FRocket2Text:
text_asm
ld hl, RocketHideout4TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
RocketHideoutB4FRocket1BattleText:
text_far _RocketHideoutB4FRocket1BattleText
text_end
RocketHideoutB4FRocket1EndBattleText:
text_far _RocketHideoutB4FRocket1EndBattleText
text_end
RocketHideoutB4FRocket1AfterBattleText:
text_far _RocketHideoutB4FRocket1AfterBattleText
text_end
RocketHideoutB4FRocket3Text:
text_asm
ld hl, RocketHideout4TrainerHeader2
call TalkToTrainer
jp TextScriptEnd
RocketHideoutB4FRocket2BattleText:
text_far _RocketHideoutB4FRocket2BattleText
text_end
RocketHideoutB4FRocket2EndBattleText:
text_far _RocketHideoutB4FRocket2EndBattleText
text_end
RocketHideoutB4FRocket2AfterBattleText:
text_asm
ld hl, .Text
call PrintText
CheckAndSetEvent EVENT_ROCKET_DROPPED_LIFT_KEY
jr nz, .done
ld a, HS_ROCKET_HIDEOUT_B4F_ITEM_5
ld [wMissableObjectIndex], a
predef ShowObject
.done
jp TextScriptEnd
.Text:
text_far _RocketHideoutB4FRocket2AfterBattleText
text_end