aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/scene/ct08.cpp
blob: 2e41b643221c0443e768823937cb42569b6e1f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#include "bladerunner/script/scene_script.h"

namespace BladeRunner {

void SceneScriptCT08::InitializeScene() {
	if (Game_Flag_Query(kFlagChapter3Intro)) {
		Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
		Ambient_Sounds_Remove_All_Looping_Sounds(1);
		Outtake_Play(kOuttakeMovieB1, false, -1);
		if (Game_Flag_Query(kFlagLucyIsReplicant)) {
			Outtake_Play(kOuttakeMovieB2, false, -1);
		} else if (Game_Flag_Query(kFlagDektoraIsReplicant)) {
			Outtake_Play(kOuttakeMovieB3, false, -1);
		} else {
			Outtake_Play(kOuttakeMovieB4, false, -1);
		}
		Outtake_Play(kOuttakeMovieB5, false, -1);
		Game_Flag_Reset(kFlagChapter3Intro);
	}
	Actor_Force_Stop_Walking(kActorMcCoy);

	if (Game_Flag_Query(kFlagCT51toCT08)) {
		Setup_Scene_Information( -11.0f, 0.0f, -156.0f, 769);
	} else if (Game_Flag_Query(kFlagCT06toCT08)) {
		Setup_Scene_Information(-143.0f, 0.0f,  -92.0f, 420);
	} else {
		Setup_Scene_Information(-183.0f, 0.0f,  128.0f, 205);
	}

	Scene_Exit_Add_2D_Exit(0,   0,  0,  30, 479, 3);
	Scene_Exit_Add_2D_Exit(1, 389,  0, 639, 303, 0);
	Scene_Exit_Add_2D_Exit(2, 115, 87, 137, 267, 3);

	if (Game_Flag_Query(kFlagMcCoyTiedDown)) {
#if BLADERUNNER_ORIGINAL_BUGS
		Scene_2D_Region_Add(0, 185, 185, 230, 230);
#else
		Scene_2D_Region_Add(0, 155, 180, 214, 235);
#endif // BLADERUNNER_ORIGINAL_BUGS
	}

	Ambient_Sounds_Add_Looping_Sound(kSfxRAIN10,   100, 1, 1);
	Ambient_Sounds_Add_Looping_Sound(kSfxCTDRONE1,  20, 1, 1);
	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy,  0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
	Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
	Ambient_Sounds_Add_Sound(kSfxSPIN2A,  80, 180, 16,  25, 0, 0, -101, -101, 0, 0);
	Ambient_Sounds_Add_Sound(kSfxSPIN2B,  50, 180, 16,  25, 0, 0, -101, -101, 0, 0);
	Ambient_Sounds_Add_Sound(kSfxTHNDR2,   5, 180, 50, 100, 0, 0, -101, -101, 0, 0);
	Ambient_Sounds_Add_Sound(kSfxTHNDR3,   5, 180, 50, 100, 0, 0, -101, -101, 0, 0);
	Ambient_Sounds_Add_Sound(kSfxTHNDER4,  5, 180, 50, 100, 0, 0, -101, -101, 0, 0);

	if (Game_Flag_Query(kFlagCT51toCT08)) {
		Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
		Scene_Loop_Set_Default(1);
	} else {
		Scene_Loop_Set_Default(1);
	}
}

void SceneScriptCT08::SceneLoaded() {
	Obstacle_Object("ASHTRAY", true);
	Unobstacle_Object("BLANKET03", true);
	if (!Actor_Clue_Query(kActorMcCoy, kClueRagDoll)) {
#if BLADERUNNER_ORIGINAL_BUGS
		Item_Add_To_World(kItemRagDoll, kModelAnimationRagDoll, kSetCT08_CT51_UG12, 44.0f, 0.0f, -95.0f, 540, 12, 12, false, true, false, true);
#else
		Item_Add_To_World(kItemRagDoll, kModelAnimationRagDoll, kSetCT08_CT51_UG12, 44.0f, 3.0f, -100.0f, 540, 12, 12, false, true, false, true);
#endif // BLADERUNNER_ORIGINAL_BUGS
	}
	if (!Actor_Clue_Query(kActorMcCoy, kClueCheese)) {
		Item_Add_To_World(kItemCheese, kModelAnimationCheese, kSetCT08_CT51_UG12, -102.0f, 2.0f, 41.0f, 432, 6, 6, false, true, false, true);
	}
}

bool SceneScriptCT08::MouseClick(int x, int y) {
	return false;
}

bool SceneScriptCT08::ClickedOn3DObject(const char *objectName, bool a2) {
	return false;
}

bool SceneScriptCT08::ClickedOnActor(int actorId) {
	return false;
}

bool SceneScriptCT08::ClickedOnItem(int itemId, bool a2) {
	if (itemId == kItemCheese) {
		if (!Loop_Actor_Walk_To_Item(kActorMcCoy, kItemCheese, 36, true, false)) {
			if (!Game_Flag_Query(kFlagMcCoyTiedDown)) {
				Actor_Clue_Acquire(kActorMcCoy, kClueCheese, true, -1);
				Item_Pickup_Spin_Effect(kModelAnimationCheese, 266, 328);
				Item_Remove_From_World(kItemCheese);
				Actor_Voice_Over(480, kActorVoiceOver);
				Actor_Voice_Over(490, kActorVoiceOver);
				Actor_Voice_Over(500, kActorVoiceOver);
			}
		}
		return true;
	}
	return false;
}

bool SceneScriptCT08::ClickedOnExit(int exitId) {
	if (exitId == 0) {
		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -183.0f, 0.0f, 128.0f, 0, true, false, 0)) {
			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
			Ambient_Sounds_Remove_All_Looping_Sounds(1);
			Game_Flag_Set(kFlagCT08toCT09);
			Set_Enter(kSetCT09, kSceneCT09);
		}
		return true;
	}

	if (exitId == 1) {
		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -11.0f, 0.0f, -156.0f, 0, true, false, 0)) {
			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 0.0f, 0.0f, -102.0f, 0, false, false, 0);
			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
			Ambient_Sounds_Remove_All_Looping_Sounds(1);
			Game_Flag_Set(kFlagCT08toCT51);
			Set_Enter(kSetCT08_CT51_UG12, kSceneCT51);
		}
		return true;
	}

	if (exitId == 2) {
		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -143.0f, 0.0f, -92.0f, 0, true, false, 0)) {
			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
			Ambient_Sounds_Remove_All_Looping_Sounds(1);
			Game_Flag_Set(kFlagCT08toCT06);
			Set_Enter(kSetCT06, kSceneCT06);
		}
		return true;
	}
	return false;
}

