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 SceneScriptMA07::InitializeScene() {
28 	if (Game_Flag_Query(kFlagUG19toMA07)) {
29 		Setup_Scene_Information(  6.75f, -172.43f, 356.0f, 997);
30 		Game_Flag_Reset(kFlagUG19toMA07);
31 		Game_Flag_Set(kFlagUG19Available);
32 	} else if (Game_Flag_Query(kFlagPS14toMA07)) {
33 		Setup_Scene_Information(-312.0f,  -162.8f, 180.0f,   0);
34 	} else {
35 		Setup_Scene_Information( 104.0f, -162.16f,  56.0f, 519);
36 	}
37 
38 	Ambient_Sounds_Add_Looping_Sound(kSfxRAIN10, 100, 1, 1);
39 	Ambient_Sounds_Add_Sound(kSfxCOLONY,  100, 300, 16,  25, 0, 0, -101, -101, 0, 0);
40 	Ambient_Sounds_Add_Sound(kSfxSPIN2B,   60, 180, 16,  25, 0, 0, -101, -101, 0, 0);
41 	Ambient_Sounds_Add_Sound(kSfxSPIN3A,   60, 180, 16,  25, 0, 0, -101, -101, 0, 0);
42 	Ambient_Sounds_Add_Sound(kSfxTHNDER2,  60, 180, 50, 100, 0, 0, -101, -101, 0, 0);
43 	Ambient_Sounds_Add_Sound(kSfxTHNDER3,  50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
44 	Ambient_Sounds_Add_Sound(kSfxTHNDER4,  50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
45 
46 	if (Global_Variable_Query(kVariableChapter) > 1) {
47 		Scene_Exit_Add_2D_Exit(1, 0, 200, 50, 479, 3);
48 	}
49 	if (Game_Flag_Query(kFlagUG19Available)) {
50 		Scene_Exit_Add_2D_Exit(2, 176, 386, 230, 426, 2);
51 	}
52 	Scene_Exit_Add_2D_Exit(0, 270, 216, 382, 306, 0);
53 }
54 
SceneLoaded()55 void SceneScriptMA07::SceneLoaded() {
56 	Obstacle_Object("BARRICADE", true);
57 	if (_vm->_cutContent) {
58 		if (Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelShouldBeOutsideMcCoysAct3) {
59 			Actor_Set_Goal_Number(kActorRachael, kGoalRachaelIsOutsideMcCoysBuildingAct3);
60 		}
61 	}
62 }
63 
MouseClick(int x,int y)64 bool SceneScriptMA07::MouseClick(int x, int y) {
65 	return false;
66 }
67 
ClickedOn3DObject(const char * objectName,bool a2)68 bool SceneScriptMA07::ClickedOn3DObject(const char *objectName, bool a2) {
69 	return false;
70 }
71 
ClickedOnActor(int actorId)72 bool SceneScriptMA07::ClickedOnActor(int actorId) {
73 	return false;
74 }
75 
ClickedOnItem(int itemId,bool a2)76 bool SceneScriptMA07::ClickedOnItem(int itemId, bool a2) {
77 	return false;
78 }
79 
ClickedOnExit(int exitId)80 bool SceneScriptMA07::ClickedOnExit(int exitId) {
81 	if (exitId == 0) {
82 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 104.0f, -162.0f, 56.0f, 12, true, false, false)) {
83 			if (Global_Variable_Query(kVariableChapter) == 4
84 			 && Game_Flag_Query(kFlagUG18GuzzaScene)
85 			) {
86 				Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyStartChapter5);
87 			} else {
88 				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
89 				Ambient_Sounds_Remove_All_Looping_Sounds(1);
90 				Game_Flag_Set(kFlagMA07toMA06);
91 				Set_Enter(kSetMA06, kSceneMA06);
92 			}
93 		}
94 		return true;
95 	}
96 
97 	if (exitId == 1) {
98 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -400.0f, -162.8f, 185.08f, 0, true, false, false)) {
99 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
100 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
101 			Game_Flag_Set(kFlagMA07toPS14);
102 			Game_Flag_Reset(kFlagMcCoyInMcCoyApartment);
103 			Game_Flag_Set(kFlagMcCoyInPoliceStation);
104 			Set_Enter(kSetPS14, kScenePS14);
105 		}
106 		return true;
107 	}
108 
109 	if (exitId == 2) {
110 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 8.0f, -172.43f, 356.0f, 0, true, false, false)) {
111 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
112 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
113 			Game_Flag_Set(kFlagMA07toUG19);
114 			Set_Enter(kSetUG19, kSceneUG19);
115 		}
116 		return true;
117 	}
118 	return false;
119 }
120 
ClickedOn2DRegion(int region)121 bool SceneScriptMA07::ClickedOn2DRegion(int region) {
122 	return false;
123 }
124 
SceneFrameAdvanced(int frame)125 void SceneScriptMA07::SceneFrameAdvanced(int frame) {
126 }
127 
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)128 void SceneScriptMA07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
129 	if (actorId == kActorGaff
130 	 && newGoal == kGoalGaffMA07Left
131 	) {
132 		Scene_Exits_Enable();
133 	}
134 }
135 
PlayerWalkedIn()136 void SceneScriptMA07::PlayerWalkedIn() {
137 	if (Game_Flag_Query(kFlagPS14toMA07)) {
138 		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -268.0f, -162.8f, 188.0f, 0, false, false, false);
139 		Game_Flag_Reset(kFlagPS14toMA07);
140 	}
141 
142 	if (Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutsideMcCoysBuildingAct3) {
143 		Actor_Set_Goal_Number(kActorRachael, kGoalRachaelIsOutWalksToPoliceHQAct3);
144 	} else if (_vm->_cutContent && Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutsideMcCoysBuildingAct4) {
145 		Actor_Set_Goal_Number(kActorRachael, kGoalRachaelIsOutWalksToPoliceHQAct4);
146     }
147 
148 	if (Game_Flag_Query(kFlagMA06toMA07)) {
149 		Game_Flag_Reset(kFlagMA06toMA07);
150 	}
151 
152 	if (!Game_Flag_Query(kFlagMA07GaffTalk)
153 	 &&  Game_Flag_Query(kFlagUG18GuzzaScene)
154 	 &&  Global_Variable_Query(kVariableChapter) == 4
155 	) {
156 		Scene_Exits_Disable();
157 #if BLADERUNNER_ORIGINAL_BUGS
158 #else
159 		// don't have McCoy with his gun drawn out when talking to Gaff here
160 		Player_Set_Combat_Mode(false);
161 #endif // BLADERUNNER_ORIGINAL_BUGS
162 		Actor_Set_Goal_Number(kActorGaff, kGoalGaffMA07Wait);
163 	}
164 
165 	if (Game_Flag_Query(kFlagMcCoyFreedOfAccusations)) {
166 		Actor_Voice_Over(1360, kActorVoiceOver);
167 		Actor_Voice_Over(1370, kActorVoiceOver);
168 		Actor_Voice_Over(1380, kActorVoiceOver);
169 		Actor_Voice_Over(1390, kActorVoiceOver);
170 		Actor_Voice_Over(1400, kActorVoiceOver);
171 		Delay(1000);
172 		Game_Flag_Reset(kFlagMcCoyFreedOfAccusations);
173 		Game_Flag_Set(kFlagMA06ToMA02);
174 		Set_Enter(kSetMA02_MA04, kSceneMA02);
175 	}
176 	//return false;
177 
178 }
179 
PlayerWalkedOut()180 void SceneScriptMA07::PlayerWalkedOut() {
181 	if (_vm->_cutContent) {
182 		if (Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutsideMcCoysBuildingAct3
183 			|| Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutWalksToPoliceHQAct3
184 			|| Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutFleeingToPoliceHQAct3
185 		) {
186 			Actor_Set_Goal_Number(kActorRachael, kGoalRachaelAtEndOfAct3IfNotMetWithMcCoy);
187 		} else if (Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutResumesWalkToPoliceHQAct3) {
188 			Actor_Set_Goal_Number(kActorRachael, kGoalRachaelAtEndOfAct3IfMetWithMcCoy);
189 		} else if (Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutsideMcCoysBuildingAct4
190 			|| Actor_Query_Goal_Number(kActorRachael) == kGoalRachaelIsOutWalksToPoliceHQAct4
191 		) {
192 			Actor_Set_Goal_Number(kActorRachael, kGoalRachaelAtEndOfAct4);
193 		}
194 	}
195 }
196 
DialogueQueueFlushed(int a1)197 void SceneScriptMA07::DialogueQueueFlushed(int a1) {
198 }
199 
200 } // End of namespace BladeRunner
201