2016-09-10 18:33:04 +02:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
#include "bladerunner/script/scene.h"
|
2016-09-10 18:33:04 +02:00
|
|
|
|
|
|
|
namespace BladeRunner {
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::InitializeScene() {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (Game_Flag_Query(360)) {
|
|
|
|
if (Game_Flag_Query(663) && !Game_Flag_Query(368)) {
|
|
|
|
Setup_Scene_Information(-356.35f, 132.77f, -1092.36f, 389);
|
|
|
|
} else {
|
|
|
|
Setup_Scene_Information(-180.0f, 37.28f, -1124.0f, 296);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Setup_Scene_Information(0.0f, -1.37f, 0.0f, 0);
|
|
|
|
Game_Flag_Reset(338);
|
|
|
|
}
|
|
|
|
Scene_Exit_Add_2D_Exit(0, 215, 240, 254, 331, 3);
|
|
|
|
if (!Game_Flag_Query(663)) {
|
|
|
|
Scene_Exit_Add_2D_Exit(1, 303, 422, 639, 479, 2);
|
|
|
|
}
|
|
|
|
if (!Game_Flag_Query(663) || Game_Flag_Query(368)) {
|
|
|
|
Scene_Exit_Add_2D_Exit(2, 352, 256, 393, 344, 0);
|
|
|
|
}
|
|
|
|
Ambient_Sounds_Add_Looping_Sound(105, 28, 0, 1);
|
|
|
|
Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1);
|
|
|
|
Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1);
|
|
|
|
Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(225, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(226, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(391, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(395, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(392, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0);
|
|
|
|
Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0);
|
|
|
|
if (Game_Flag_Query(368)) {
|
|
|
|
Scene_Loop_Set_Default(2);
|
|
|
|
} else {
|
|
|
|
Scene_Loop_Set_Default(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::SceneLoaded() {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (!Game_Flag_Query(368)) {
|
|
|
|
Unobstacle_Object("DROPPED CAR OBSTACL", true);
|
|
|
|
}
|
|
|
|
Obstacle_Object("VANBODY", true);
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::MouseClick(int x, int y) {
|
2016-09-10 18:33:04 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::ClickedOn3DObject(const char *objectName, bool a2) {
|
2016-09-10 18:33:04 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::ClickedOnActor(int actorId) {
|
2017-03-29 01:50:47 +02:00
|
|
|
if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, actorId, 30, 1, false)) {
|
|
|
|
Actor_Face_Actor(kActorMcCoy, actorId, true);
|
2016-09-10 18:33:04 +02:00
|
|
|
int v1 = sub_4021B0();
|
2017-03-29 01:50:47 +02:00
|
|
|
if (actorId == kActorOfficerGrayford && Game_Flag_Query(368) && !Game_Flag_Query(683)) {
|
|
|
|
Actor_Says(kActorOfficerGrayford, 220, -1);
|
|
|
|
Actor_Says(kActorMcCoy, 5540, 14);
|
|
|
|
Actor_Says(kActorOfficerGrayford, 230, -1);
|
|
|
|
Actor_Says(kActorMcCoy, 5545, 17);
|
|
|
|
Actor_Says(kActorOfficerGrayford, 240, -1);
|
|
|
|
Actor_Says(kActorMcCoy, 5550, 3);
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Flag_Set(683);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (actorId == v1) {
|
|
|
|
sub_402218();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::ClickedOnItem(int itemId, bool a2) {
|
2016-09-10 18:33:04 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::ClickedOnExit(int exitId) {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (exitId == 0) {
|
|
|
|
if (Game_Flag_Query(663) && !Game_Flag_Query(368)) {
|
2017-03-29 01:50:47 +02:00
|
|
|
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -356.35f, 132.77f, -1092.36f, 0, 0, false, 0);
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Flag_Set(361);
|
2018-02-05 18:46:09 +01:00
|
|
|
Set_Enter(43, kSceneHF07);
|
2017-03-29 01:50:47 +02:00
|
|
|
} else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -156.72f, 3.03f, -1118.17f, 0, 1, false, 0)) {
|
|
|
|
Actor_Face_Heading(kActorMcCoy, 760, false);
|
|
|
|
Loop_Actor_Travel_Stairs(kActorMcCoy, 3, 1, 0);
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Flag_Set(361);
|
2018-02-05 18:46:09 +01:00
|
|
|
Set_Enter(43, kSceneHF07);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (exitId == 1) {
|
2017-03-29 01:50:47 +02:00
|
|
|
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 4.0f, -11.67f, -4.0f, 0, 1, false, 0)) {
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Flag_Set(339);
|
2018-02-05 18:46:09 +01:00
|
|
|
Set_Enter(77, kSceneUG04);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (exitId == 2) {
|
|
|
|
if (!Game_Flag_Query(662)) {
|
2017-03-29 01:50:47 +02:00
|
|
|
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 0.0f, -1.37f, -1500.0f, 0, 1, false, 0)) {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (!Game_Flag_Query(522)) {
|
2017-03-29 01:50:47 +02:00
|
|
|
Actor_Voice_Over(2600, kActorVoiceOver);
|
|
|
|
Actor_Voice_Over(2610, kActorVoiceOver);
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Flag_Set(522);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int v1 = sub_4021B0();
|
|
|
|
bool v2;
|
|
|
|
if (v1 == -1) {
|
2017-03-29 01:50:47 +02:00
|
|
|
v2 = Loop_Actor_Walk_To_XYZ(kActorMcCoy, 0.0f, -1.37f, -1500.0f, 0, 1, false, 0) != 0;
|
2016-09-10 18:33:04 +02:00
|
|
|
} else {
|
2017-03-29 01:50:47 +02:00
|
|
|
v2 = Loop_Actor_Walk_To_Actor(kActorMcCoy, v1, 30, 1, false) != 0;
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
if (!v2) {
|
|
|
|
sub_402218();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
bool SceneScriptUG05::ClickedOn2DRegion(int region) {
|
2016-09-10 18:33:04 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::SceneFrameAdvanced(int frame) {
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::PlayerWalkedIn() {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (Game_Flag_Query(663)) {
|
|
|
|
if (Game_Flag_Query(368)) {
|
|
|
|
Music_Stop(2);
|
2017-03-29 01:50:47 +02:00
|
|
|
Actor_Put_In_Set(kActorOfficerGrayford, 78);
|
|
|
|
Actor_Set_At_XYZ(kActorOfficerGrayford, 4.22f, -1.37f, -925.0f, 750);
|
|
|
|
Actor_Set_Goal_Number(kActorOfficerGrayford, 599);
|
|
|
|
Actor_Retired_Here(kActorOfficerGrayford, 70, 36, 1, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
int v0 = sub_4021B0();
|
2017-03-29 01:50:47 +02:00
|
|
|
if (v0 == kActorDektora) {
|
|
|
|
Actor_Put_In_Set(kActorDektora, 78);
|
|
|
|
Actor_Set_At_XYZ(kActorDektora, -100.0f, -10.31f, -906.0f, 866);
|
|
|
|
Actor_Force_Stop_Walking(kActorDektora);
|
|
|
|
} else if (v0 == kActorLucy){
|
|
|
|
Actor_Put_In_Set(kActorLucy, 78);
|
|
|
|
Actor_Set_At_XYZ(kActorLucy, -100.0f, -10.31f, -906.0f, 866);
|
|
|
|
Actor_Force_Stop_Walking(kActorLucy);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2017-03-29 01:50:47 +02:00
|
|
|
if (!Actor_Query_In_Set(kActorOfficerLeary, 78)) {
|
|
|
|
Actor_Put_In_Set(kActorOfficerLeary, 78);
|
|
|
|
Actor_Set_At_XYZ(kActorOfficerLeary, 0.0f, -1.37f, -1400.0f, 768);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
2017-03-29 01:50:47 +02:00
|
|
|
if (!Actor_Query_In_Set(kActorOfficerGrayford, 78)) {
|
2016-09-10 18:33:04 +02:00
|
|
|
ADQ_Flush();
|
2017-03-29 01:50:47 +02:00
|
|
|
ADQ_Add(kActorOfficerGrayford, 280, 3);
|
|
|
|
Actor_Put_In_Set(kActorOfficerGrayford, 78);
|
|
|
|
Actor_Set_At_XYZ(kActorOfficerGrayford, -16.0f, -1.37f, -960.0f, 768);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Game_Flag_Query(360)) {
|
|
|
|
if (Game_Flag_Query(663) && !Game_Flag_Query(368)) {
|
2017-03-29 01:50:47 +02:00
|
|
|
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -288.35f, 132.77f, -1092.36f, 0, 1, false, 0);
|
2016-09-10 18:33:04 +02:00
|
|
|
} else {
|
2017-03-29 01:50:47 +02:00
|
|
|
Loop_Actor_Travel_Stairs(kActorMcCoy, 2, 0, 0);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Game_Flag_Query(663)) {
|
|
|
|
Game_Flag_Query(368);
|
|
|
|
}
|
|
|
|
Game_Flag_Reset(360);
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::PlayerWalkedOut() {
|
2016-09-10 18:33:04 +02:00
|
|
|
Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
|
|
|
|
Ambient_Sounds_Remove_All_Looping_Sounds(1);
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::DialogueQueueFlushed(int a1) {
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
int SceneScriptUG05::sub_4021B0() {
|
2017-03-29 01:50:47 +02:00
|
|
|
if (Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(kActorDektora) != 599) {
|
|
|
|
return kActorDektora;
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
2017-03-29 01:50:47 +02:00
|
|
|
if (Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(kActorLucy) != 599) {
|
|
|
|
return kActorLucy;
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-03-23 16:20:10 +01:00
|
|
|
void SceneScriptUG05::sub_402218() {
|
2016-09-10 18:33:04 +02:00
|
|
|
int v0 = sub_4021B0();
|
|
|
|
if (v0 != -1) {
|
2017-03-29 01:50:47 +02:00
|
|
|
Actor_Face_Actor(kActorMcCoy, v0, true);
|
|
|
|
Actor_Face_Actor(v0, kActorMcCoy, true);
|
|
|
|
Actor_Says(kActorMcCoy, 5535, 13);
|
2018-02-05 18:46:09 +01:00
|
|
|
if (v0 == kActorDektora) {
|
2017-03-29 01:50:47 +02:00
|
|
|
Actor_Says(kActorDektora, 1110, 15);
|
2016-09-10 18:33:04 +02:00
|
|
|
} else {
|
2017-03-29 01:50:47 +02:00
|
|
|
Actor_Says(kActorLucy, 670, 17);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
|
|
|
|
Ambient_Sounds_Remove_All_Looping_Sounds(1);
|
2017-03-29 01:50:47 +02:00
|
|
|
if (v0 == kActorLucy) {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (Game_Flag_Query(46)) {
|
|
|
|
if (Global_Variable_Query(48) > 3) {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1B, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
} else {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1C, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1A, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
2017-03-29 01:50:47 +02:00
|
|
|
} else if (v0 == kActorDektora) {
|
2016-09-10 18:33:04 +02:00
|
|
|
if (Game_Flag_Query(47)) {
|
|
|
|
if (Global_Variable_Query(48) > 3) {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1E, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
} else {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1F, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd1D, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd3, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
}
|
2018-02-05 18:46:09 +01:00
|
|
|
Outtake_Play(kOuttakeEnd2, false, -1);
|
2016-09-10 18:33:04 +02:00
|
|
|
Game_Over();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace BladeRunner
|