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 SceneScriptCT10::InitializeScene() {
28 	Setup_Scene_Information(-121.0f, 0.0f, -78.0f, 446);
29 	Game_Flag_Reset(kFlagCT09toCT08); // a bug?
30 
31 	Scene_Exit_Add_2D_Exit(0, 135, 74, 238, 340, 0);
32 
33 	Ambient_Sounds_Add_Looping_Sound(kSfxFLORBUZZ, 28, 0, 1);
34 	Ambient_Sounds_Add_Sound(kSfxTHNDER2, 6, 180, 33, 33, 0, 0, -101, -101, 0, 0);
35 	Ambient_Sounds_Add_Sound(kSfxTHNDER3, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0);
36 	Ambient_Sounds_Add_Sound(kSfxTHNDER4, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0);
37 }
38 
SceneLoaded()39 void SceneScriptCT10::SceneLoaded() {
40 	Obstacle_Object("BED", true);
41 	Unobstacle_Object("WINDOW", true);
42 	Unobstacle_Object("LOFT01", true);
43 	Unobstacle_Object("LOFT02", true);
44 	Unobstacle_Object("LOFT03", true);
45 	Unobstacle_Object("LOFT04", true);
46 	Unobstacle_Object("LOFT05", true);
47 	Unobstacle_Object("LOFT06", true);
48 	Unobstacle_Object("LOFT10", true);
49 	Unobstacle_Object("LOFT11", true);
50 	Unobstacle_Object("LOFT12", true);
51 	Unobstacle_Object("LINE02", true);
52 	Unobstacle_Object("CABINETFRONT", true);
53 	Unobstacle_Object("CABINTESIDE", true);
54 	Unobstacle_Object("BUSTEDTAPE2", true);
55 	Unobstacle_Object("BOX CLOSET 1", true);
56 	Clickable_Object("BED");
57 	Clickable_Object("CABINETFRONT");
58 	Clickable_Object("CABINETTOP");
59 	Clickable_Object("TUB");
60 #if BLADERUNNER_ORIGINAL_BUGS
61 #else
62 	Unclickable_Object("BED");
63 #endif // BLADERUNNER_ORIGINAL_BUGS
64 	Scene_2D_Region_Add(0, 379, 229, 454, 375);
65 }
66 
MouseClick(int x,int y)67 bool SceneScriptCT10::MouseClick(int x, int y) {
68 	return false;
69 }
70 
checkCabinet()71 void SceneScriptCT10::checkCabinet() {
72 	if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 10.6f, 0.0f, -50.5f, 0, true, false, false)) {
73 		Player_Loses_Control();
74 		Actor_Face_Heading(kActorMcCoy, 0, false);
75 		Sound_Play(kSfxDRAWER1, 100, 0, 0, 50);
76 		Delay(1000);
77 		if (Actor_Clue_Query(kActorMcCoy, kClueHoldensBadge)) {
78 			Actor_Voice_Over(3700, kActorVoiceOver);
79 		} else {
80 			Item_Pickup_Spin_Effect(kModelAnimationBadge, 435, 258);
81 			Actor_Clue_Acquire(kActorMcCoy, kClueHoldensBadge, true, -1);
82 		}
83 		Player_Gains_Control();
84 	}
85 }
86 
ClickedOn3DObject(const char * objectName,bool a2)87 bool SceneScriptCT10::ClickedOn3DObject(const char *objectName, bool a2) {
88 	if (Object_Query_Click("TUB", objectName)) {
89 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -41.0f, 0.0f, -106.0f, 0, true, false, false)) {
90 			Player_Loses_Control();
91 			Actor_Face_Heading(kActorMcCoy, 850, false);
92 			Actor_Change_Animation_Mode(kActorMcCoy, 38);
93 			Delay(1000);
94 			Sound_Play(kSfxCURTAIN1, 33, 0, 0, 50);
95 			Delay(3000);
96 			if (Actor_Clue_Query(kActorMcCoy, kClueStrangeScale1)) {
97 				Actor_Voice_Over(3700, kActorVoiceOver);
98 			} else {
99 				Actor_Clue_Acquire(kActorMcCoy, kClueStrangeScale1, true, -1);
100 				Item_Pickup_Spin_Effect(kModelAnimationStrangeScale, 364, 214);
101 			}
102 			Delay(1000);
103 			Loop_Actor_Walk_To_XYZ(kActorMcCoy, -41.0f, 0.0f, -82.0f, 0, false, false, true);
104 			Player_Gains_Control();
105 		}
106 		return true;
107 	}
108 
109 	if (Object_Query_Click("CABINETTOP", objectName)
110 	 || Object_Query_Click("CABINETFRONT", objectName)
111 	) {
112 		checkCabinet();
113 		return true;
114 	}
115 	return false;
116 }
117 
ClickedOnActor(int actorId)118 bool SceneScriptCT10::ClickedOnActor(int actorId) {
119 	return false;
120 }
121 
ClickedOnItem(int itemId,bool a2)122 bool SceneScriptCT10::ClickedOnItem(int itemId, bool a2) {
123 	return false;
124 }
125 
ClickedOnExit(int exitId)126 bool SceneScriptCT10::ClickedOnExit(int exitId) {
127 	if (exitId == 0) {
128 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -93.0f, 0.0f, -38.0f, 0, true, false, false)) {
129 			Loop_Actor_Walk_To_XYZ(kActorMcCoy, -121.0f, 0.0f, -78.0f, 0, false, false, false);
130 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
131 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
132 			Game_Flag_Set(kFlagCT10toCT09);
133 			Set_Enter(kSetCT09, kSceneCT09);
134 		}
135 	}
136 	return false;
137 }
138 
ClickedOn2DRegion(int region)139 bool SceneScriptCT10::ClickedOn2DRegion(int region) {
140 	if (region == 0) {
141 		checkCabinet();
142 	}
143 	return false;
144 }
145 
SceneFrameAdvanced(int frame)146 void SceneScriptCT10::SceneFrameAdvanced(int frame) {
147 }
148 
ActorChangedGoal(int actorId,int newGoal,int oldGoal,bool currentSet)149 void SceneScriptCT10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
150 }
151 
PlayerWalkedIn()152 void SceneScriptCT10::PlayerWalkedIn() {
153 	Loop_Actor_Walk_To_XYZ(kActorMcCoy, -93.0f, 0.0f, -38.0f, 0, false, false, false);
154 	Loop_Actor_Walk_To_XYZ(kActorMcCoy, -49.0f, 0.0f, -38.0f, 0, false, false, false);
155 	if (!Game_Flag_Query(kFlagCT10Entered)) {
156 		Actor_Voice_Over(450, kActorVoiceOver);
157 		Actor_Voice_Over(460, kActorVoiceOver);
158 		Actor_Voice_Over(470, kActorVoiceOver);
159 		Game_Flag_Set(kFlagCT10Entered);
160 	}
161 }
162 
PlayerWalkedOut()163 void SceneScriptCT10::PlayerWalkedOut() {
164 }
165 
DialogueQueueFlushed(int a1)166 void SceneScriptCT10::DialogueQueueFlushed(int a1) {
167 }
168 
169 } // End of namespace BladeRunner
170