aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/scene/ps02.cpp
blob: d3d97648fa46e899fd53cf158233a50faad9370c (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
/* 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 SceneScriptPS02::InitializeScene() {
	Player_Loses_Control();
	Setup_Scene_Information(-13.31f, -40.28f, -48.12f, 30);

	Scene_Exit_Add_2D_Exit(0, 0, 0, 240, 479, 3);

	Ambient_Sounds_Remove_All_Non_Looping_Sounds(0);
	Ambient_Sounds_Add_Looping_Sound(386, 20, 1, 1);
	Ambient_Sounds_Add_Looping_Sound(210, 20, 1, 1);
	Ambient_Sounds_Add_Sound(0, 3, 20, 12, 16, 0, 0, -101, -101, 0, 0);

	Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
	Scene_Loop_Set_Default(1);
}

void SceneScriptPS02::SceneLoaded() {
	Obstacle_Object("E.DOOR01", true);
	Obstacle_Object("E.DOOR02", true);
	Clickable_Object("E.DOOR01");
	Clickable_Object("E.DOOR02");
}

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

bool SceneScriptPS02::ClickedOn3DObject(const char *objectName, bool a2) {
	if (Object_Query_Click("E.DOOR01", objectName)
	 || Object_Query_Click("E.D00R02", objectName)
	) {
		if (Game_Flag_Query(kFlagPS02toPS01)) {
			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -5.0f, -40.0f, -15.0f, 0, true, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(kSetPS01, kScenePS01);
				Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
			}
		} else if (Game_Flag_Query(kFlagPS02toPS05)) {
			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -5.0f, -40.0f, -15.0f, 0, true, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(kSetPS05, kScenePS05);
				Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
			}
		} else if (Game_Flag_Query(kFlagPS02toPS07)) {
			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -5.0f, -40.0f, -15.0f, 0, true, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(kSetPS07, kScenePS07);
				Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
			}
		} else if (Game_Flag_Query(kFlagPS02toPS03)) {
			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -5.0f, -40.0f, -15.0f, 0, true, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(kSetPS03, kScenePS03);
				Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
			}
		} else if (Game_Flag_Query(kFlagPS02toPS09)) {
			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -5.0f, -40.0f, -15.0f, 0, true, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(kSetPS09, kScenePS09);
				Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
			}
		}
	}
	return false;
}

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

bool SceneScriptPS02::ClickedOnItem(int itemId, bool a2) {
	return false;
}

bool SceneScriptPS02::ClickedOnExit(int exitId) {
	return false;
}

bool SceneScriptPS02::ClickedOn2DRegion(int region) {
	return false;
}

void SceneScriptPS02::SceneFrameAdvanced(int frame) {
	if (frame == 1) {
		Ambient_Sounds_Play_Sound(kSfxELDOORO2, 45, 0, 0, 0);
	}

	if (frame == 91) {
		Ambient_Sounds_Play_Sound(kSfxELDOORC1, 45, 0, 0, 0);
	}
	//return true;
}

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

void SceneScriptPS02::PlayerWalkedIn() {
	Game_Flag_Reset(kflagPS01toPS02);
	Actor_Face_XYZ(kActorMcCoy, 0.0f, 0.0f, 450.0f, true);
	Player_Gains_Control();
	activateElevator();
	Player_Loses_Control();
	if (Game_Flag_Query(kFlagPS02toPS01) ) {
		Set_Enter(kSetPS01, kScenePS01);
		Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
	} else if (Game_Flag_Query(kFlagPS02toPS05) ) {
		Set_Enter(kSetPS05, kScenePS05);
		Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
	} else if (Game_Flag_Query(kFlagPS02toPS07) ) {
		Set_Enter(kSetPS07, kScenePS07);
		Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
	} else if (Game_Flag_Query(kFlagPS02toPS03) ) {
		Set_Enter(kSetPS03, kScenePS03);
		Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
	} else if (Game_Flag_Query(kFlagPS02toPS09) ) {
		Set_Enter(kSetPS09, kScenePS09);
		Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
	}
	//return true;
}

void SceneScriptPS02::PlayerWalkedOut() {
	Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
	Ambient_Sounds_Remove_All_Looping_Sounds(1);
	Player_Gains_Control();
}

void SceneScriptPS02::DialogueQueueFlushed(int a1) {
}

void SceneScriptPS02::activateElevator() {
	Scene_Exits_Disable();
	switch (Elevator_Activate(kElevatorPS)) {
	case 3:
		Game_Flag_Set(kFlagPS02toPS07);
		break;
	case 4:
		Game_Flag_Set(kFlagPS02toPS01);
		break;
	case 5:
		Game_Flag_Set(kFlagPS02toPS05);
		break;
	case 6:
		Game_Flag_Set(kFlagPS02toPS03);
		break;
	case 7:
		Game_Flag_Set(kFlagPS02toPS09);
		break;
	}
	Scene_Exits_Enable();
}

} // End of namespace BladeRunner