diff options
Diffstat (limited to 'engines/bladerunner/script/nr03.cpp')
-rw-r--r-- | engines/bladerunner/script/nr03.cpp | 351 |
1 files changed, 351 insertions, 0 deletions
diff --git a/engines/bladerunner/script/nr03.cpp b/engines/bladerunner/script/nr03.cpp new file mode 100644 index 0000000000..a4afdd36ec --- /dev/null +++ b/engines/bladerunner/script/nr03.cpp @@ -0,0 +1,351 @@ +/* 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 ScriptNR03::InitializeScene() { + if (Game_Flag_Query(537)) { + Setup_Scene_Information(-301.98f, -70.19f, -348.58f, 0); + } else if (Game_Flag_Query(437)) { + Setup_Scene_Information(-161.0f, -70.19f, -1139.0f, 500); + Game_Flag_Reset(437); + } else { + Setup_Scene_Information(410.0f, -70.19f, -715.0f, 690); + } + Scene_Exit_Add_2D_Exit(0, 561, 0, 639, 216, 1); + Scene_Exit_Add_2D_Exit(1, 210, 85, 240, 145, 0); + Scene_Exit_Add_2D_Exit(2, 0, 135, 85, 295, 3); + Scene_2D_Region_Add(0, 331, 73, 375, 114); + Ambient_Sounds_Add_Looping_Sound(280, 50, 38, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(573)) { + if (Game_Flag_Query(537)) { + Scene_Loop_Start_Special(0, 2, 0); + Scene_Loop_Set_Default(0); + Game_Flag_Reset(537); + } else { + Scene_Loop_Set_Default(0); + } + } else { + Actor_Set_Goal_Number(4, 201); + Scene_Loop_Start_Special(0, 2, 0); + Scene_Loop_Set_Default(0); + } + if (Actor_Query_Goal_Number(25) > 209 && Actor_Query_Goal_Number(25) < 215) { + Actor_Set_Goal_Number(25, 215); + } +} + +void ScriptNR03::SceneLoaded() { + Obstacle_Object("PG3", true); + Obstacle_Object("X2BACKBARBOTTOM01", true); + Obstacle_Object("X2BACKSTAGETOP", true); + Unclickable_Object("PG3"); + Unobstacle_Object("X2BACKBARBOTTOM02", true); + Unobstacle_Object("NM2", true); + Unobstacle_Object("MAN5", true); + Unobstacle_Object("MAN7", true); + Unobstacle_Object("X2BACKSTAGETOP", true); +} + +bool ScriptNR03::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR03::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("PG3", objectName)) { + Actor_Face_Object(0, "PG3", true); + Actor_Voice_Over(3770, 99); + return true; + } + return false; +} + +bool ScriptNR03::ClickedOnActor(int actorId) { + if (actorId == 25 && !Loop_Actor_Walk_To_Actor(0, 25, 48, 1, false)) { + AI_Movement_Track_Pause(25); + Actor_Face_Actor(0, 25, true); + if (Game_Flag_Query(611)) { + Actor_Says(0, 3350, 16); + Actor_Says(25, 50, 17); + } else { + Game_Flag_Set(611); + Actor_Says(0, 3340, 3); + Actor_Face_Actor(25, 0, true); + Actor_Says(25, 30, 13); + Actor_Says(0, 3345, 14); + Actor_Says(25, 40, 14); + } + AI_Movement_Track_Unpause(25); + return true; + } + return false; +} + +bool ScriptNR03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 410.0f, -70.19f, -715.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(534); + Set_Enter(54, 54); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -161.0f, -70.19f, -1139.0f, 0, 1, false, 0)) { + if (Actor_Query_Which_Set_In(25) == 55) { + AI_Movement_Track_Pause(25); + Actor_Face_Actor(25, 0, true); + Actor_Face_Actor(0, 25, true); + int v3 = Global_Variable_Query(44); + if (v3 == 0) { + Actor_Says(25, 50, 13); + AI_Movement_Track_Unpause(25); + } else if (v3 == 1) { + Actor_Says(25, 210, 15); + AI_Movement_Track_Unpause(25); + } else if (v3 == 2) { + Actor_Set_Goal_Number(25, 220); + } + } + Global_Variable_Increment(44, 1); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(438); + Set_Enter(12, 57); + } + + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -151.0f, -70.19f, -476.0f, 12, 1, false, 0)) { + if (Actor_Query_Goal_Number(25) == 213 || Actor_Query_Which_Set_In(25) != 55) { + Player_Loses_Control(); + Player_Set_Combat_Mode(false); + Loop_Actor_Walk_To_XYZ(0, -229.0f, -70.19f, -469.0f, 0, 0, false, 1); + Actor_Face_Heading(0, 656, false); + Actor_Change_Animation_Mode(0, 53); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(536); + Set_Enter(13, 58); + Scene_Loop_Start_Special(1, 2, 0); + return true; + } + Actor_Face_Heading(0, 680, false); + Actor_Change_Animation_Mode(0, 12); + Delay(150); + Actor_Change_Animation_Mode(0, 0); + AI_Movement_Track_Pause(25); + Actor_Face_Actor(25, 0, true); + + int v1 = Global_Variable_Query(43); + if (v1 == 0) { + Actor_Says(25, 0, 15); + Actor_Face_Actor(0, 25, true); + Actor_Says(0, 3335, 13); + Actor_Says(25, 10, 16); + AI_Movement_Track_Unpause(25); + } else if (v1 == 1) { + Actor_Face_Actor(0, 25, true); + Actor_Says(25, 210, 12); + AI_Movement_Track_Unpause(25); + } else if (v1 == 2) { + Actor_Set_Goal_Number(25, 220); + } + Global_Variable_Increment(43, 1); + } + return true; + } + return false; +} + +bool ScriptNR03::ClickedOn2DRegion(int region) { + if (region == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 79.2f, -70.19f, -984.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 47, true); + int v1 = Random_Query(0, 4); + if (v1 == 0) { + Actor_Says(0, 1055, 3); + } else if (v1 == 1) { + Actor_Says(0, 8590, 3); + } else if (v1 == 2) { + Actor_Says(0, 8930, 3); + } else if (v1 == 3) { + Actor_Says(0, 7465, 3); + } + } + return true; + } + return false; +} + +void ScriptNR03::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_402994(); + } + if (frame == 72) { + Sound_Play(345, 83, -70, -70, 50); + } + if (frame == 76) { + Sound_Play(353, 62, -70, -70, 50); + } + if (frame > 70 && frame < 110) { + sub_40259C(frame); + } else { + if (frame != 110) { + //return false; + return; + } + if (Actor_Query_Goal_Number(4) == 201) { + Actor_Set_Goal_Number(4, 200); + } else if (!Game_Flag_Query(536)) { + Actor_Set_Goal_Number(0, 200); + Player_Gains_Control(); + } + } + //return true; + return; +} + +void ScriptNR03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR03::PlayerWalkedIn() { + Player_Set_Combat_Mode(false); + if (Game_Flag_Query(573)) { + if (Game_Flag_Query(535) ) { + Loop_Actor_Walk_To_XYZ(0, 302.0f, -70.19f, -715.0f, 0, 0, false, 0); + Game_Flag_Reset(535); + } + } else { + Game_Flag_Set(573); + Async_Actor_Walk_To_XYZ(0, 206.0f, -70.19f, -643.0f, 0, false); + Game_Flag_Reset(535); + Actor_Voice_Over(1490, 99); + Actor_Voice_Over(1510, 99); + Actor_Voice_Over(1520, 99); + } + if (Player_Query_Combat_Mode()) { + Actor_Set_Goal_Number(25, 220); + } + //return false; +} + +void ScriptNR03::PlayerWalkedOut() { + if (!Game_Flag_Query(438)) { + Music_Stop(2); + } + if (Game_Flag_Query(536)) { + Player_Gains_Control(); + } +} + +void ScriptNR03::DialogueQueueFlushed(int a1) { +} + +void ScriptNR03::sub_40259C(int frame) { + int facing; + float angle, invertedAngle; + + angle = cos((frame - 70) * (M_PI / 40.0f)) * M_PI_2; + invertedAngle = M_PI - angle; + if (!Game_Flag_Query(536) && Actor_Query_Goal_Number(4) != 201) { + angle = angle + M_PI; + invertedAngle = invertedAngle + M_PI; + } + float c = cos(invertedAngle); + float s = sin(invertedAngle); + float x = 36.49f * s - -60.21f * c + -265.49f; + float z = -60.21f * s + 36.49f * c + -408.79f; + + if (Actor_Query_Goal_Number(4) == 201) { + facing = angle * (512.0f / M_PI); + facing = facing + 144; + if (facing < 0) { + facing = facing + 1168; + } + if (facing > 1023) { + facing -= 1024; + } + Actor_Set_At_XYZ(4, x, -70.19f, z, facing); + } else { + facing = angle * (512.0f / M_PI); + facing = facing + 400; + if (facing < 0) { + facing = facing + 1424; + } + if (facing > 1023) { + facing -= 1024; + } + + Actor_Set_At_XYZ(0, x, -70.19f, z, facing); + } +} + +void ScriptNR03::sub_402994() { + if (Music_Is_Playing()) { + Music_Adjust(51, 0, 2); + } else { + int v0 = Global_Variable_Query(53); + if (v0 == 0) { + Music_Play(14, 51, 0, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(13, 51, 0, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(5, 51, 0, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(53, v0); + } +} + +} // End of namespace BladeRunner |