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 SceneScriptCT06::InitializeScene() {
28 	if (Game_Flag_Query(kFlagCT05toCT06)) {
29 		Setup_Scene_Information(20.41f, -58.23f, 2.17f, 247);
30 		Game_Flag_Reset(kFlagCT05toCT06);
31 	} else if (Game_Flag_Query(kFlagCT07toCT06)) {
32 		Setup_Scene_Information(203.91f, -58.02f, 0.47f, 768);
33 	} else {
34 		Setup_Scene_Information(175.91f, -58.23f, 24.47f, 768);
35 	}
36 	Scene_Exit_Add_2D_Exit(0,   0, 440, 639, 479, 2);
37 	Scene_Exit_Add_2D_Exit(1, 401, 162, 536, 317, 0);
38 	if (Game_Flag_Query(kFlagZubenRetired) && Actor_Query_In_Set(kActorZuben, kSetCT07)) {
39 		Actor_Put_In_Set(kActorZuben, kSetCT06);
40 		Actor_Set_At_XYZ(kActorZuben, 58.41f, -58.23f, -24.97f, 240);
41 		Actor_Retired_Here(kActorZuben, 72, 36, 1, kActorMcCoy);
42 	}
43 	Ambient_Sounds_Add_Looping_Sound(kSfxRAIN10,   100, 1, 1);
44 	Ambient_Sounds_Add_Looping_Sound(kSfxCTDRONE1,  20, 1, 1);
45 	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy,  0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
46 	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
47 	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
48 	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
49 	Ambient_Sounds_Add_Sound(kSfxSPIN2A,  80, 180, 16,  25, 0, 0, -101, -101, 0, 0);
50 	Ambient_Sounds_Add_Sound(kSfxSPIN2B,  50, 180, 16,  25, 0, 0, -101, -101, 0, 0);
51 	Ambient_Sounds_Add_Sound(kSfxTHNDR2,  50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
52 	Ambient_Sounds_Add_Sound(kSfxTHNDR3,  70, 180, 50, 100, 0, 0, -101, -101, 0, 0);
53 	Ambient_Sounds_Add_Sound(kSfxTHNDER4, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0);
54 	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06HideAtFreeSlotA) {
55 		Ambient_Sounds_Add_Sound(kSfxZUBWLK1, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0);
56 		Ambient_Sounds_Add_Sound(kSfxZUBWLK2, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0);
57 		Ambient_Sounds_Add_Sound(kSfxZUBWLK3, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0);
58 		Ambient_Sounds_Add_Sound(kSfxZUBWLK4, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0);
59 	}
60 }
61 
SceneLoaded()62 void SceneScriptCT06::SceneLoaded() {
63 	Obstacle_Object("BOX02", true);
64 	Obstacle_Object("CB BOX01", true);
65 	Obstacle_Object("CB BOX02", true);
66 	Obstacle_Object("CB BOX03", true);
67 	Unobstacle_Object("INSULPIP01", true);
68 	Unobstacle_Object("CB BOX04", true);
69 	Unclickable_Object("DOOR");
70 	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06HideAtFreeSlotA) {
71 		Preload(kModelAnimationMcCoyWithGunWalking);
72 		Preload(kModelAnimationMcCoyWithGunRunning);
73 		Preload(389);
74 		Preload(390);
75 		Preload(398);
76 		Preload(421);
77 		Preload(421);
78 	}
79 }
80 
MouseClick(int x,int y)81 bool SceneScriptCT06::MouseClick(int x, int y) {
82 	return false;
83 }
84 
ClickedOn3DObject(const char * objectName,bool a2)85 bool SceneScriptCT06::ClickedOn3DObject(const char *objectName, bool a2) {
86 	return false;
87 }
88 
ClickedOnActor(int actorId)89 bool SceneScriptCT06::ClickedOnActor(int actorId) {
90 	if (actorId == kActorZuben) {
91 		Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorZuben, 24, true, false);
92 		Actor_Face_Actor(kActorMcCoy, kActorZuben, true);
93 		if (!Game_Flag_Query(kFlagCT06ZubenPhoto)) {
94 			Actor_Clue_Acquire(kActorMcCoy, kClueZubenSquadPhoto, true, -1);
95 			Item_Pickup_Spin_Effect(kModelAnimationPhoto, 340, 369);
96 			Actor_Voice_Over(350, kActorVoiceOver);
97 			Actor_Voice_Over(360, kActorVoiceOver);
98 			Actor_Voice_Over(370, kActorVoiceOver);
99 			if (!Game_Flag_Query(kFlagDirectorsCut)) {
100 				Actor_Voice_Over(380, kActorVoiceOver);
101 				Actor_Voice_Over(390, kActorVoiceOver);
102 				Actor_Voice_Over(400, kActorVoiceOver);
103 				Actor_Voice_Over(410, kActorVoiceOver);
104 			}
105 			Game_Flag_Set(kFlagCT06ZubenPhoto);
106 			return true;
107 		}
108 		Actor_Says(kActorMcCoy, 8570, 13);
109 		return false;
110 	}
111 	return false;
112 }
113 
ClickedOnItem(int itemId,bool a2)114 bool SceneScriptCT06::ClickedOnItem(int itemId, bool a2) {
115 	return false;
116 }
117 
ClickedOnExit(int exitId)118 bool SceneScriptCT06::ClickedOnExit(int exitId) {
119 	if (exitId == 0) {
120 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 20.41f, -58.23f, -2.17f, 0, true, false, false)) {
121 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
122 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
123 			Game_Flag_Set(kFlagCT06toCT05);
124 			Set_Enter(kSetCT05, kSceneCT05);
125 			Game_Flag_Reset(kFlagNotUsed212);
126 		}
127 		return true;
128 	}
129 	if (exitId == 1) {
130 		if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06HideAtFreeSlotA) {
131 			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 203.91f, -58.02f, 0.47f, 0, true, false, false)) {
132 				Ambient_Sounds_Remove_Sound(kSfxZUBWLK1, true);
133 				Ambient_Sounds_Remove_Sound(kSfxZUBWLK2, true);
134 				Ambient_Sounds_Remove_Sound(kSfxZUBWLK3, true);
135 				Ambient_Sounds_Remove_Sound(kSfxZUBWLK4, true);
136 				Player_Loses_Control();
137 				Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT06JumpDown);
138 				Game_Flag_Reset(kFlagNotUsed212);
139 			}
140 			return true;
141 		}
142 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 203.91f, -58.02f, 0.47f, 0, true, false, false)) {
143 			if (Global_Variable_Query(kVariableChapter) < 3) {
144 				Actor_Face_Object(kActorMcCoy, "DOOR", true);
145 				Actor_Says(kActorMcCoy, 8522, 12);
146 			} else {
147 				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
148 				Ambient_Sounds_Remove_All_Looping_Sounds(1);
149 				Game_Flag_Set(kFlagCT06toCT08);
150 				Set_Enter(kSetCT08_CT51_UG12, kSceneCT08);
151 				Game_Flag_Reset(kFlagNotUsed212);
152 			}
153 		}
154 	}
155 	return false;
156 }
157 
ClickedOn2DRegion(int region)158 bool SceneScriptCT06::ClickedOn2DRegion(int region) {
159 	return false;
160 }
161 
SceneFrameAdvanced(int frame)162 void SceneScriptCT06::SceneFrameAdvanced(int frame) {
163 }
164 
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)165 void SceneScriptCT06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
166 }
167 
PlayerWalkedIn()168 void SceneScriptCT06::PlayerWalkedIn() {
169 	if (Game_Flag_Query(kFlagCT07toCT06)) {
170 		Game_Flag_Reset(kFlagCT07toCT06);
171 	}
172 }
173 
PlayerWalkedOut()174 void SceneScriptCT06::PlayerWalkedOut() {
175 }
176 
DialogueQueueFlushed(int a1)177 void SceneScriptCT06::DialogueQueueFlushed(int a1) {
178 }
179 
180 } // End of namespace BladeRunner
181