/* 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 ScriptNR11::InitializeScene() { Setup_Scene_Information(100.0f, 1.75f, -4.0f, 0); Scene_Exit_Add_2D_Exit(0, 450, 305, 565, 345, 2); if (!Game_Flag_Query(640)) { Ambient_Sounds_Adjust_Looping_Sound(452, 22, 0, 1); } Ambient_Sounds_Add_Looping_Sound(205, 22, 0, 1); Ambient_Sounds_Add_Looping_Sound(71, 33, 0, 1); Ambient_Sounds_Add_Sound(303, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(304, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(305, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(306, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(307, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(308, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); if (Game_Flag_Query(632)) { Scene_Loop_Set_Default(3); Ambient_Sounds_Add_Looping_Sound(381, 83, 0, 1); } else if (Game_Flag_Query(634)) { Scene_Loop_Set_Default(5); Ambient_Sounds_Add_Looping_Sound(381, 83, 0, 1); } else { Scene_Loop_Set_Default(0); Overlay_Play("NR11OVER", 0, 1, 0, 0); } } void ScriptNR11::SceneLoaded() { Obstacle_Object("COATRACK", true); Unobstacle_Object("BOX13", true); Clickable_Object("LOFT04"); Unclickable_Object("LOFT04"); if (Actor_Query_Goal_Number(3) == 250) { Clickable_Object("CLOTHING02"); Clickable_Object("BOX27"); Clickable_Object("BOX39"); Clickable_Object("BOX44"); Clickable_Object("DRESS"); Clickable_Object("COATRACK"); Clickable_Object("COLUMN3 DETS"); Clickable_Object("COLUMN PIPE01"); Clickable_Object("RECTANGLE02"); Clickable_Object("COLUMN04"); Clickable_Object("COATRACK01"); Clickable_Object("SHIRT"); Clickable_Object("SKIRT 02"); Clickable_Object("CLOTHING B 03"); Clickable_Object("BUST BUST"); Combat_Target_Object("CLOTHING02"); Combat_Target_Object("BOX27"); Combat_Target_Object("BOX39"); Combat_Target_Object("BOX44"); Combat_Target_Object("DRESS"); Combat_Target_Object("COATRACK"); Combat_Target_Object("COLUMN3 DETS"); Combat_Target_Object("COLUMN PIPE01"); Combat_Target_Object("RECTANGLE02"); Combat_Target_Object("COLUMN04"); Combat_Target_Object("COATRACK01"); Combat_Target_Object("SHIRT"); Combat_Target_Object("SKIRT 02"); Combat_Target_Object("CLOTHING B 03"); Combat_Target_Object("BUST BUST"); } else { Unclickable_Object("CLOTHING02"); Unclickable_Object("BOX27"); Unclickable_Object("BOX39"); Unclickable_Object("BOX44"); Unclickable_Object("DRESS"); Unclickable_Object("COATRACK"); Unclickable_Object("COLUMN3 DETS"); Unclickable_Object("COLUMN PIPE01"); Unclickable_Object("RECTANGLE02"); Unclickable_Object("COLUMN04"); Unclickable_Object("COATRACK01"); Unclickable_Object("SHIRT"); Unclickable_Object("SKIRT 02"); Unclickable_Object("CLOTHING B 03"); Unclickable_Object("BUST BUST"); } } bool ScriptNR11::MouseClick(int x, int y) { return false; } bool ScriptNR11::ClickedOn3DObject(const char *objectName, bool a2) { if (Object_Query_Click("CLOTHING02", objectName) || Object_Query_Click("BOX27", objectName) || Object_Query_Click("BOX39", objectName) || Object_Query_Click("BOX44", objectName) || Object_Query_Click("DRESS", objectName) || Object_Query_Click("COATRACK", objectName) || Object_Query_Click("COLUMN3 DETS", objectName) || Object_Query_Click("COLUMN PIPE01", objectName) || Object_Query_Click("RECTANGLE02", objectName) || Object_Query_Click("COLUMN04", objectName) || Object_Query_Click("COATRACK01", objectName) || Object_Query_Click("SHIRT", objectName) || Object_Query_Click("SKIRT 02", objectName) || Object_Query_Click("CLOTHING B 03", objectName) || Object_Query_Click("BUST BUST", objectName)) { if (a2) { Actor_Set_Goal_Number(1, 211); Scene_Exits_Disable(); sub_4028EC(); Player_Loses_Control(); if (!Player_Query_Combat_Mode()) { Player_Set_Combat_Mode(true); } Actor_Set_Goal_Number(0, 230); Scene_Loop_Set_Default(3); Scene_Loop_Start_Special(2, 2, 1); } else if (Actor_Query_Goal_Number(3) == 250) { if (!Loop_Actor_Walk_To_XYZ(0, 24.0f, 0.33f, 0.0f, 0, 1, false, 0)) { Actor_Face_XYZ(0, -180.0f, 0.0f, -170.0f, true); sub_4028EC(); Actor_Set_Goal_Number(1, 211); if (Actor_Query_Friendliness_To_Other(3, 0) < 30) { Actor_Set_At_XYZ(3, 0.5f, 0.33f, -162.0f, 0); Loop_Actor_Walk_To_XYZ(3, -24.0f, 0.33f, -35.4f, 0, 0, true, 0); Actor_Face_Actor(0, 3, true); Actor_Change_Animation_Mode(3, 71); Delay(500); Actor_Change_Animation_Mode(0, 48); Delay(2000); Actor_Set_Goal_Number(0, 231); } else { Actor_Says(0, 3840, 18); Delay(1000); if (Actor_Query_Friendliness_To_Other(3, 0) > 59 && !Global_Variable_Query(45)) { Music_Play(21, 35, 0, 3, -1, 0, 0); } Loop_Actor_Walk_To_XYZ(3, -135.0f, 0.33000001f, -267.0f, 0, 0, false, 0); Actor_Face_Actor(3, 0, true); Actor_Face_Actor(0, 3, true); Actor_Clue_Acquire(0, 107, 1, 3); Actor_Says(3, 990, 13); Actor_Says(3, 1000, 14); Loop_Actor_Walk_To_Actor(3, 0, 108, 0, false); Actor_Says(0, 3845, 13); Actor_Says(0, 3850, 15); Actor_Says(3, 1010, 14); Actor_Says(0, 3855, 13); Actor_Says(3, 1020, 12); Actor_Says(0, 3860, 12); Actor_Says_With_Pause(3, 1030, 1.0f, 14); Actor_Says(3, 1040, 13); Actor_Says(0, 3865, 15); Actor_Says_With_Pause(3, 1050, 0.80000001f, 14); Actor_Says(3, 1060, 13); Actor_Says(0, 3870, 3); Actor_Says(3, 1070, 14); Actor_Modify_Friendliness_To_Other(3, 0, 5); if (Actor_Query_Friendliness_To_Other(3, 0) > 55 && !Global_Variable_Query(45)) { Global_Variable_Set(45, 2); Actor_Says(3, 1130, 17); Actor_Says(0, 6365, 12); Actor_Says(3, 1140, 14); Actor_Says(0, 6370, 14); Actor_Says(3, 1150, 12); Actor_Says(3, 1160, 16); } Actor_Says(3, 1080, 13); Actor_Says(0, 3875, 14); Actor_Says(3, 1090, 17); Music_Stop(4); Actor_Set_Goal_Number(3, 260); if (Global_Variable_Query(40) == 1) { Actor_Set_Goal_Number(1, 236); } Game_Flag_Set(591); } } else { if (Random_Query(1, 2) == 1) { Actor_Says(0, 8575, 14); } else { Actor_Says(0, 8580, 14); } } } return true; } return false; } bool ScriptNR11::ClickedOnActor(int actorId) { return false; } bool ScriptNR11::ClickedOnItem(int itemId, bool a2) { return false; } bool ScriptNR11::ClickedOnExit(int exitId) { if (exitId == 0) { if (!Loop_Actor_Walk_To_XYZ(0, 100.0f, 1.75f, -8.0f, 0, 1, false, 0)) { Game_Flag_Set(477); Set_Enter(59, 63); return true; } } return false; } bool ScriptNR11::ClickedOn2DRegion(int region) { return false; } void ScriptNR11::SceneFrameAdvanced(int frame) { if (frame == 62) { Ambient_Sounds_Play_Sound(449, 40, 100, 100, 10); } if (frame == 67) { Ambient_Sounds_Play_Sound(449, 30, 90, 90, 10); } if (frame == 74) { Ambient_Sounds_Play_Sound(450, 50, 83, 83, 10); } if (frame == 80) { Ambient_Sounds_Play_Sound(449, 60, 65, 65, 10); } if (frame == 92) { Ambient_Sounds_Play_Sound(450, 30, 50, 50, 10); } if (frame == 97) { Ambient_Sounds_Play_Sound(449, 50, -40, -40, 10); } if (frame == 103) { Ambient_Sounds_Play_Sound(450, 40, -27, -27, 10); } if (frame == 109) { Ambient_Sounds_Play_Sound(449, 60, -20, -20, 10); } if (frame == 62) { Ambient_Sounds_Play_Sound(122, 80, 100, 100, 15); } if (Game_Flag_Query(659)) { Game_Flag_Reset(659); Overlay_Remove("NR11OVER"); Overlay_Play("NR11OVER", 1, 0, 1, 0); } if (Game_Flag_Query(635)) { sub_4028EC(); Player_Loses_Control(); if (!Player_Query_Combat_Mode()) { Player_Set_Combat_Mode(true); } Actor_Set_Goal_Number(0, 230); Scene_Loop_Set_Default(3); Scene_Loop_Start_Special(2, 2, 1); Game_Flag_Reset(635); } else { if (frame < 61 || frame > 120) { //return false; return; } sub_4027D0(0, frame); if (Actor_Query_Goal_Number(1) == 215) { sub_4027D0(1, frame); } if (frame == 120) { Actor_Set_Goal_Number(0, 0); Player_Gains_Control(); if (Actor_Query_Goal_Number(1) == 215) { Actor_Set_Goal_Number(1, 216); } Actor_Set_Goal_Number(3, 269); } } //return true; } void ScriptNR11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { } void ScriptNR11::PlayerWalkedIn() { if (Actor_Query_Goal_Number(3) == 250) { Player_Set_Combat_Mode(true); if (Game_Flag_Query(47)) { Actor_Set_Goal_Number(1, 210); } } if (Game_Flag_Query(632)) { Game_Flag_Reset(632); Game_Flag_Set(634); Actor_Put_In_Set(3, 99); Actor_Set_At_Waypoint(3, 41, 0); Actor_Set_Invisible(0, false); Player_Set_Combat_Mode(false); Player_Gains_Control(); if (Game_Flag_Query(47)) { if (Actor_Query_Goal_Number(1) == 211) { Actor_Set_At_XYZ(0, -37.41f, 0.33f, -86.0f, 26); Delay(500); Actor_Face_Current_Camera(0, true); Delay(750); Actor_Says(0, 5290, 12); Delay(1000); Actor_Set_Goal_Number(1, 212); Actor_Face_Actor(0, 1, true); } else { Actor_Set_At_XYZ(0, -15.53f, 0.33f, 73.49f, 954); Actor_Modify_Friendliness_To_Other(1, 0, 3); Delay(1500); Actor_Says(0, 3805, 12); Actor_Face_Actor(0, 1, true); Actor_Face_Actor(1, 0, true); Actor_Says_With_Pause(1, 1720, 0.3f, 16); Actor_Says(0, 3810, 16); Actor_Says_With_Pause(1, 1730, 0.2f, 14); Actor_Says(1, 1740, 15); Actor_Set_Goal_Number(3, 599); Actor_Put_In_Set(3, 99); Actor_Set_At_Waypoint(3, 41, 0); Actor_Set_Goal_Number(1, 275); } } else { Actor_Set_Goal_Number(0, 500); } } // return true; } void ScriptNR11::PlayerWalkedOut() { } void ScriptNR11::DialogueQueueFlushed(int a1) { } void ScriptNR11::sub_4027D0(int actorId, signed int frame) { float x; float y; float z; float coef; if (frame < 80) { coef = (frame - 60) / 20.0f; x = -106.66f * coef + 126.0f; y = 57.79f * coef + 0.85f; z = 42.0f * coef + -151.0f; } else { coef = (frame - 80) / 40.0f; x = -97.87f * coef + -150.0f; y = -10.8f * coef + 52.0f; z = 57.0f * coef + -232.0f; } Actor_Face_XYZ(actorId, x, y, z, true); } void ScriptNR11::sub_4028EC() { Un_Combat_Target_Object("CLOTHING02"); Un_Combat_Target_Object("BOX27"); Un_Combat_Target_Object("BOX39"); Un_Combat_Target_Object("BOX44"); Un_Combat_Target_Object("DRESS"); Un_Combat_Target_Object("COATRACK"); Un_Combat_Target_Object("COLUMN3 DETS"); Un_Combat_Target_Object("COLUMN PIPE01"); Un_Combat_Target_Object("RECTANGLE02"); Un_Combat_Target_Object("COLUMN04"); Un_Combat_Target_Object("COATRACK01"); Un_Combat_Target_Object("SHIRT"); Un_Combat_Target_Object("SKIRT 02"); Un_Combat_Target_Object("CLOTHING B 03"); Un_Combat_Target_Object("BUST BUST"); } } // End of namespace BladeRunner