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 SceneScriptBB12::InitializeScene() {
28 	if (Game_Flag_Query(kFlagBB07toBB12)) {
29 		Setup_Scene_Information( 138.0f, 0.0f, 104.0f, 760);
30 	} else if (Game_Flag_Query(kFlagBB08toBB12)) {
31 		Setup_Scene_Information(-129.0f, 0.0f,  64.0f, 307);
32 	} else {
33 		Setup_Scene_Information(  54.0f, 0.0f, 200.0f,   0);
34 		Game_Flag_Reset(kFlagBB05toBB12);
35 	}
36 
37 	Scene_Exit_Add_2D_Exit(0,   0,   0,  30, 479, 3);
38 	Scene_Exit_Add_2D_Exit(1, 589,   0, 639, 479, 1);
39 	Scene_Exit_Add_2D_Exit(2, 377, 374, 533, 479, 2);
40 
41 	Ambient_Sounds_Add_Looping_Sound(kSfxRAINAWN1, 28, 0, 1);
42 	Ambient_Sounds_Add_Sound(kSfxSCARY4,  2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
43 	Ambient_Sounds_Add_Sound(kSfxSCARY5,  2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
44 	Ambient_Sounds_Add_Sound(kSfxSCARY6,  2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
45 	Ambient_Sounds_Add_Sound(kSfxSCARY7,  2, 180, 14, 16, -100, 100, -101, -101, 0, 0);
46 	Ambient_Sounds_Add_Sound(kSfxBBGRN1,  5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
47 	Ambient_Sounds_Add_Sound(kSfxBBGRN2,  5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
48 	Ambient_Sounds_Add_Sound(kSfxBBGRN3,  5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
49 	Ambient_Sounds_Add_Sound(kSfxBBMOVE1, 5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
50 	Ambient_Sounds_Add_Sound(kSfxBBMOVE2, 5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
51 	Ambient_Sounds_Add_Sound(kSfxBBMOVE3, 5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
52 	Ambient_Sounds_Add_Sound(kSfxHAUNT1,  5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
53 	Ambient_Sounds_Add_Sound(kSfxHAUNT2,  5,  50, 27, 27, -100, 100, -101, -101, 0, 0);
54 	Ambient_Sounds_Add_Sound(kSfxTHNDER2, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0);
55 	Ambient_Sounds_Add_Sound(kSfxTHNDER3, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0);
56 
57 	if (!Game_Flag_Query(kFlagBB12Entered)) {
58 		Overlay_Play("BB12OVER", 0, false, false, 0); // Sadik's shadow going left
59 		Game_Flag_Set(kFlagBB12Entered);
60 	}
61 }
62 
SceneLoaded()63 void SceneScriptBB12::SceneLoaded() {
64 	Obstacle_Object("BALLS", true);
65 	Unclickable_Object("BALLS");
66 }
67 
MouseClick(int x,int y)68 bool SceneScriptBB12::MouseClick(int x, int y) {
69 	return false;
70 }
71 
ClickedOn3DObject(const char * objectName,bool a2)72 bool SceneScriptBB12::ClickedOn3DObject(const char *objectName, bool a2) {
73 	return false;
74 }
75 
ClickedOnActor(int actorId)76 bool SceneScriptBB12::ClickedOnActor(int actorId) {
77 	return false;
78 }
79 
ClickedOnItem(int itemId,bool a2)80 bool SceneScriptBB12::ClickedOnItem(int itemId, bool a2) {
81 	return false;
82 }
83 
ClickedOnExit(int exitId)84 bool SceneScriptBB12::ClickedOnExit(int exitId) {
85 	if (exitId == 0) {
86 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -129.0f, 0.0f, 64.0f, 0, true, false, false)) {
87 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
88 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
89 			Game_Flag_Set(kFlagBB12toBB08);
90 			Set_Enter(kSetBB08, kSceneBB08);
91 		}
92 		return true;
93 	}
94 
95 	if (exitId == 1) {
96 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 138.0f, 0.0f, 104.0f, 0, true, false, false)) {
97 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
98 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
99 			Game_Flag_Set(kFlagBB12toBB07);
100 			Set_Enter(kSetBB07, kSceneBB07);
101 		}
102 		return true;
103 	}
104 
105 	if (exitId == 2) {
106 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 54.0f, 0.0f, 200.0f, 0, true, false, false)) {
107 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
108 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
109 			Game_Flag_Set(kFlagBB12toBB05);
110 			Set_Enter(kSetBB05, kSceneBB05);
111 		}
112 		return true;
113 	}
114 	return false;
115 }
116 
ClickedOn2DRegion(int region)117 bool SceneScriptBB12::ClickedOn2DRegion(int region) {
118 	return false;
119 }
120 
SceneFrameAdvanced(int frame)121 void SceneScriptBB12::SceneFrameAdvanced(int frame) {
122 	if (frame == 10
123 	 || frame == 22
124 	 || frame == 33
125 	 || frame == 41
126 	) {
127 		Sound_Play(kSfxMONKCYM1, 17, -30, -30, 50);
128 	}
129 
130 	if (frame == 3) {
131 		Sound_Play(kSfxMONKEY1,  16, -30, -30, 50);
132 	}
133 }
134 
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)135 void SceneScriptBB12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
136 }
137 
PlayerWalkedIn()138 void SceneScriptBB12::PlayerWalkedIn() {
139 	if (Game_Flag_Query(kFlagBB07toBB12)) {
140 		Loop_Actor_Walk_To_XYZ(kActorMcCoy, 114.0f, 0.0f, 104.0f, 0, false, false, false);
141 		Game_Flag_Reset(kFlagBB07toBB12);
142 	} else if (Game_Flag_Query(kFlagBB08toBB12)) {
143 		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -101.0f, 0.0f, 64.0f, 0, false, false, false);
144 		Game_Flag_Reset(kFlagBB08toBB12);
145 	}
146 }
147 
PlayerWalkedOut()148 void SceneScriptBB12::PlayerWalkedOut() {
149 }
150 
DialogueQueueFlushed(int a1)151 void SceneScriptBB12::DialogueQueueFlushed(int a1) {
152 }
153 
154 } // End of namespace BladeRunner
155