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
InitializeScene()27 void SceneScriptCT12::InitializeScene() {
28 if (Game_Flag_Query(kFlagCT01toCT12)) {
29 Setup_Scene_Information(-419.0f, -6.5f, 696.0f, 616);
30 } else if (Game_Flag_Query(kFlagUG09toCT12)) {
31 Setup_Scene_Information(-292.0f, -6.5f, 990.0f, 827);
32 if (!Game_Flag_Query(kFlagNotUsed150)) {
33 Game_Flag_Set(kFlagNotUsed150);
34 }
35 Game_Flag_Reset(kFlagUG09toCT12);
36 } else if (Game_Flag_Query(kFlagCT11toCT12)) {
37 Setup_Scene_Information(-493.0f, -6.5f, 1174.0f, 990);
38 } else {
39 Setup_Scene_Information(-386.13f, -6.5f, 1132.72f, 783);
40 }
41
42 Scene_Exit_Add_2D_Exit(0, 0, 0, 40, 479, 3);
43 Scene_Exit_Add_2D_Exit(1, 78, 224, 162, 330, 0);
44 Scene_Exit_Add_2D_Exit(2, 500, 180, 619, 346, 0);
45 if (Global_Variable_Query(kVariableChapter) > 2) {
46 Scene_Exit_Add_2D_Exit(3, 620, 0, 639, 479, 1);
47 }
48 if (Global_Variable_Query(kVariableChapter) > 3) {
49 Scene_Exit_Add_2D_Exit(4, 324, 150, 435, 340, 0);
50 }
51
52 Ambient_Sounds_Add_Looping_Sound(kSfxCTRAIN1, 33, 1, 1);
53 Ambient_Sounds_Add_Looping_Sound(kSfxCTAMBL1, 20, -100, 1);
54 Ambient_Sounds_Add_Looping_Sound(kSfxCTAMBR1, 20, -100, 1);
55 Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
56 Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
57 Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
58 Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
59 Ambient_Sounds_Add_Sound(kSfxSPIN2B, 60, 180, 20, 33, 0, 0, -101, -101, 0, 0);
60 Ambient_Sounds_Add_Sound(kSfxSPIN3A, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0);
61 Ambient_Sounds_Add_Sound(kSfxTHNDER2, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0);
62 Ambient_Sounds_Add_Sound(kSfxTHNDER3, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
63 Ambient_Sounds_Add_Sound(kSfxTHNDER4, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
64
65 if (Global_Variable_Query(kVariableChapter) < 2
66 && Actor_Query_Goal_Number(kActorGaff) == kGoalGaffCT12WaitForMcCoy
67 ) {
68 Actor_Put_In_Set(kActorGaff, kSetCT01_CT12);
69 Actor_Set_At_XYZ(kActorGaff, -534.0f, -6.5f, 952.0f, 367);
70 Game_Flag_Set(kFlagCT12GaffSpinner);
71 }
72
73 #if BLADERUNNER_ORIGINAL_BUGS
74 #else
75 if (!Actor_Query_In_Set(kActorHowieLee, kSetCT01_CT12)
76 && Global_Variable_Query(kVariableChapter) < 4) {
77 AI_Movement_Track_Flush(kActorHowieLee);
78 AI_Movement_Track_Append(kActorHowieLee, 67, 0); // in kSetCT01_CT12
79 Actor_Set_Goal_Number(kActorHowieLee, kGoalHowieLeeDefault);
80 }
81 #endif // BLADERUNNER_ORIGINAL_BUGS
82
83 if (Game_Flag_Query(kFlagCT01toCT12)
84 && Game_Flag_Query(kFlagSpinnerAtCT01)
85 ) {
86 if (Global_Variable_Query(kVariableChapter) != 2
87 && Global_Variable_Query(kVariableChapter) != 3
88 ) {
89 Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 1, false);
90 }
91 Scene_Loop_Set_Default(2);
92 Game_Flag_Reset(kFlagCT01toCT12);
93 } else if ( Game_Flag_Query(kFlagCT01toCT12)
94 && !Game_Flag_Query(kFlagSpinnerAtCT01)
95 ) {
96 if (Global_Variable_Query(kVariableChapter) != 2
97 && Global_Variable_Query(kVariableChapter) != 3
98 ) {
99 Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
100 }
101 Scene_Loop_Set_Default(2);
102 Game_Flag_Reset(kFlagCT01toCT12);
103 } else if (Game_Flag_Query(kFlagCT05toCT12)
104 && Game_Flag_Query(kFlagCT12GaffSpinner)
105 ) {
106 Game_Flag_Reset(kFlagCT05toCT12);
107 Scene_Loop_Set_Default(4);
108 } else if ( Game_Flag_Query(kFlagCT05toCT12)
109 && !Game_Flag_Query(kFlagCT12GaffSpinner)
110 ) {
111 Game_Flag_Reset(kFlagCT05toCT12);
112 Scene_Loop_Set_Default(2);
113 } else {
114 Scene_Loop_Set_Default(2);
115 }
116 }
117
SceneLoaded()118 void SceneScriptCT12::SceneLoaded() {
119 Obstacle_Object("BOX18", true);
120 Unobstacle_Object("SPINNER BODY", true);
121 Unobstacle_Object("HOWFLOOR", true);
122 Unclickable_Object("TURBINE");
123 #if BLADERUNNER_ORIGINAL_BUGS
124 #else
125 Unclickable_Object("OBJECT03");
126 Unclickable_Object("OBJECT04");
127 Unclickable_Object("OBJECT05");
128 #endif // BLADERUNNER_ORIGINAL_BUGS
129 }
130
MouseClick(int x,int y)131 bool SceneScriptCT12::MouseClick(int x, int y) {
132 return false;
133 }
134
ClickedOn3DObject(const char * objectName,bool a2)135 bool SceneScriptCT12::ClickedOn3DObject(const char *objectName, bool a2) {
136 return false;
137 }
138
ClickedOnActor(int actorId)139 bool SceneScriptCT12::ClickedOnActor(int actorId) {
140 if (actorId == kActorHowieLee) {
141 Actor_Face_Actor(kActorMcCoy, kActorHowieLee, true);
142 Actor_Says(kActorMcCoy, 8910, 16);
143 }
144
145 // cut off feature? grayford never visit CT12 as goal 308 is never triggered
146 // bug? Marking this as a bug to revisit at a later time
147 if (actorId == kActorOfficerGrayford
148 && Global_Variable_Query(kVariableChapter) == 4
149 && Game_Flag_Query(kFlagUG18GuzzaScene)
150 && Game_Flag_Query(kFlagUG18BriefcaseTaken)
151 ) {
152 Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
153 Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
154 Actor_Says(kActorMcCoy, 710, kAnimationModeTalk); // Hold it! I'm not a Replicant, I got proof!
155 Actor_Says(kActorOfficerGrayford, 20, kAnimationModeTalk);
156 Actor_Says(kActorMcCoy, 715, kAnimationModeTalk);
157 Actor_Says(kActorOfficerGrayford, 30, kAnimationModeTalk);
158 Actor_Says(kActorMcCoy, 720, kAnimationModeTalk);
159 Actor_Says(kActorOfficerGrayford, 40, kAnimationModeTalk);
160 Actor_Says(kActorOfficerGrayford, 50, kAnimationModeTalk);
161 Actor_Says(kActorOfficerGrayford, 60, kAnimationModeTalk);
162 Actor_Says(kActorMcCoy, 725, kAnimationModeTalk);
163 Actor_Says(kActorOfficerGrayford, 70, kAnimationModeTalk);
164 Actor_Says(kActorOfficerGrayford, 80, kAnimationModeTalk);
165 Actor_Says(kActorOfficerGrayford, 90, kAnimationModeTalk); // if you are lying...
166 Actor_Says(kActorOfficerGrayford, 100, kAnimationModeTalk); // you gonna wish...
167 Actor_Says(kActorOfficerGrayford, 110, kAnimationModeTalk); // Take him in!
168 Game_Flag_Set(kFlagUnpauseGenWalkers);
169 Game_Flag_Set(kFlagMcCoyFreedOfAccusations);
170 Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyStartChapter5);
171 }
172 return false;
173 }
174
ClickedOnItem(int itemId,bool a2)175 bool SceneScriptCT12::ClickedOnItem(int itemId, bool a2) {
176 return false;
177 }
178
ClickedOnExit(int exitId)179 bool SceneScriptCT12::ClickedOnExit(int exitId) {
180 if (exitId == 0) {
181 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -419.15f, -6.5f, 696.94f, 0, true, false, false)) {
182 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
183 Game_Flag_Set(kFlagCT12toCT01);
184 Set_Enter(kSetCT01_CT12, kSceneCT01);
185 }
186 return true;
187 }
188
189 if (exitId == 1) {
190 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -182.69f, -6.5f, 696.94f, 0, true, false, false)) {
191 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
192 Ambient_Sounds_Remove_All_Looping_Sounds(1);
193 Game_Flag_Set(kFlagCT12toCT03);
194 Set_Enter(kSetCT03_CT04, kSceneCT03);
195 }
196 return true;
197 }
198
199 if (exitId == 2) {
200 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -386.13f, -6.5f, 1132.72f, 0, true, false, false)) {
201 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
202 Ambient_Sounds_Remove_All_Looping_Sounds(1);
203 Game_Flag_Set(kFlagCT12toCT05);
204 Set_Enter(kSetCT05, kSceneCT05);
205 }
206 return true;
207 }
208
209 if (exitId == 3) {
210 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -493.0f, -6.5f, 1174.0f, 0, true, false, false)) {
211 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
212 Ambient_Sounds_Remove_All_Looping_Sounds(1);
213 Game_Flag_Set(kFlagCT12toCT11);
214 Set_Enter(kSetCT11, kSceneCT11);
215 }
216 return true;
217 }
218
219 if (exitId == 4) {
220 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -292.0f, -6.5f, 990.0f, 0, true, false, false)) {
221 if (Global_Variable_Query(kVariableChapter) == 4) {
222 Game_Flag_Set(kFlagUnpauseGenWalkers);
223 }
224 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
225 Ambient_Sounds_Remove_All_Looping_Sounds(1);
226 Game_Flag_Set(kFlagCT12ToUG09);
227 Set_Enter(kSetUG09, kSceneUG09);
228 }
229 return true;
230 }
231 return false;
232 }
233
ClickedOn2DRegion(int region)234 bool SceneScriptCT12::ClickedOn2DRegion(int region) {
235 return false;
236 }
237
SceneFrameAdvanced(int frame)238 void SceneScriptCT12::SceneFrameAdvanced(int frame) {
239 if (((frame - 1) % 10) == 0) {
240 Sound_Play(Random_Query(kSfxNEON5, kSfxNEON6), 10, -80, -80, 50);
241 }
242
243 if (frame == 160) {
244 Actor_Change_Animation_Mode(kActorGaff, 41);
245 }
246
247 if (frame == 152) {
248 Sound_Play(kSfxSPINOPN4, 100, 40, 0, 50);
249 }
250
251 if (frame == 203) {
252 Sound_Play(kSfxSPINCLS1, 100, 40, 0, 50);
253 }
254
255 if (frame == 212) {
256 Sound_Play(kSfxCARUP3, 40, 0, 0, 50);
257 }
258
259 if (frame == 269) {
260 Player_Gains_Control();
261 Player_Set_Combat_Mode(false);
262 Actor_Set_Invisible(kActorGaff, false);
263 }
264 }
265
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)266 void SceneScriptCT12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
267 }
268
PlayerWalkedIn()269 void SceneScriptCT12::PlayerWalkedIn() {
270 if ( Global_Variable_Query(kVariableChapter) < 2
271 && !Game_Flag_Query(kFlagGaffApproachedMcCoyAboutZuben)
272 && Actor_Query_Goal_Number(kActorGaff) == kGoalGaffCT12WaitForMcCoy
273 ) {
274 #if !BLADERUNNER_ORIGINAL_BUGS
275 // Disable NPC walkers until Gaff goes to his spinner
276 Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
277 Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
278 Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
279 Global_Variable_Set(kVariableGenericWalkerConfig, -1);
280 #endif // !BLADERUNNER_ORIGINAL_BUGS
281 Player_Loses_Control();
282 Loop_Actor_Walk_To_Actor(kActorGaff, kActorMcCoy, 48, false, false);
283 Actor_Face_Actor(kActorGaff, kActorMcCoy, true);
284 Actor_Face_Actor(kActorMcCoy, kActorGaff, true);
285 Actor_Says(kActorGaff, 0, kAnimationModeTalk);
286 Actor_Says(kActorMcCoy, 670, kAnimationModeTalk);
287 Actor_Says(kActorGaff, 10, kAnimationModeTalk);
288 Actor_Says(kActorMcCoy, 675, kAnimationModeTalk);
289 Actor_Says(kActorGaff, 20, kAnimationModeTalk);
290 Actor_Says(kActorMcCoy, 680, kAnimationModeTalk);
291 Actor_Says(kActorGaff, 30, kAnimationModeTalk);
292 Actor_Says(kActorMcCoy, 685, kAnimationModeTalk);
293 Actor_Says(kActorGaff, 40, kAnimationModeTalk);
294 Actor_Says(kActorMcCoy, 690, kAnimationModeTalk);
295 Actor_Clue_Acquire(kActorMcCoy, kClueGaffsInformation, true, kActorGaff);
296 Game_Flag_Set(kFlagGaffApproachedMcCoyAboutZuben);
297 CDB_Set_Crime(kClueZubenSquadPhoto, kCrimeMoonbusHijacking);
298
299 if (Game_Flag_Query(kFlagGaffApproachedMcCoyAboutZuben)
300 && Game_Flag_Query(kFlagZubenRetired)
301 ) {
302 Actor_Says(kActorGaff, 50, kAnimationModeTalk);
303 Actor_Says(kActorMcCoy, 695, kAnimationModeTalk);
304 Actor_Says(kActorGaff, 60, kAnimationModeTalk);
305 Actor_Says(kActorMcCoy, 700, kAnimationModeTalk);
306 Actor_Says(kActorGaff, 70, kAnimationModeTalk);
307 Actor_Clue_Acquire(kActorGaff, kClueMcCoyRetiredZuben, true, -1);
308 } else if (Game_Flag_Query(kFlagGaffApproachedMcCoyAboutZuben)
309 && Game_Flag_Query(kFlagZubenSpared)
310 ) {
311 Actor_Says(kActorGaff, 80, kAnimationModeTalk);
312 Actor_Says(kActorGaff, 90, kAnimationModeTalk);
313 Actor_Says(kActorMcCoy, 705, kAnimationModeTalk);
314 Actor_Says(kActorGaff, 100, kAnimationModeTalk);
315 Actor_Clue_Acquire(kActorGaff, kClueMcCoyLetZubenEscape, true, -1);
316 }
317
318 #if !BLADERUNNER_ORIGINAL_BUGS
319 // unpause generic walkers here, less chance to collide with Gaff
320 // while he walks to his spinner
321 // This happens when Gaff starts walking towards his spinner rather than
322 // when he's reached his spinner, in order to keep this NPC code in one place
323 // and because the walkers won't have time to interfere with his path even if
324 // they're enabled early.
325 if (Global_Variable_Query(kVariableGenericWalkerConfig) < 0
326 ) {
327 Global_Variable_Set(kVariableGenericWalkerConfig, 2);
328 }
329 #endif
330 Actor_Set_Goal_Number(kActorGaff, kGoalGaffCT12GoToSpinner);
331 }
332
333 if (Game_Flag_Query(kFlagCT11toCT12)) {
334 Loop_Actor_Walk_To_XYZ(kActorMcCoy, -520.0f, -6.5f, 1103.0f, 0, false, false, false);
335 Game_Flag_Reset(kFlagCT11toCT12);
336 }
337 }
338
PlayerWalkedOut()339 void SceneScriptCT12::PlayerWalkedOut() {
340 Game_Flag_Reset(kFlagGenericWalkerWaiting); // A bug? why is this here? Left over code?
341 if (Game_Flag_Query(kFlagCT12ToUG09)) {
342 Game_Flag_Reset(kFlagMcCoyInChinaTown);
343 Game_Flag_Set(kFlagMcCoyInUnderground);
344 }
345 #if BLADERUNNER_ORIGINAL_BUGS
346 #else
347 // this enforces existing awry saved games from having a bad flag value
348 else {
349 Game_Flag_Set(kFlagMcCoyInChinaTown);
350 }
351 #endif // BLADERUNNER_ORIGINAL_BUGS
352 }
353
DialogueQueueFlushed(int a1)354 void SceneScriptCT12::DialogueQueueFlushed(int a1) {
355 }
356
357 } // End of namespace BladeRunner
358