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 SceneScriptBB10::InitializeScene() {
28 if (Game_Flag_Query(kFlagBB11toBB10)) {
29 Setup_Scene_Information(255.29f, 90.24f, -103.0f, 830);
30 } else if (Game_Flag_Query(kFlagBB09toBB10b)) {
31 Game_Flag_Reset(kFlagBB09toBB10b);
32 Setup_Scene_Information(151.67f, 66.84f, -313.06f, 0);
33 } else {
34 Setup_Scene_Information(199.67f, 67.4f, -169.06f, 628);
35 }
36
37 if (Global_Variable_Query(kVariableBB10ShelvesAvailable) > 2) {
38 Scene_Exit_Add_2D_Exit(0, 281, 0, 531, 115, 0);
39 }
40
41 Scene_Exit_Add_2D_Exit(1, 58, 91, 193, 401, 3);
42
43 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
44 Ambient_Sounds_Add_Looping_Sound(kSfxRAINALY1, 76, 0, 1);
45 Ambient_Sounds_Add_Sound(kSfxSCARY4, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
46 Ambient_Sounds_Add_Sound(kSfxSCARY5, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
47 Ambient_Sounds_Add_Sound(kSfxSCARY6, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
48 Ambient_Sounds_Add_Sound(kSfxSCARY7, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
49 Ambient_Sounds_Add_Sound(kSfxBBGRN1, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
50 Ambient_Sounds_Add_Sound(kSfxBBGRN2, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
51 Ambient_Sounds_Add_Sound(kSfxBBGRN3, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
52 Ambient_Sounds_Add_Sound(kSfxBBMOVE1, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
53 Ambient_Sounds_Add_Sound(kSfxBBMOVE2, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
54 Ambient_Sounds_Add_Sound(kSfxBBMOVE3, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
55 Ambient_Sounds_Add_Sound(kSfxHAUNT1, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
56 Ambient_Sounds_Add_Sound(kSfxHAUNT2, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0);
57
58 if (!Game_Flag_Query(kFlagBB10Shelf1Available)) {
59 Scene_2D_Region_Add(0, 458, 99, 522, 133);
60 Overlay_Play("BB10OVR1", 0, true, false, 0);
61 }
62 if (!Game_Flag_Query(kFlagBB10Shelf2Available)) {
63 Scene_2D_Region_Add(1, 459, 164, 522, 193);
64 Overlay_Play("BB10OVR2", 0, true, false, 0);
65 }
66 if (!Game_Flag_Query(kFlagBB10Shelf3Available)) {
67 Scene_2D_Region_Add(2, 458, 194, 522, 223);
68 Overlay_Play("BB10OVR3", 0, true, false, 0);
69 }
70 if (!Game_Flag_Query(kFlagBB10Shelf4Available)) {
71 Scene_2D_Region_Add(3, 458, 255, 522, 278);
72 Overlay_Play("BB10OVR4", 0, true, false, 0);
73 }
74 if (!Game_Flag_Query(kFlagBB10Shelf5Available)) {
75 Scene_2D_Region_Add(4, 458, 316, 522, 335);
76 Overlay_Play("BB10OVR5", 0, true, false, 0);
77 }
78 }
79
SceneLoaded()80 void SceneScriptBB10::SceneLoaded() {
81 Obstacle_Object("BARB NIGHT", true);
82 Unclickable_Object("BARB NIGHT");
83 Unobstacle_Object("Box-Floor Hole01", true);
84 Unobstacle_Object("Box-Floor Hole02", true);
85 Unobstacle_Object("Box-Floor Hole03", true);
86 }
87
MouseClick(int x,int y)88 bool SceneScriptBB10::MouseClick(int x, int y) {
89 return false;
90 }
91
ClickedOn3DObject(const char * objectName,bool a2)92 bool SceneScriptBB10::ClickedOn3DObject(const char *objectName, bool a2) {
93 return false;
94 }
95
ClickedOnActor(int actorId)96 bool SceneScriptBB10::ClickedOnActor(int actorId) {
97 return false;
98 }
99
ClickedOnItem(int itemId,bool a2)100 bool SceneScriptBB10::ClickedOnItem(int itemId, bool a2) {
101 return false;
102 }
103
ClickedOnExit(int exitId)104 bool SceneScriptBB10::ClickedOnExit(int exitId) {
105 if (exitId == 0) {
106 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 225.58f, 67.2f, -102.1f, 0, true, false, false)) {
107 Player_Set_Combat_Mode(false);
108 Actor_Face_Heading(kActorMcCoy, 274, false);
109 Footstep_Sound_Override_On(2);
110 Loop_Actor_Travel_Stairs(kActorMcCoy, 2, true, kAnimationModeIdle);
111 Footstep_Sound_Override_Off();
112 Footstep_Sound_Override_On(2);
113 Loop_Actor_Travel_Ladder(kActorMcCoy, 3, true, kAnimationModeIdle);
114 Footstep_Sound_Override_Off();
115 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
116 Ambient_Sounds_Remove_All_Looping_Sounds(1);
117 Game_Flag_Set(kFlagBB10toBB11);
118 Set_Enter(kSetBB11, kSceneBB11);
119 }
120 return true;
121 }
122
123 if (exitId == 1) {
124 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.01f, 66.84f, -261.62f, 0, true, false, false)
125 && !Loop_Actor_Walk_To_XYZ(kActorMcCoy, 151.67f, 66.84f, -313.06f, 0, true, false, false)
126 ) {
127 Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
128 Ambient_Sounds_Remove_All_Looping_Sounds(1);
129 Game_Flag_Reset(kFlagBB09toBB10a);
130 Game_Flag_Set(kFlagBB10toBB09);
131 Set_Enter(kSetBB09, kSceneBB09);
132 }
133 return true;
134 }
135 return false;
136 }
137
ClickedOn2DRegion(int region)138 bool SceneScriptBB10::ClickedOn2DRegion(int region) {
139 if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 225.58f, 67.2f, -102.1f, 0, true, false, false)) {
140 Actor_Face_Heading(kActorMcCoy, 274, false);
141 Sound_Play(Random_Query(kSfxGLASSY1, kSfxGLASSY2), 40, 70, 70, 50);
142 switch (region) {
143 case 0:
144 Overlay_Remove("BB10OVR1");
145 Game_Flag_Set(kFlagBB10Shelf1Available);
146 Scene_2D_Region_Remove(0);
147 break;
148
149 case 1:
150 Overlay_Remove("BB10OVR2");
151 Game_Flag_Set(kFlagBB10Shelf2Available);
152 Scene_2D_Region_Remove(1);
153 break;
154
155 case 2:
156 Overlay_Remove("BB10OVR3");
157 Game_Flag_Set(kFlagBB10Shelf3Available);
158 Scene_2D_Region_Remove(2);
159 break;
160
161 case 3:
162 Overlay_Remove("BB10OVR4");
163 Game_Flag_Set(kFlagBB10Shelf4Available);
164 Scene_2D_Region_Remove(3);
165 break;
166
167 case 4:
168 Overlay_Remove("BB10OVR5");
169 Game_Flag_Set(kFlagBB10Shelf5Available);
170 Scene_2D_Region_Remove(4);
171 break;
172 }
173
174 Global_Variable_Increment(kVariableBB10ShelvesAvailable, 1);
175 if (Global_Variable_Query(kVariableBB10ShelvesAvailable) > 4) {
176 Scene_Exit_Add_2D_Exit(0, 281, 0, 531, 115, 0);
177 }
178 return false;
179 }
180 return true;
181 }
182
SceneFrameAdvanced(int frame)183 void SceneScriptBB10::SceneFrameAdvanced(int frame) {
184 }
185
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)186 void SceneScriptBB10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
187 }
188
PlayerWalkedIn()189 void SceneScriptBB10::PlayerWalkedIn() {
190 if (Game_Flag_Query(kFlagBB09toBB10a)) {
191 Player_Loses_Control();
192 Actor_Set_At_XYZ(kActorMcCoy, 214.01f, 66.84f, -349.62f, 462);
193 Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.01f, 66.84f, -261.62f, 0, false, false, false);
194 Player_Gains_Control();
195 Game_Flag_Reset(kFlagBB09toBB10a);
196 } else if (Game_Flag_Query(kFlagBB11toBB10)) {
197 Actor_Set_At_XYZ(kActorMcCoy, 249.58f, 127.2f, -102.1f, 256);
198 Footstep_Sound_Override_On(2);
199 Loop_Actor_Travel_Ladder(kActorMcCoy, 3, false, kAnimationModeIdle);
200 Footstep_Sound_Override_Off();
201 Actor_Face_Heading(kActorMcCoy, 768, false);
202 Footstep_Sound_Override_On(2);
203 Loop_Actor_Travel_Stairs(kActorMcCoy, 3, false, kAnimationModeIdle);
204 Footstep_Sound_Override_Off();
205 Game_Flag_Reset(kFlagBB11toBB10);
206 }
207 }
208
PlayerWalkedOut()209 void SceneScriptBB10::PlayerWalkedOut() {
210 }
211
DialogueQueueFlushed(int a1)212 void SceneScriptBB10::DialogueQueueFlushed(int a1) {
213 }
214
215 } // End of namespace BladeRunner
216