1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "bladerunner/script/scene_script.h"
24
25 namespace BladeRunner {
26
27 enum kMA01Loops {
28 kMA01LoopInshotRoof = 0,
29 kMA01LoopMainLoop = 1,
30 kMA01LoopOutDoorAnim = 3,
31 kMA01LoopOutshotRoof = 4
32 };
33
34 enum kMA01Exits {
35 kMA01ExitMA06 = 0,
36 kMA01ExitSpinner = 1
37 };
38
InitializeScene()39 void SceneScriptMA01::InitializeScene() {
40 Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992);
41 if (Game_Flag_Query(kFlagSpinnerAtMA01)) {
42 Setup_Scene_Information( 381.0f, 0.0f, 54.0f, 992);
43 }
44 if (Game_Flag_Query(kFlagMA06toMA01)) {
45 Setup_Scene_Information(1446.0f, 0.0f, -725.0f, 660);
46 }
47
48 Scene_Exit_Add_2D_Exit(kMA01ExitMA06, 328, 132, 426, 190, 0);
49 if (Game_Flag_Query(kFlagSpinnerAtMA01)) {
50 Scene_Exit_Add_2D_Exit(kMA01ExitSpinner, 234, 240, 398, 328, 2);
51 }
52
53 Ambient_Sounds_Add_Looping_Sound(kSfxROOFRAN1, 90, 0, 1);
54 Ambient_Sounds_Add_Looping_Sound(kSfxROOFAIR1, 40, -100, 1);
55 Ambient_Sounds_Add_Looping_Sound(kSfxROOFRMB1, 40, 100, 1);
56 Ambient_Sounds_Add_Sound(kSfxSPIN2B, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0);
57 Ambient_Sounds_Add_Sound(kSfxSPIN3A, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0);
58 Ambient_Sounds_Add_Sound(kSfxTHNDER2, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
59 Ambient_Sounds_Add_Sound(kSfxTHNDER3, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
60 Ambient_Sounds_Add_Sound(kSfxTHNDER4, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
61
62 if (Game_Flag_Query(kFlagMA06toMA01)) {
63 Scene_Loop_Set_Default(kMA01LoopMainLoop);
64 Game_Flag_Reset(kFlagMA06toMA01);
65 } else {
66 Actor_Set_Invisible(kActorMcCoy, true);
67 Game_Flag_Set(kFlagArrivedFromSpinner2);
68 Scene_Loop_Start_Special(kSceneLoopModeLoseControl, kMA01LoopInshotRoof, false);
69 Scene_Loop_Set_Default(kMA01LoopMainLoop);
70 }
71
72 if (Game_Flag_Query(kFlagMA01GaffApproachMcCoy)) {
73 Actor_Set_Goal_Number(kActorGaff, kGoalGaffMA01ApproachMcCoy);
74 Game_Flag_Reset(kFlagMA01GaffApproachMcCoy);
75 }
76 }
77
SceneLoaded()78 void SceneScriptMA01::SceneLoaded() {
79 Obstacle_Object("WRENCH", true);
80 Unobstacle_Object("OBSTICLEBOX01", true);
81 Clickable_Object("WRENCH");
82 Unclickable_Object("Y2 PADRIM 01");
83 Unclickable_Object("Y2 PADRIM 02");
84 Unclickable_Object("NGON01");
85 }
86
MouseClick(int x,int y)87 bool SceneScriptMA01::MouseClick(int x, int y) {
88 return Region_Check(286, 326, 348, 384);
89 }
90
ClickedOn3DObject(const char * objectName,bool a2)91 bool SceneScriptMA01::ClickedOn3DObject(const char *objectName, bool a2) {
92 return false;
93 }
94
ClickedOnActor(int actorId)95 bool SceneScriptMA01::ClickedOnActor(int actorId) {
96 return false;
97 }
98
ClickedOnItem(int itemId,bool a2)99 bool SceneScriptMA01::ClickedOnItem(int itemId, bool a2) {
100 return false;
101 }
102
ClickedOnExit(int exitId)103 bool SceneScriptMA01::ClickedOnExit(int exitId) {
104 if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenMA01AttackMcCoy) {
105 return true;
106 }
107
108 if (exitId == kMA01ExitMA06) {
109 if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenFled) {
110 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 1446.0f, 0.0f, -725.0f, 72, true, false, false)) {
111 Actor_Set_Goal_Number(kActorZuben, kGoalZubenMA01AttackMcCoy);
112 Scene_Exits_Disable();
113 }
114 } else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 1446.0f, 0.0f, -725.0f, 12, true, false, false)) {
115 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
116 Ambient_Sounds_Remove_All_Looping_Sounds(1);
117 Game_Flag_Set(kFlagMA01toMA06);
118 Set_Enter(kSetMA06, kSceneMA06);
119 }
120 return true;
121 }
122
123 if (exitId == kMA01ExitSpinner) {
124 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 381.0f, 0.0f, 54.0f, 0, true, false, false)) {
125 Player_Loses_Control();
126 Actor_Face_Heading(kActorMcCoy, 736, false);
127 Game_Flag_Reset(kFlagMcCoyInChinaTown);
128 Game_Flag_Reset(kFlagMcCoyInRunciters);
129 Game_Flag_Reset(kFlagMcCoyInMcCoyApartment);
130 Game_Flag_Reset(kFlagMcCoyInAnimoidRow);
131 Game_Flag_Reset(kFlagMcCoyInTyrellBuilding);
132 Game_Flag_Reset(kFlagMcCoyInDNARow);
133 Game_Flag_Reset(kFlagMcCoyInBradburyBuilding);
134 Game_Flag_Reset(kFlagMcCoyInPoliceStation);
135 int spinnerDest = Spinner_Interface_Choose_Dest(kMA01LoopOutDoorAnim, false);
136 switch (spinnerDest) {
137 case kSpinnerDestinationPoliceStation:
138 Game_Flag_Set(kFlagMcCoyInPoliceStation);
139 Game_Flag_Reset(kFlagSpinnerAtMA01);
140 Game_Flag_Set(kFlagSpinnerAtPS01);
141 Set_Enter(kSetPS01, kScenePS01);
142 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
143 break;
144 case kSpinnerDestinationRuncitersAnimals:
145 Game_Flag_Set(kFlagMcCoyInRunciters);
146 Game_Flag_Reset(kFlagSpinnerAtMA01);
147 Game_Flag_Set(kFlagSpinnerAtRC01);
148 Set_Enter(kSetRC01, kSceneRC01);
149 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
150 break;
151 case kSpinnerDestinationChinatown:
152 Game_Flag_Set(kFlagMcCoyInChinaTown);
153 Game_Flag_Reset(kFlagSpinnerAtMA01);
154 Game_Flag_Set(kFlagSpinnerAtCT01);
155 Set_Enter(kSetCT01_CT12, kSceneCT01);
156 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
157 break;
158 case kSpinnerDestinationTyrellBuilding:
159 Game_Flag_Set(kFlagMcCoyInTyrellBuilding);
160 Game_Flag_Reset(kFlagSpinnerAtMA01);
161 Game_Flag_Set(kFlagSpinnerAtTB02);
162 Set_Enter(kSetTB02_TB03, kSceneTB02);
163 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
164 break;
165 case kSpinnerDestinationAnimoidRow:
166 Game_Flag_Set(kFlagMcCoyInAnimoidRow);
167 Game_Flag_Reset(kFlagSpinnerAtMA01);
168 Game_Flag_Set(kFlagSpinnerAtAR01);
169 Set_Enter(kSetAR01_AR02, kSceneAR01);
170 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
171 break;
172 case kSpinnerDestinationDNARow:
173 Game_Flag_Set(kFlagMcCoyInDNARow);
174 Game_Flag_Reset(kFlagSpinnerAtMA01);
175 Game_Flag_Set(kFlagSpinnerAtDR01);
176 Set_Enter(kSetDR01_DR02_DR04, kSceneDR01);
177 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
178 break;
179 case kSpinnerDestinationBradburyBuilding:
180 Game_Flag_Set(kFlagMcCoyInBradburyBuilding);
181 Game_Flag_Reset(kFlagSpinnerAtMA01);
182 Game_Flag_Set(kFlagSpinnerAtBB01);
183 Set_Enter(kSetBB01, kSceneBB01);
184 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
185 break;
186 case kSpinnerDestinationNightclubRow:
187 Game_Flag_Set(kFlagMcCoyInNightclubRow);
188 Game_Flag_Reset(kFlagSpinnerAtMA01);
189 Game_Flag_Set(kFlagSpinnerAtNR01);
190 Set_Enter(kSetNR01, kSceneNR01);
191 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
192 break;
193 case kSpinnerDestinationHysteriaHall:
194 Game_Flag_Set(kFlagMcCoyInHysteriaHall);
195 Game_Flag_Reset(kFlagSpinnerAtMA01);
196 Game_Flag_Set(kFlagSpinnerAtHF01);
197 Set_Enter(kSetHF01, kSceneHF01);
198 Scene_Loop_Start_Special(kSceneLoopModeChangeSet, kMA01LoopOutshotRoof, true);
199 break;
200 default:
201 Actor_Set_Invisible(kActorMcCoy, false);
202 Actor_Face_Heading(kActorMcCoy, 736, false);
203 Game_Flag_Set(kFlagMcCoyInMcCoyApartment);
204 break;
205 }
206 }
207 return true;
208 }
209 return false;
210 }
211
ClickedOn2DRegion(int region)212 bool SceneScriptMA01::ClickedOn2DRegion(int region) {
213 return false;
214 }
215
SceneFrameAdvanced(int frame)216 void SceneScriptMA01::SceneFrameAdvanced(int frame) {
217 if (frame == 15) {
218 Ambient_Sounds_Play_Sound(kSfxROOFLIT1, 70, -100, 100, 0);
219 }
220
221 if (frame == 61
222 || frame == 183
223 ) {
224 Ambient_Sounds_Play_Sound(kSfxSPINOPN4, 100, 40, 0, 99);
225 }
226
227 if (frame == 107
228 || frame == 227
229 ) {
230 Ambient_Sounds_Play_Sound(kSfxSPINCLS1, 100, 40, 0, 99);
231 }
232
233 if (frame == 1) {
234 Ambient_Sounds_Play_Sound(kSfxCARDOWN3, 40, -60, 20, 99);
235 }
236
237 if (frame == 241) {
238 Ambient_Sounds_Play_Sound(kSfxCARUP3, 40, 0, 0, 99);
239 }
240
241 if (frame == 58) {
242 Sound_Play(kSfxMTLHIT1, 17, 20, 20, 50);
243 }
244
245 if ((frame == 75
246 || frame == 196
247 )
248 && Game_Flag_Query(kFlagArrivedFromSpinner2)
249 ) {
250 Actor_Face_Heading(kActorMcCoy, 736, false);
251 Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeSpinnerGetOut);
252 Game_Flag_Reset(kFlagArrivedFromSpinner2);
253 } else {
254 if ( frame == 196
255 && !Game_Flag_Query(kFlagArrivedFromSpinner2)
256 ) {
257 Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeSpinnerGetIn);
258 //return true;
259 return;
260 }
261 if (frame == 240) {
262 Player_Gains_Control();
263 }
264 }
265 //return true;
266 }
267
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)268 void SceneScriptMA01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
269 }
270
PlayerWalkedIn()271 void SceneScriptMA01::PlayerWalkedIn() {
272 if (_vm->_cutContent) {
273 if (!Game_Flag_Query(kFlagCT01Visited) && !Actor_Clue_Query(kActorMcCoy, kClueDispatchHitAndRun)) {
274 Actor_Clue_Acquire(kActorMcCoy, kClueDispatchHitAndRun, false, kActorDispatcher);
275 ADQ_Add(kActorDispatcher, 80, kAnimationModeTalk);
276 if (Game_Flag_Query(kFlagRC01PoliceDone)) {
277 ADQ_Add(kActorOfficerLeary, 340, kAnimationModeTalk); // sector 3 - go ahead
278 } else {
279 ADQ_Add(kActorOfficerGrayford, 360, kAnimationModeTalk); // sector 3 - go ahead
280 }
281 ADQ_Add(kActorDispatcher, 90, kAnimationModeTalk);
282 ADQ_Add(kActorDispatcher, 100, kAnimationModeTalk);
283 ADQ_Add(kActorDispatcher, 110, kAnimationModeTalk);
284 if (Game_Flag_Query(kFlagRC01PoliceDone)) {
285 ADQ_Add(kActorOfficerLeary, 350, kAnimationModeTalk); // sector 3 - responding code 3
286 } else {
287 ADQ_Add(kActorOfficerGrayford, 370, kAnimationModeTalk); // sector 3 - responding code 3
288 }
289 ADQ_Add_Pause(1000);
290 ADQ_Add(kActorDispatcher, 120, kAnimationModeTalk);
291 ADQ_Add(kActorDispatcher, 130, kAnimationModeTalk);
292 ADQ_Add(kActorDispatcher, 140, kAnimationModeTalk);
293 ADQ_Add(kActorDispatcher, 150, kAnimationModeTalk);
294 }
295 }
296 }
297
PlayerWalkedOut()298 void SceneScriptMA01::PlayerWalkedOut() {
299 Actor_Set_Invisible(kActorMcCoy, false);
300 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
301 Ambient_Sounds_Remove_All_Looping_Sounds(1);
302
303 if (_vm->_cutContent) {
304 ADQ_Flush(); // for dispatcher queue cleanup
305 }
306
307 if (!Game_Flag_Query(kFlagMA01toMA06)) {
308 if (Global_Variable_Query(kVariableChapter) == 1) {
309 Outtake_Play(kOuttakeTowards2, true, -1);
310 Outtake_Play(kOuttakeInside1, true, -1);
311 // // Commented out - Has no sound - TODO can we use external SFX for it?
312 // if (_vm->_cutContent) {
313 // Outtake_Play(kOuttakeFlyThrough, true, -1);
314 // }
315 Outtake_Play(kOuttakeTowards1, true, -1);
316 }
317 #if BLADERUNNER_ORIGINAL_BUGS
318 #else
319 else {
320 // Acts 2, 3 - should still use a spinner fly-through transition
321 if (!Game_Flag_Query(kFlagMcCoyInTyrellBuilding)) {
322 // don't play an extra outtake when going to Tyrell Building
323 Outtake_Play(kOuttakeAway1, true, -1); // available in Acts 2, 3
324 }
325 }
326 #endif // BLADERUNNER_ORIGINAL_BUGS
327 }
328 }
329
DialogueQueueFlushed(int a1)330 void SceneScriptMA01::DialogueQueueFlushed(int a1) {
331 }
332
333 } // End of namespace BladeRunner
334