aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/ps02.cpp
blob: 3ca56e155052cd175509e8829b88bd6ac6611842 (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
/* 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/script.h"

namespace BladeRunner {

void ScriptPS02::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(0, 0, 0);
	Scene_Loop_Set_Default(1);
}

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

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

bool ScriptPS02::ClickedOn3DObject(const char *objectName, bool a2) {
	if (Object_Query_Click("E.DOOR01", objectName) || Object_Query_Click("E.D00R02", objectName)) {
		if (Game_Flag_Query(130) ) {
			if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(61, 65);
				Scene_Loop_Start_Special(1, 3, 1);
			}
		} else if (Game_Flag_Query(22) ) {
			if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(15, 69);
				Scene_Loop_Start_Special(1, 3, 1);
			}
		} else if (Game_Flag_Query(131) ) {
			if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(66, 71);
				Scene_Loop_Start_Special(1, 3, 1);
			}
		} else if (Game_Flag_Query(132) ) {
			if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) {
				Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
				Ambient_Sounds_Remove_All_Looping_Sounds(1);
				Set_Enter(63, 67);
				Scene_Loop_Start_Special(1, 3, 1);
			}
		} else if (Game_Flag_Query(133)  && !Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) {
			Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
			Ambient_Sounds_Remove_All_Looping_Sounds(1);
			Set_Enter(67, 72);
			Scene_Loop_Start_Special(1, 3, 1);
		}
	}
	return false;
}

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

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

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

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

void ScriptPS02::SceneFrameAdvanced(int frame) {
	if (frame == 1) {
		Ambient_Sounds_Play_Sound(208, 45, 0, 0, 0);
	}
	if (frame == 91) {
		Ambient_Sounds_Play_Sound(209, 45, 0, 0, 0);
	}
	//return true;
}

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

void ScriptPS02::PlayerWalkedIn() {
	Game_Flag_Reset(718);
	Actor_Face_XYZ(0, 0, 0, 450.0f, true);
	Player_Gains_Control();
	sub_4018BC();
	Player_Loses_Control();
	if (Game_Flag_Query(130) ) {
		Set_Enter(61, 65);
		Scene_Loop_Start_Special(1, 3, 1);
	} else if (Game_Flag_Query(22) ) {
		Set_Enter(15, 69);
		Scene_Loop_Start_Special(1, 3, 1);
	} else if (Game_Flag_Query(131) ) {
		Set_Enter(66, 71);
		Scene_Loop_Start_Special(1, 3, 1);
	} else if (Game_Flag_Query(132) ) {
		Set_Enter(63, 67);
		Scene_Loop_Start_Special(1, 3, 1);
	} else if (Game_Flag_Query(133) ) {
		Set_Enter(67, 72);
		Scene_Loop_Start_Special(1, 3, 1);
	}
	//return true;
}

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

void ScriptPS02::DialogueQueueFlushed(int a1) {
}

void ScriptPS02::sub_4018BC() {
	Scene_Exits_Disable();
	switch (Elevator_Activate(2)) {
	case 7:
		Game_Flag_Set(133);
		break;
	case 6:
		Game_Flag_Set(132);
		break;
	case 5:
		Game_Flag_Set(22);
		break;
	case 4:
		Game_Flag_Set(130);
		break;
	case 3:
		Game_Flag_Set(131);
		break;
	default:
		break;
	}
	Scene_Exits_Enable();
}

} // End of namespace BladeRunner