bool SceneScriptCT08::ClickedOn2DRegion(int region) {
	if (region == 0) {
		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -108.0f, 0.0f, -178.0f, 0, true, false, 0)) {
			Actor_Face_Heading(kActorMcCoy, 512, false);
			Game_Flag_Reset(kFlagMcCoyTiedDown);
			Player_Set_Combat_Mode_Access(true);
			Scene_Exits_Enable();
			Ambient_Sounds_Play_Sound(kSfxBRKROPE1, 40, 99, 0, 0);
			Scene_2D_Region_Remove(0);
			Player_Loses_Control();
		}
		return true;
	}
	return false;
}

void SceneScriptCT08::SceneFrameAdvanced(int frame) {
}

void SceneScriptCT08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
}

void SceneScriptCT08::PlayerWalkedIn() {
	if (Game_Flag_Query(kFlagMcCoyTiedDown)) {
		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeTalk);
		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeIdle);
		Actor_Set_At_XYZ(kActorMcCoy, -148.0f, 0.0f, 4.0f, 256);
		Player_Set_Combat_Mode_Access(false);
		Scene_Exits_Disable();
		Game_Flag_Reset(kFlagCT51toCT08);
		Game_Flag_Reset(kFlagCT06toCT08);
		Autosave_Game(1);
	} else if (Game_Flag_Query(kFlagCT51toCT08)) {
		Game_Flag_Reset(kFlagCT51toCT08);
	} else if (Game_Flag_Query(kFlagCT06toCT08)) {
		Game_Flag_Reset(kFlagCT06toCT08);
	} else {
		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -156.0f, 0.0f, 128.0f, 0, false, false, 0);
		Game_Flag_Reset(kFlagCT09toCT08);
	}
}

void SceneScriptCT08::PlayerWalkedOut() {
	if (!Actor_Clue_Query(kActorMcCoy, kClueRagDoll)) {
		Item_Remove_From_World(kItemRagDoll);
	}
}

void SceneScriptCT08::DialogueQueueFlushed(int a1) {
}

} // End of namespace BladeRunner