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 UG15Loops {
28 kUG15LoopMainLoop = 0,
29 kUG15LoopBridgeBreaks = 2,
30 kUG15LoopMainLoopBridgeBroken = 3
31 };
32
InitializeScene()33 void SceneScriptUG15::InitializeScene() {
34 if (Game_Flag_Query(kFlagUG17toUG15)) {
35 Setup_Scene_Information( -25.0f, 26.31f, -434.0f, 520);
36 } else if (Game_Flag_Query(kFlagUG16toUG15a)) {
37 Setup_Scene_Information( -17.0f, 26.31f, -346.0f, 711);
38 } else if (Game_Flag_Query(kFlagUG16toUG15b)) {
39 Setup_Scene_Information( -18.0f, 48.07f, 62.0f, 650);
40 } else {
41 Setup_Scene_Information(-238.0f, 48.07f, 222.0f, 180);
42 if (Game_Flag_Query(kFlagUG15RatShot)
43 && (Random_Query(1, 10) == 10)
44 && !(_vm->_cutContent && Query_Difficulty_Level() == kGameDifficultyEasy)
45 ) {
46 Game_Flag_Reset(kFlagUG15RatShot);
47 }
48 }
49
50 if (Game_Flag_Query(kFlagUG15BridgeBroken)) {
51 Scene_Loop_Set_Default(kUG15LoopMainLoopBridgeBroken);
52 }
53
54 if (Game_Flag_Query(kFlagUG17toUG15)
55 || Game_Flag_Query(kFlagUG16toUG15a)
56 ) {
57 Scene_Exit_Add_2D_Exit(0, 260, 0, 307, 298, 0);
58 Scene_Exit_Add_2D_Exit(1, 301, 147, 337, 304, 1);
59 Game_Flag_Reset(kFlagUG17toUG15);
60 Game_Flag_Reset(kFlagUG16toUG15a);
61 } else {
62 Scene_Exit_Add_2D_Exit(2, 406, 128, 480, 316, 1);
63 Scene_Exit_Add_2D_Exit(3, 0, 0, 30, 479, 3);
64 }
65
66 Ambient_Sounds_Add_Looping_Sound(kSfxCTRUNOFF, 71, 0, 1);
67 Ambient_Sounds_Add_Looping_Sound(kSfxBOILPOT2, 45, 0, 1);
68 Ambient_Sounds_Add_Looping_Sound(kSfxUGBED1, 76, 0, 1);
69 Ambient_Sounds_Add_Sound(kSfxBBDRIP1, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0);
70 Ambient_Sounds_Add_Sound(kSfxBBDRIP2, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0);
71 Ambient_Sounds_Add_Sound(kSfxBBDRIP3, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0);
72 Ambient_Sounds_Add_Sound(kSfxBBDRIP4, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0);
73 Ambient_Sounds_Add_Sound(kSfxBBDRIP5, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0);
74 Ambient_Sounds_Add_Sound(kSfxYELL1M2, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
75 Ambient_Sounds_Add_Sound(kSfxYELL1M3, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
76 Ambient_Sounds_Add_Sound(kSfxGRUNT1M1, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
77 Ambient_Sounds_Add_Sound(kSfxGRUNT2M2, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
78 Ambient_Sounds_Add_Sound(kSfxGRUNT2M3, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
79 Ambient_Sounds_Add_Sound(kSfxBBGRN1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0);
80 Ambient_Sounds_Add_Sound(kSfxBBGRN2, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0);
81 Ambient_Sounds_Add_Sound(kSfxBBGRN3, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0);
82 Ambient_Sounds_Add_Sound(kSfxSTEAM1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0);
83 Ambient_Sounds_Add_Sound(kSfxSTEAM3, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0);
84 Ambient_Sounds_Add_Sound(kSfxSTEAM6A, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0);
85 Ambient_Sounds_Add_Sound(kSfxBBMOVE1, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
86 Ambient_Sounds_Add_Sound(kSfxBBMOVE2, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
87 Ambient_Sounds_Add_Sound(kSfxBBMOVE3, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
88 Ambient_Sounds_Add_Sound(kSfxZUBWLK1, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
89 Ambient_Sounds_Add_Sound(kSfxZUBWLK2, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
90 Ambient_Sounds_Add_Sound(kSfxZUBWLK3, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
91 Ambient_Sounds_Add_Sound(kSfxZUBWLK4, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0);
92 }
93
SceneLoaded()94 void SceneScriptUG15::SceneLoaded() {
95 Unobstacle_Object("CATWALK_01_RAIL02", true);
96 Unobstacle_Object("LOFT01", true);
97 Obstacle_Object("NUT1", true);
98 Clickable_Object("NUT1");
99 #if BLADERUNNER_ORIGINAL_BUGS
100 #else
101 Unclickable_Object("NUT1");
102 #endif // BLADERUNNER_ORIGINAL_BUGS
103 }
104
MouseClick(int x,int y)105 bool SceneScriptUG15::MouseClick(int x, int y) {
106 return false;
107 }
108
ClickedOn3DObject(const char * objectName,bool a2)109 bool SceneScriptUG15::ClickedOn3DObject(const char *objectName, bool a2) {
110 return false;
111 }
112
ClickedOnActor(int actorId)113 bool SceneScriptUG15::ClickedOnActor(int actorId) {
114 return false;
115 }
116
ClickedOnItem(int itemId,bool a2)117 bool SceneScriptUG15::ClickedOnItem(int itemId, bool a2) {
118 return false;
119 }
120
ClickedOnExit(int exitId)121 bool SceneScriptUG15::ClickedOnExit(int exitId) {
122 if (exitId == 0) {
123 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -25.0f, 26.31f, -434.0f, 0, true, false, false)) {
124 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
125 Ambient_Sounds_Remove_All_Looping_Sounds(1);
126 Game_Flag_Set(kFlagUG15toUG17);
127 Set_Enter(kSetUG17, kSceneUG17);
128 }
129 return true;
130 }
131
132 if (exitId == 1) {
133 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -17.0f, 26.31f, -346.0f, 0, true, false, false)) {
134 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
135 Ambient_Sounds_Remove_All_Looping_Sounds(1);
136 Game_Flag_Set(kFlagUG15toUG16a);
137 Set_Enter(kSetUG16, kSceneUG16);
138 }
139 return true;
140 }
141
142 if (exitId == 2) {
143 int ratGoal = Actor_Query_Goal_Number(kActorFreeSlotA);
144 if (ratGoal >= 300 // kGoalFreeSlotAUG15Wait
145 && ratGoal <= 303 // kGoalFreeSlotAUG15RunBack
146 ) {
147 Loop_Actor_Walk_To_XYZ(kActorMcCoy, -137.61f, 48.07f, 147.12f, 0, true, false, false);
148 } else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 18.0f, 52.28f, 46.0f, 0, true, false, false)) {
149 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
150 Ambient_Sounds_Remove_All_Looping_Sounds(1);
151 Game_Flag_Set(kFlagUG15toUG16b);
152 Set_Enter(kSetUG16, kSceneUG16);
153 }
154 return true;
155 }
156
157 if (exitId == 3) {
158 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -238.0f, 52.46f, 222.0f, 0, true, false, false)) {
159 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
160 Ambient_Sounds_Remove_All_Looping_Sounds(1);
161 Game_Flag_Set(kFlagUG15toUG13);
162 Set_Enter(kSetUG13, kSceneUG13);
163 }
164 return true;
165 }
166 return false;
167 }
168
ClickedOn2DRegion(int region)169 bool SceneScriptUG15::ClickedOn2DRegion(int region) {
170 return false;
171 }
172
SceneFrameAdvanced(int frame)173 void SceneScriptUG15::SceneFrameAdvanced(int frame) {
174 if (Actor_Query_Goal_Number(kActorFreeSlotA) == kGoalFreeSlotAUG15Wait) {
175 float x, y, z;
176 Actor_Query_XYZ(kActorMcCoy, &x, &y, &z);
177 if (-160.0f <= x
178 && 220.0f > z
179 ) {
180 Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15WalkOut);
181 }
182 }
183
184 if (frame == 61) {
185 Ambient_Sounds_Play_Sound(kSfxPLANKDWN, 80, 0, 0, 99);
186 }
187
188 if ( Game_Flag_Query(kFlagUG15BridgeWillBreak)
189 && !Game_Flag_Query(kFlagUG15BridgeBroken)
190 ) {
191 float x, y, z;
192 Actor_Query_XYZ(kActorMcCoy, &x, &y, &z);
193 if ( -180.0f <= x
194 && 220.0f > z
195 && !Game_Flag_Query(kFlagUG15BridgeBreaks)
196 ) {
197 Game_Flag_Set(kFlagUG15BridgeBreaks);
198 Game_Flag_Set(kFlagUG15BridgeBroken);
199 Scene_Loop_Set_Default(kUG15LoopMainLoopBridgeBroken);
200 Scene_Loop_Start_Special(kSceneLoopModeOnce, kUG15LoopBridgeBreaks, true);
201 Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyUG15Fall);
202 Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
203
204 if (-200.0f < x
205 && -62.0f > x
206 ) {
207 Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Fall);
208 }
209 }
210 }
211 // return false;
212 }
213
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)214 void SceneScriptUG15::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
215 }
216
PlayerWalkedIn()217 void SceneScriptUG15::PlayerWalkedIn() {
218 if (Game_Flag_Query(kFlagUG16toUG15b)) {
219 Loop_Actor_Walk_To_XYZ(kActorMcCoy, -62.0f, 48.07f, 102.0f, 0, false, false, false);
220 Game_Flag_Reset(kFlagUG16toUG15b);
221 } else if (Game_Flag_Query(kFlagUG13toUG15)) {
222 Game_Flag_Reset(kFlagUG13toUG15);
223 if (!Game_Flag_Query(kFlagUG15RatShot)) {
224 Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Prepare);
225 }
226 }
227 }
228
PlayerWalkedOut()229 void SceneScriptUG15::PlayerWalkedOut() {
230 }
231
DialogueQueueFlushed(int a1)232 void SceneScriptUG15::DialogueQueueFlushed(int a1) {
233 }
234
235 } // End of namespace BladeRunner
236