aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script
diff options
context:
space:
mode:
Diffstat (limited to 'engines/bladerunner/script')
-rw-r--r--engines/bladerunner/script/ai.cpp15
-rw-r--r--engines/bladerunner/script/ai.h16
-rw-r--r--engines/bladerunner/script/ai/leon.cpp8
-rw-r--r--engines/bladerunner/script/ai/maggie.cpp634
-rw-r--r--engines/bladerunner/script/ai/mccoy.cpp4
-rw-r--r--engines/bladerunner/script/ai/officer_leary.cpp2
-rw-r--r--engines/bladerunner/script/ai/runciter.cpp2
-rw-r--r--engines/bladerunner/script/scene.h10
-rw-r--r--engines/bladerunner/script/scene/bb02.cpp4
-rw-r--r--engines/bladerunner/script/scene/ct02.cpp8
-rw-r--r--engines/bladerunner/script/scene/dr04.cpp4
-rw-r--r--engines/bladerunner/script/scene/hc03.cpp4
-rw-r--r--engines/bladerunner/script/scene/hf04.cpp4
-rw-r--r--engines/bladerunner/script/scene/hf05.cpp2
-rw-r--r--engines/bladerunner/script/scene/hf06.cpp2
-rw-r--r--engines/bladerunner/script/scene/kp03.cpp8
-rw-r--r--engines/bladerunner/script/scene/ma01.cpp72
-rw-r--r--engines/bladerunner/script/scene/ma02.cpp41
-rw-r--r--engines/bladerunner/script/scene/ma04.cpp46
-rw-r--r--engines/bladerunner/script/scene/ma05.cpp10
-rw-r--r--engines/bladerunner/script/scene/ma06.cpp59
-rw-r--r--engines/bladerunner/script/scene/ma07.cpp8
-rw-r--r--engines/bladerunner/script/scene/nr08.cpp2
-rw-r--r--engines/bladerunner/script/scene/nr10.cpp2
-rw-r--r--engines/bladerunner/script/scene/nr11.cpp4
-rw-r--r--engines/bladerunner/script/scene/ps05.cpp27
-rw-r--r--engines/bladerunner/script/scene/rc01.cpp240
-rw-r--r--engines/bladerunner/script/scene/tb07.cpp2
-rw-r--r--engines/bladerunner/script/scene/ug01.cpp2
-rw-r--r--engines/bladerunner/script/scene/ug10.cpp6
-rw-r--r--engines/bladerunner/script/scene/ug13.cpp4
-rw-r--r--engines/bladerunner/script/scene/ug15.cpp2
-rw-r--r--engines/bladerunner/script/script.cpp111
-rw-r--r--engines/bladerunner/script/script.h36
34 files changed, 1052 insertions, 349 deletions
diff --git a/engines/bladerunner/script/ai.cpp b/engines/bladerunner/script/ai.cpp
index c695886a61..ade27e417f 100644
--- a/engines/bladerunner/script/ai.cpp
+++ b/engines/bladerunner/script/ai.cpp
@@ -41,6 +41,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorsCount) : _vm(vm), _inScrip
_AIScripts[kActorRunciter] = new AIScriptRunciter(_vm);
_AIScripts[kActorOfficerLeary] = new AIScriptOfficerLeary(_vm);
_AIScripts[kActorLeon] = new AIScriptLeon(_vm);
+ _AIScripts[kActorMaggie] = new AIScriptMaggie(_vm);
}
AIScripts::~AIScripts() {
@@ -100,6 +101,20 @@ void AIScripts::ReceivedClue(int actor, int clueId, int fromActorId) {
_inScriptCounter--;
}
+void AIScripts::ClickedByPlayer(int actor) {
+ assert(actor < _actorsCount);
+
+ if(_vm->_actors[actor]->inCombat()) {
+ return;
+ }
+
+ _inScriptCounter++;
+ if (_AIScripts[actor]) {
+ _AIScripts[actor]->ClickedByPlayer();
+ }
+ _inScriptCounter--;
+}
+
void AIScripts::EnteredScene(int actor, int setId) {
assert(actor < _actorsCount);
_inScriptCounter++;
diff --git a/engines/bladerunner/script/ai.h b/engines/bladerunner/script/ai.h
index c3fec411e9..9f2caa094b 100644
--- a/engines/bladerunner/script/ai.h
+++ b/engines/bladerunner/script/ai.h
@@ -152,6 +152,21 @@ DECLARE_SCRIPT(Leon)
float sub_446700(int actorId, float x, float y, float z);
END_SCRIPT
+DECLARE_SCRIPT(Maggie)
+ int var_45F3F0_animation_state;
+ int var_45F3F4_animation_frame;
+ int var_462B30;
+ int var_462B34;
+ int var_45F3F8;
+ int var_45F3FC;
+ int var_45F400;
+ int var_45F404;
+ int var_45F408;
+
+ int sub_44B260();
+ float sub_44B200(int actorId, float x, float y, float z);
+END_SCRIPT
+
#undef DECLARE_SCRIPT
#undef END_SCRIPT
@@ -171,6 +186,7 @@ public:
void TimerExpired(int actor, int timer);
void CompletedMovementTrack(int actor);
void ReceivedClue(int actor, int clueId, int fromActorId);
+ void ClickedByPlayer(int actor);
void EnteredScene(int actor, int setId);
void OtherAgentEnteredThisScene(int actor, int otherActorId);
void OtherAgentExitedThisScene(int actor, int otherActorId);
diff --git a/engines/bladerunner/script/ai/leon.cpp b/engines/bladerunner/script/ai/leon.cpp
index 63dc3d4782..45e1c7423d 100644
--- a/engines/bladerunner/script/ai/leon.cpp
+++ b/engines/bladerunner/script/ai/leon.cpp
@@ -93,7 +93,7 @@ void AIScriptLeon::ClickedByPlayer() {
void AIScriptLeon::EnteredScene(int sceneId) {}
void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) {
- if (otherActorId == 0 && Actor_Query_Goal_Number(kActorLeon) == 7) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Goal_Number(kActorLeon) == 7) {
AI_Countdown_Timer_Reset(kActorLeon, 0);
AI_Movement_Track_Flush(kActorLeon);
AI_Movement_Track_Append(kActorLeon, 353, 0);
@@ -104,7 +104,7 @@ void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) {
}
void AIScriptLeon::OtherAgentExitedThisScene(int otherActorId) {
- if (otherActorId == 0 && Actor_Query_Which_Set_In(kActorLeon) == 33) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Which_Set_In(kActorLeon) == 33) {
AI_Movement_Track_Flush(kActorLeon);
ADQ_Flush();
Actor_Set_Goal_Number(kActorLeon, 8);
@@ -115,7 +115,7 @@ void AIScriptLeon::OtherAgentExitedThisScene(int otherActorId) {
}
void AIScriptLeon::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
- if (otherActorId == 0 && combatMode == 1 && Actor_Query_Goal_Number(kActorLeon) == 1) {
+ if (otherActorId == kActorMcCoy && combatMode == 1 && Actor_Query_Goal_Number(kActorLeon) == 1) {
Game_Flag_Set(539);
Player_Loses_Control();
Actor_Face_Actor(kActorMcCoy, kActorLeon, true);
@@ -448,7 +448,7 @@ void AIScriptLeon::FledCombat() {}
float AIScriptLeon::sub_446700(int actorId, float x, float y, float z) {
float actorX, actorY, actorZ;
Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);
- return sqrtf((z - actorZ) * (z - actorZ) + (y - actorX) * (y - actorX) + (y - actorY) * (y - actorY));
+ return sqrtf((z - actorZ) * (z - actorZ) + (y - actorY) * (y - actorY) + (x - actorX) * (x - actorX));
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/ai/maggie.cpp b/engines/bladerunner/script/ai/maggie.cpp
new file mode 100644
index 0000000000..150a2a3a0b
--- /dev/null
+++ b/engines/bladerunner/script/ai/maggie.cpp
@@ -0,0 +1,634 @@
+/* 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/ai.h"
+#include "bladerunner/vector.h"
+
+namespace BladeRunner {
+
+void AIScriptMaggie::Initialize() {
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ var_462B30 = 0;
+ var_45F3F8 = 0;
+ var_45F3FC = 0;
+ var_45F400 = 0;
+ var_45F404 = 0;
+ var_45F408 = 0;
+ Actor_Set_Goal_Number(kActorMaggie, 0);
+}
+
+bool AIScriptMaggie::Update() {
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (Actor_Query_Which_Set_In(kActorMaggie) == 10 && Global_Variable_Query(1) == 4) {
+ Actor_Put_In_Set(kActorMaggie, 97);
+ Actor_Set_At_Waypoint(kActorMaggie, 39, 0);
+ }
+ if (goal == 414) {
+ Actor_Set_Goal_Number(kActorMaggie, 415);
+ } else if (goal == 413 && Actor_Query_Inch_Distance_From_Actor(kActorMcCoy, kActorMaggie) < 60) {
+ Actor_Set_Goal_Number(kActorMaggie, 415);
+ }
+ if (Global_Variable_Query(1) == 5) {
+ if (Actor_Query_Goal_Number(kActorMaggie) < 400) {
+ Actor_Set_Goal_Number(66, 400);
+ }
+ return true;
+ }
+ return false;
+}
+
+void AIScriptMaggie::TimerExpired(int timer) {
+ if (timer != 0) {
+ return;
+ }
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 8) {
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ if (Random_Query(0, 4)) {
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, sub_44B260(), 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ } else {
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ }
+ return; //true
+ }
+ if (goal == 10) {
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ Actor_Change_Animation_Mode(kActorMaggie, 55);
+ return; //true
+ }
+ return; //false
+}
+
+void AIScriptMaggie::CompletedMovementTrack() {
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 0 || goal > 9) {
+ if (goal == 413) {
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ return; //true
+ }
+ } else {
+ if (goal == 1) {
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ return; //true
+ }
+ if (goal == 8) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(1, 5));
+ return; //true
+ }
+ if (goal == 9) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ return; //true
+ }
+ }
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return; //true
+}
+
+void AIScriptMaggie::ReceivedClue(int clueId, int fromActorId) {
+}
+
+void AIScriptMaggie::ClickedByPlayer() {
+ if (!Game_Flag_Query(653) && Global_Variable_Query(1) == 5) {
+ if (Actor_Query_Goal_Number(kActorMaggie) == 413) {
+ Actor_Set_Targetable(kActorMaggie, true);
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Says(kActorMcCoy, 2400, 52);
+ }
+ return; // true
+ }
+ if (var_45F3F0_animation_state == 1 || var_45F3F0_animation_state == 12 || var_45F3F0_animation_state == 16) {
+ return; // false
+ }
+
+ float mccoy_x, mccoy_y, mccoy_z;
+
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Query_XYZ(kActorMcCoy, &mccoy_x, &mccoy_y, &mccoy_z);
+ float distance = sub_44B200(kActorMaggie, mccoy_x, mccoy_y, mccoy_z);
+ if (distance > 60.0f) {
+ Actor_Says(0, 2430, 18);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ return; // true
+ }
+
+ int v6 = Random_Query(0, 4);
+ if (v6 == 1) {
+ Actor_Says(kActorMcCoy, 2440, 18);
+ }
+ if (v6 == 0) {
+ Actor_Says(kActorMcCoy, 2435, 13);
+ }
+
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 8) {
+ if (Random_Query(0, 1)) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 57);
+ } else {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ }
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(3, 9));
+ return; // true
+ }
+ if (goal == 10) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ return; // true
+ }
+ if (goal == 11) {
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ return; // true
+ }
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return; // true
+}
+
+void AIScriptMaggie::EnteredScene(int sceneId) {
+}
+
+void AIScriptMaggie::OtherAgentEnteredThisScene(int otherActorId) {
+}
+
+void AIScriptMaggie::OtherAgentExitedThisScene(int otherActorId) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Which_Set_In(kActorMaggie) == 10 && Global_Variable_Query(1) < 4) {
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Set_Goal_Number(kActorMaggie, 0);
+ }
+}
+
+void AIScriptMaggie::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
+}
+
+void AIScriptMaggie::ShotAtAndMissed() {
+}
+
+void AIScriptMaggie::ShotAtAndHit() {
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ Actor_Set_Targetable(kActorMaggie, false);
+}
+
+void AIScriptMaggie::Retired(int byActorId) {
+}
+
+int AIScriptMaggie::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
+ return 0;
+}
+
+bool AIScriptMaggie::GoalChanged(int currentGoalNumber, int newGoalNumber) {
+ if (currentGoalNumber == 599) {
+ return true;
+ }
+ switch (newGoalNumber) {
+ case 11:
+ Actor_Change_Animation_Mode(kActorMaggie, 55);
+ var_45F3F0_animation_state = 9;
+ var_45F3F4_animation_frame = 0;
+ return true;
+ case 10:
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(2, 9));
+ return true;
+ case 9:
+ if (Random_Query(0, 2) <= 0) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, false);
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ } else {
+ AI_Movement_Track_Flush(kActorMaggie);
+ if (Actor_Query_Which_Set_In(kActorMaggie) == 10) {
+ AI_Movement_Track_Append(kActorMaggie, sub_44B260(), 486);
+ }
+ AI_Movement_Track_Repeat(kActorMaggie);
+ }
+ return true;
+ case 8:
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(3, 9));
+ return true;
+ case 7:
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Movement_Track_Flush(kActorMaggie);
+ Loop_Actor_Walk_To_Actor(kActorMaggie, kActorMcCoy, 30, 0, false);
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return true;
+ case 3:
+ Player_Loses_Control();
+ AI_Movement_Track_Flush(kActorMaggie);
+ Loop_Actor_Walk_To_Actor(kActorMaggie, kActorMcCoy, 48, 0, false);
+ Actor_Face_Actor(0, kActorMaggie, true);
+ Actor_Face_Actor(kActorMaggie, 0, false);
+ Actor_Says(kActorMcCoy, 2400, 52);
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ Player_Gains_Control();
+ return true;
+ case 1:
+ Actor_Put_In_Set(kActorMaggie, 10);
+ Actor_Set_At_Waypoint(kActorMaggie, sub_44B260(), 512);
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, 264, 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ return true;
+ case 0:
+ Actor_Put_In_Set(kActorMaggie, 10);
+ Actor_Set_At_Waypoint(kActorMaggie, 265, 780);
+ return true;
+ case 415:
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Sound_Play(494, 50, 0, 0, 100);
+ Actor_Set_Goal_Number(kActorMaggie, 599);
+ Actor_Change_Animation_Mode(kActorMaggie, 51);
+ if (Actor_Query_Inch_Distance_From_Actor(0, kActorMaggie) < 144) {
+ Player_Loses_Control();
+ Actor_Change_Animation_Mode(kActorMcCoy, 48);
+ Actor_Retired_Here(kActorMcCoy, 6, 6, 1, -1);
+ } else {
+ Delay(3000);
+ Scene_Exits_Disable();
+ Actor_Says(kActorMcCoy, 2235, 12);
+ if (Actor_Query_Is_In_Current_Set(kActorSteele)) {
+ Actor_Says(kActorSteele, 1530, 58);
+ Actor_Set_Goal_Number(kActorSteele, 431);
+ }
+ Delay(2000);
+ Actor_Says(kActorMcCoy, 2390, 13);
+ if (Actor_Query_Goal_Number(kActorSadik) == 411) {
+ Actor_Set_Goal_Number(kActorSadik, 412);
+ } else {
+ Actor_Set_Goal_Number(kActorClovis, 512);
+ }
+ }
+ break;
+ case 413:
+ if (Actor_Query_Is_In_Current_Set(kActorSteele)) {
+ Actor_Says(kActorSteele, 3270, 59);
+ }
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, 540, 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ break;
+ case 412:
+ Scene_Exits_Disable();
+ Loop_Actor_Walk_To_XYZ(kActorMaggie, -734.0, 0.0, -432.0, 0, 0, false, 0);
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Says(kActorMcCoy, 2225, 3);
+ Actor_Set_Goal_Number(kActorMaggie, 413);
+ break;
+ case 411:
+ AI_Movement_Track_Flush(kActorMaggie);
+ Game_Flag_Set(461);
+ Actor_Put_In_Set(kActorMaggie, 9);
+ Actor_Set_At_XYZ(kActorMaggie, -672.0, 0.0, -428.0, 653);
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ break;
+ case 400:
+ Actor_Set_Goal_Number(kActorMaggie, 410);
+ break;
+ }
+ return false;
+}
+
+bool AIScriptMaggie::UpdateAnimation(int *animation, int *frame) {
+ int goal;
+ switch (var_45F3F0_animation_state) {
+ case 16:
+ *animation = 871;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 15:
+ *animation = 874;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(874) - 1;
+ break;
+ case 14:
+ *animation = 874;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(874) - 1) {
+ var_45F3F0_animation_state = 15;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
+ Actor_Put_In_Set(kActorMaggie, 99);
+ Actor_Set_At_Waypoint(kActorMaggie, 41, 0);
+ }
+ break;
+ case 13:
+ *animation = 873;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(873)) {
+ var_45F3F0_animation_state = 11;
+ var_45F3F4_animation_frame = 0;
+ *animation = 875;
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ }
+ break;
+ case 12:
+ *animation = 872;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(872)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 11:
+ *animation = 875;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(875)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 10:
+ *animation = 876;
+ var_45F3F4_animation_frame--;
+ if (var_45F3F4_animation_frame > 0) {
+ break;
+ }
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ *animation = 867;
+ goal = Actor_Query_Goal_Number(66);
+ if (goal == 3) {
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ *animation = 868;
+ } else if (goal == 7) {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ } else {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ }
+ break;
+ case 9:
+ *animation = 876;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(876) - 1;
+ break;
+ case 8:
+ *animation = 876;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(876) - 1) {
+ var_45F3F0_animation_state = 9;
+ Actor_Set_Goal_Number(kActorMaggie, 11);
+ }
+ break;
+ case 7:
+ *animation = 868;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(868)) {
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ if (Actor_Query_Goal_Number(kActorMaggie) == 10) {
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ } else if (Actor_Query_Goal_Number(kActorMaggie) == 7) {
+ Actor_Set_Goal_Number(kActorMaggie, 12);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ }
+ }
+ break;
+ case 6:
+ *animation = 867;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(867)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 5:
+ *animation = 866;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(866)) {
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ *animation = 867;
+ if (Actor_Query_Goal_Number(kActorMaggie) == 9) {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ }
+ }
+ break;
+ case 4:
+ *animation = 865;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(865)) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F8--;
+ if (var_45F3F8 <= 0) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ }
+ }
+ break;
+ case 3:
+ *animation = 870;
+ if (var_45F3F4_animation_frame == 1) {
+ Sound_Play(Random_Query(263, 264), 50, 0, 0, 50);
+ }
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+ var_45F3FC--;
+ if (var_45F3FC <= 0 ) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ }
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 2:
+ *animation = 869;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(869)) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 1:
+ *animation = 863;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(863)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 0:
+ *animation = 864;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(864)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ }
+ *frame = var_45F3F4_animation_frame;
+ return true;
+}
+
+bool AIScriptMaggie::ChangeAnimationMode(int mode) {
+ if (mode == 1) {
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 12;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ var_45F3F0_animation_state = 1;
+ var_45F3F4_animation_frame = 0;
+ }
+ return true;
+ }
+ if (mode == 0) {
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 11;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ switch (var_45F3F0_animation_state) {
+ case 8:
+ case 9:
+ var_45F3F0_animation_state = 10;
+ break;
+ case 6:
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 5:
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 2:
+ case 7:
+ case 10:
+ break;
+ default:
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ break;
+ }
+ }
+ return true;
+ }
+
+ switch (mode) {
+ case 88:
+ var_45F3F0_animation_state = 16;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 57:
+ if (var_45F3F0_animation_state != 4) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F0_animation_state = 4;
+ }
+ var_45F3F8 = Random_Query(2, 6);
+ Sound_Play(276, 50, 0, 0, 50);
+ break;
+ case 56:
+ if (var_45F3F0_animation_state != 3) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F0_animation_state = 3;
+ }
+ var_45F3FC = Random_Query(2, 6);
+ break;
+ case 55:
+ if (var_45F3F0_animation_state == 6) {
+ var_45F3F0_animation_state = 8;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 54:
+ if ((unsigned int)var_45F3F0_animation_state <= 9) {
+ if (var_45F3F0_animation_state) {
+ if (var_45F3F0_animation_state == 9) {
+ var_45F3F0_animation_state = 10;
+ var_45F3F4_animation_frame = 0;
+ }
+ } else {
+ var_45F3F0_animation_state = 5;
+ var_45F3F4_animation_frame = 0;
+ }
+ }
+ break;
+ case 52:
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 13;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ var_45F3F0_animation_state = 2;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 51:
+ var_45F3F0_animation_state = 14;
+ var_45F3F4_animation_frame = 0;
+ Sound_Play(272, 50, 0, 0, 50);
+ break;
+ }
+ return true;
+}
+
+void AIScriptMaggie::QueryAnimationState(int *animationState, int *animationFrame, int *a3, int *a4) {
+ *animationState = var_45F3F0_animation_state;
+ *animationFrame = var_45F3F4_animation_frame;
+ *a3 = var_462B30;
+ *a4 = var_462B34;
+}
+
+void AIScriptMaggie::SetAnimationState(int animationState, int animationFrame, int a3, int a4) {
+ var_45F3F0_animation_state = animationState;
+ var_45F3F4_animation_frame = animationFrame;
+ var_462B30 = a3;
+ var_462B34 = a4;
+}
+
+bool AIScriptMaggie::ReachedMovementTrackWaypoint(int waypointId) {
+ return true;
+}
+
+void AIScriptMaggie::FledCombat() {
+}
+
+int AIScriptMaggie::sub_44B260() {
+ int random = Random_Query(0, 3);
+ if (random == 0) {
+ return 264;
+ }
+ if (random == 1) {
+ return 265;
+ }
+ if (random == 2) {
+ return 266;
+ }
+ return 267;
+}
+
+float AIScriptMaggie::sub_44B200(int actorId, float x, float y, float z) {
+ float actorX, actorY, actorZ;
+ Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);
+ return sqrtf((z - actorZ) * (z - actorZ) + (y - actorY) * (y - actorY) + (x - actorX) * (x - actorX));
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp
index bda6b093e6..fb670af304 100644
--- a/engines/bladerunner/script/ai/mccoy.cpp
+++ b/engines/bladerunner/script/ai/mccoy.cpp
@@ -431,7 +431,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
if (Game_Flag_Query(666)) {
Chapter_Enter(5, 53, 53);
} else {
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Chapter_Enter(5, 10, 49);
}
return true;
@@ -1684,7 +1684,7 @@ void AIScriptMcCoy::sub_4054F0() {
if ((z < 220.0f) && (-210.0f < x) && (-70.0f > x)) {
Game_Flag_Set(682);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Actor_Set_Goal_Number(kActorMcCoy, 390);
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
if (-200.0 < x && -62.0f > x) {
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index e55a9563e2..9b85a4cdf8 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -46,7 +46,7 @@ bool AIScriptOfficerLeary::Update() {
AI_Movement_Track_Flush(kActorOfficerLeary);
Actor_Set_Goal_Number(kActorOfficerLeary, 400);
} else if (!Game_Flag_Query(182) && Game_Flag_Query(147) == 1 && Game_Flag_Query(163) == 1 && Player_Query_Current_Scene() != 78 && Global_Variable_Query(1) < 3) {
- Game_Flag_Set(186);
+ Game_Flag_Set(kFlagRC01PoliceDone);
Actor_Set_Goal_Number(kActorOfficerLeary, 3);
} else if (Actor_Query_Goal_Number(kActorOfficerLeary) != 1 && Actor_Query_Goal_Number(kActorOfficerLeary) != 2 && Game_Flag_Query(199) == 1) {
Game_Flag_Reset(199);
diff --git a/engines/bladerunner/script/ai/runciter.cpp b/engines/bladerunner/script/ai/runciter.cpp
index d34b4a8a01..0c66876efb 100644
--- a/engines/bladerunner/script/ai/runciter.cpp
+++ b/engines/bladerunner/script/ai/runciter.cpp
@@ -37,7 +37,7 @@ void AIScriptRunciter::Initialize() {
}
bool AIScriptRunciter::Update() {
- if (Actor_Query_Goal_Number(kActorRunciter) == 0 && Game_Flag_Query(186)) {
+ if (Actor_Query_Goal_Number(kActorRunciter) == 0 && Game_Flag_Query(kFlagRC01PoliceDone)) {
Actor_Set_Goal_Number(kActorRunciter, 2);
}
if (Global_Variable_Query(1) == 4 && Actor_Query_Goal_Number(kActorRunciter) < 300) {
diff --git a/engines/bladerunner/script/scene.h b/engines/bladerunner/script/scene.h
index 0d4f574caa..b65f5f19b2 100644
--- a/engines/bladerunner/script/scene.h
+++ b/engines/bladerunner/script/scene.h
@@ -276,8 +276,8 @@ DECLARE_SCRIPT(MA04)
void sub_402F2C();
void sub_4032A0();
void sub_4034D8();
- void sub_403864();
- void sub_403DA8();
+ void turnOnTV();
+ void sleep();
END_SCRIPT
DECLARE_SCRIPT(MA05)
@@ -285,8 +285,8 @@ DECLARE_SCRIPT(MA05)
END_SCRIPT
DECLARE_SCRIPT(MA06)
- bool sub_4012C0();
- void sub_4014E4();
+ bool isElevatorOnDifferentFloor();
+ void activateElevator();
END_SCRIPT
DECLARE_SCRIPT(MA07)
@@ -410,7 +410,7 @@ END_SCRIPT
DECLARE_SCRIPT(RC01)
void sub_403850();
- void sub_4037AC();
+ void walkToCenter();
END_SCRIPT
DECLARE_SCRIPT(RC02)
diff --git a/engines/bladerunner/script/scene/bb02.cpp b/engines/bladerunner/script/scene/bb02.cpp
index 6022444d7e..d238617a33 100644
--- a/engines/bladerunner/script/scene/bb02.cpp
+++ b/engines/bladerunner/script/scene/bb02.cpp
@@ -100,12 +100,12 @@ bool SceneScriptBB02::ClickedOnExit(int exitId) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -12.0f, -415.06f, -27.0f, 0, 1, false, 0)) {
Player_Loses_Control();
if (!Game_Flag_Query(493)) {
- Scene_Loop_Start_Special(2, 0, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, true);
}
Game_Flag_Set(332);
Game_Flag_Reset(493);
Set_Enter(1, 5);
- Scene_Loop_Start_Special(1, 3, 0);
+ Scene_Loop_Start_Special(1, 3, false);
}
return true;
}
diff --git a/engines/bladerunner/script/scene/ct02.cpp b/engines/bladerunner/script/scene/ct02.cpp
index 95e1a6a832..47293d5b2a 100644
--- a/engines/bladerunner/script/scene/ct02.cpp
+++ b/engines/bladerunner/script/scene/ct02.cpp
@@ -152,7 +152,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 280:
@@ -165,7 +165,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 290:
@@ -181,7 +181,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 300:
@@ -192,7 +192,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
}
diff --git a/engines/bladerunner/script/scene/dr04.cpp b/engines/bladerunner/script/scene/dr04.cpp
index f11c462db6..b0e6e3bcb7 100644
--- a/engines/bladerunner/script/scene/dr04.cpp
+++ b/engines/bladerunner/script/scene/dr04.cpp
@@ -184,7 +184,7 @@ void SceneScriptDR04::SceneFrameAdvanced(int frame) {
Game_Flag_Reset(515);
Game_Flag_Reset(271);
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Music_Stop(4);
Actor_Set_Goal_Number(kActorMoraji, 99);
} else {
@@ -192,7 +192,7 @@ void SceneScriptDR04::SceneFrameAdvanced(int frame) {
Game_Flag_Reset(271);
Game_Flag_Set(272);
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Item_Remove_From_World(78);
}
switch (frame) {
diff --git a/engines/bladerunner/script/scene/hc03.cpp b/engines/bladerunner/script/scene/hc03.cpp
index 81007ce8b6..02e88bb3fa 100644
--- a/engines/bladerunner/script/scene/hc03.cpp
+++ b/engines/bladerunner/script/scene/hc03.cpp
@@ -100,7 +100,7 @@ bool SceneScriptHC03::ClickedOnItem(int itemId, bool a2) {
if (itemId == 121) {
if (a2) {
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Set(403);
Item_Remove_From_World(121);
Unobstacle_Object("GPscisGate", true);
@@ -146,7 +146,7 @@ bool SceneScriptHC03::ClickedOnExit(int exitId) {
Set_Enter(75, 87);
} else {
Scene_Loop_Set_Default(6);
- Scene_Loop_Start_Special(2, 5, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 5, true);
Game_Flag_Set(388);
}
}
diff --git a/engines/bladerunner/script/scene/hf04.cpp b/engines/bladerunner/script/scene/hf04.cpp
index 7389810a6a..aaa3e8f25e 100644
--- a/engines/bladerunner/script/scene/hf04.cpp
+++ b/engines/bladerunner/script/scene/hf04.cpp
@@ -108,14 +108,14 @@ void SceneScriptHF04::SceneFrameAdvanced(int frame) {
if (Game_Flag_Query(585)) {
Game_Flag_Reset(585);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
//return true;
return;
}
if (Game_Flag_Query(586)) {
Game_Flag_Reset(586);
Scene_Loop_Set_Default(0);
- Scene_Loop_Start_Special(2, 5, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 5, true);
//return true;
return;
}
diff --git a/engines/bladerunner/script/scene/hf05.cpp b/engines/bladerunner/script/scene/hf05.cpp
index b451b76ba2..8106f71242 100644
--- a/engines/bladerunner/script/scene/hf05.cpp
+++ b/engines/bladerunner/script/scene/hf05.cpp
@@ -92,7 +92,7 @@ bool SceneScriptHF05::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Face_Heading(kActorMcCoy, 0, false);
Actor_Change_Animation_Mode(kActorMcCoy, 23);
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
if (sub_4048C0()) {
if (sub_4048C0() == 3) {
Actor_Face_Heading(kActorDektora, 0, false);
diff --git a/engines/bladerunner/script/scene/hf06.cpp b/engines/bladerunner/script/scene/hf06.cpp
index 926967a2df..cd5651af0f 100644
--- a/engines/bladerunner/script/scene/hf06.cpp
+++ b/engines/bladerunner/script/scene/hf06.cpp
@@ -263,7 +263,7 @@ void SceneScriptHF06::sub_401EF4() {
Actor_Change_Animation_Mode(kActorSteele, 6);
Delay(500);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Sound_Play(562, 50, 0, 0, 50);
Game_Flag_Set(559);
Scene_Exits_Disable();
diff --git a/engines/bladerunner/script/scene/kp03.cpp b/engines/bladerunner/script/scene/kp03.cpp
index 59766c0553..4071fd6a15 100644
--- a/engines/bladerunner/script/scene/kp03.cpp
+++ b/engines/bladerunner/script/scene/kp03.cpp
@@ -69,7 +69,7 @@ bool SceneScriptKP03::ClickedOn3DObject(const char *objectName, bool a2) {
if (Object_Query_Click("BRACK MID", objectName) && !Game_Flag_Query(422)) {
if (a2) {
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
Actor_Change_Animation_Mode(kActorMcCoy, 39);
Actor_Retired_Here(kActorMcCoy, 72, 18, 1, -1);
Game_Flag_Set(422);
@@ -90,7 +90,7 @@ bool SceneScriptKP03::ClickedOn3DObject(const char *objectName, bool a2) {
Game_Flag_Set(484);
Game_Flag_Reset(421);
Scene_Loop_Set_Default(7);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Actor_Voice_Over(1110, kActorVoiceOver);
Actor_Voice_Over(1120, kActorVoiceOver);
} else {
@@ -178,7 +178,7 @@ void SceneScriptKP03::SceneFrameAdvanced(int frame) {
}
if (v1 != -1) {
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
Game_Flag_Set(422);
Game_Flag_Reset(421);
Unclickable_Object("BRACK MID");
@@ -244,7 +244,7 @@ void SceneScriptKP03::sub_401E54() {
Game_Flag_Set(484);
Game_Flag_Reset(421);
Scene_Loop_Set_Default(7);
- Scene_Loop_Start_Special(2, 7, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 7, false);
Actor_Set_Goal_Number(kActorSteele, 413);
Actor_Says(kActorMcCoy, 2195, 14);
Ambient_Sounds_Play_Sound(151, 40, -60, -60, 0);
diff --git a/engines/bladerunner/script/scene/ma01.cpp b/engines/bladerunner/script/scene/ma01.cpp
index 55fe935d74..f4963143e5 100644
--- a/engines/bladerunner/script/scene/ma01.cpp
+++ b/engines/bladerunner/script/scene/ma01.cpp
@@ -26,14 +26,14 @@ namespace BladeRunner {
void SceneScriptMA01::InitializeScene() {
Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992);
- if (Game_Flag_Query(250)) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992);
}
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Setup_Scene_Information(1446.0f, 0.0f, -725.0f, 660);
}
Scene_Exit_Add_2D_Exit(0, 328, 132, 426, 190, 0);
- if (Game_Flag_Query(250)) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
Scene_Exit_Add_2D_Exit(1, 234, 240, 398, 328, 2);
}
Ambient_Sounds_Add_Looping_Sound(101, 90, 0, 1);
@@ -44,13 +44,13 @@ void SceneScriptMA01::InitializeScene() {
Ambient_Sounds_Add_Sound(375, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(376, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(377, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Scene_Loop_Set_Default(1);
- Game_Flag_Reset(38);
+ Game_Flag_Reset(kFlagMA06toMA01);
} else {
Actor_Set_Invisible(kActorMcCoy, true);
Game_Flag_Set(273);
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
Scene_Loop_Set_Default(1);
}
if (Game_Flag_Query(409)) {
@@ -95,9 +95,9 @@ bool SceneScriptMA01::ClickedOnExit(int exitId) {
Scene_Exits_Disable();
}
} else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 1446.0f, 0.0f, -725.0f, 12, 1, false, 0)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
- Game_Flag_Set(37);
+ Game_Flag_Set(kFlagMA01toMA06);
Set_Enter(52, 52);
}
return true;
@@ -114,71 +114,71 @@ bool SceneScriptMA01::ClickedOnExit(int exitId) {
Game_Flag_Reset(177);
Game_Flag_Reset(258);
Game_Flag_Reset(178);
- int spinnerDest = Spinner_Interface_Choose_Dest(3, 0);
+ int spinnerDest = Spinner_Interface_Choose_Dest(3, false);
switch (spinnerDest) {
- case 0:
+ case kSpinnerDestinationPoliceStation:
Game_Flag_Set(178);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(251);
Set_Enter(61, 65);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 2:
+ case kSpinnerDestinationRuncitersAnimals:
Game_Flag_Set(182);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(249);
Set_Enter(69, 78);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 3:
+ case kSpinnerDestinationChinatown:
Game_Flag_Set(176);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(248);
Set_Enter(4, 13);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 5:
+ case kSpinnerDestinationTyrellBuilding:
Game_Flag_Set(261);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(307);
Set_Enter(17, 82);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 4:
+ case kSpinnerDestinationAnimoidRow:
Game_Flag_Set(180);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(252);
Set_Enter(0, 0);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 6:
+ case kSpinnerDestinationDNARow:
Game_Flag_Set(177);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(253);
Set_Enter(7, 25);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 7:
+ case kSpinnerDestinationBradburyBuilding:
Game_Flag_Set(258);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(254);
Set_Enter(20, 2);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 8:
+ case kSpinnerDestinationNightclubRow:
Game_Flag_Set(181);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(255);
Set_Enter(54, 54);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 9:
+ case kSpinnerDestinationHysteriaHall:
Game_Flag_Set(257);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(256);
Set_Enter(37, 34);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
default:
Actor_Set_Invisible(kActorMcCoy, false);
diff --git a/engines/bladerunner/script/scene/ma02.cpp b/engines/bladerunner/script/scene/ma02.cpp
index 65f88b85eb..add20cbcdf 100644
--- a/engines/bladerunner/script/scene/ma02.cpp
+++ b/engines/bladerunner/script/scene/ma02.cpp
@@ -25,7 +25,7 @@
namespace BladeRunner {
void SceneScriptMA02::InitializeScene() {
- if (Game_Flag_Query(36)) {
+ if (Game_Flag_Query(kFlagMA04ToMA02)) {
Setup_Scene_Information(-172.0f, -144.13f, 6.27f, 500);
} else {
Setup_Scene_Information(23.19f, -144.12f, 378.27f, 750);
@@ -92,7 +92,7 @@ bool SceneScriptMA02::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Voice_Over(1180, kActorVoiceOver);
Actor_Voice_Over(1190, kActorVoiceOver);
Actor_Voice_Over(1200, kActorVoiceOver);
- Actor_Clue_Acquire(kActorMcCoy, kClueCrystalsCigarette, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kClueCrystalsCigarette, true, -1);
} else {
Actor_Says(kActorMcCoy, 8526, 0);
}
@@ -102,7 +102,7 @@ bool SceneScriptMA02::ClickedOn3DObject(const char *objectName, bool a2) {
}
bool SceneScriptMA02::ClickedOnActor(int actorId) {
- if (actorId == 66 && Actor_Query_Goal_Number(kActorMaggie) == 599) {
+ if (actorId == kActorMaggie && Actor_Query_Goal_Number(kActorMaggie) == 599) {
if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorMaggie, 30, 1, false)) {
Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
Actor_Voice_Over(1140, kActorVoiceOver);
@@ -119,14 +119,14 @@ bool SceneScriptMA02::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 23.19f, -144.12f, 378.27f, 0, 1, false, 0)) {
Music_Stop(10);
- Game_Flag_Set(33);
+ Game_Flag_Set(kFlagMA02toMA06);
Set_Enter(52, 52);
}
return true;
}
if (exitId == 1) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -168.0f, -144.13f, 10.27f, 0, 1, false, 0)) {
- Game_Flag_Set(35);
+ Game_Flag_Set(kFlagMA02ToMA04);
Set_Enter(50, 50);
}
return true;
@@ -145,10 +145,10 @@ void SceneScriptMA02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo
}
void SceneScriptMA02::PlayerWalkedIn() {
- if (Game_Flag_Query(34)) {
+ if (Game_Flag_Query(kFlagMA06ToMA02)) {
sub_402044();
}
- if (Game_Flag_Query(36)) {
+ if (Game_Flag_Query(kFlagMA04ToMA02)) {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -148.12f, -144.13f, 34.27f, 0, 1, false, 0);
}
if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(655)) {
@@ -156,7 +156,7 @@ void SceneScriptMA02::PlayerWalkedIn() {
Game_Flag_Set(655);
sub_401E4C();
Loop_Actor_Walk_To_XYZ(kActorMcCoy, 23.19f, -144.12f, 378.27f, 0, 0, false, 0);
- Game_Flag_Set(33);
+ Game_Flag_Set(kFlagMA02toMA06);
Set_Enter(52, 52);
// return true;
return;
@@ -171,7 +171,7 @@ void SceneScriptMA02::PlayerWalkedIn() {
Game_Flag_Set(654);
Autosave_Game(3);
}
- if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(36) && Actor_Query_Goal_Number(kActorMaggie) != 2) {
+ if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(kFlagMA04ToMA02) && Actor_Query_Goal_Number(kActorMaggie) != 2) {
Actor_Set_Goal_Number(kActorMaggie, 1);
if (!Game_Flag_Query(60)) {
Game_Flag_Set(60);
@@ -187,14 +187,14 @@ void SceneScriptMA02::PlayerWalkedIn() {
}
}
}
- Game_Flag_Reset(36);
- Game_Flag_Reset(34);
+ Game_Flag_Reset(kFlagMA04ToMA02);
+ Game_Flag_Reset(kFlagMA06ToMA02);
//return false;
return;
}
void SceneScriptMA02::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
}
@@ -225,41 +225,24 @@ bool SceneScriptMA02::sub_401F7C() {
}
void SceneScriptMA02::sub_402044() {
- // int v0;
- // int v1;
- // int v3[7];
-
- // v0 = 0;
-
int i = 0;
int arr[7];
if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) {
- // v0 = 1;
- // v3[0] = 0;
arr[i++] = 0;
}
-
- // v1 = v0 + 1;
- // v3[v0] = 1;
arr[i++] = 1;
if (Global_Variable_Query(1) >= 3) {
- // v3[v1] = 2;
- // v1 = v0 + 2;
arr[i++] = 2;
}
if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) {
- // v3[v1++] = 3;
arr[i++] = 3;
}
if (Game_Flag_Query(171) && Game_Flag_Query(170)) {
- // v3[v1++] = 4;
arr[i++] = 4;
}
- //if (v1 <= 0) {
if (i == 0) {
Global_Variable_Set(52, -1);
} else {
- // Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]);
Global_Variable_Set(52, arr[Random_Query(0, i - 1)]);
}
}
diff --git a/engines/bladerunner/script/scene/ma04.cpp b/engines/bladerunner/script/scene/ma04.cpp
index b0b6735d17..a7725f95e3 100644
--- a/engines/bladerunner/script/scene/ma04.cpp
+++ b/engines/bladerunner/script/scene/ma04.cpp
@@ -25,16 +25,16 @@
namespace BladeRunner {
void SceneScriptMA04::InitializeScene() {
- if (Game_Flag_Query(63)) {
+ if (Game_Flag_Query(kFlagMA05toMA04)) {
Setup_Scene_Information(-7199.0f, 953.97f, 1579.0f, 502);
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
} else if (Game_Flag_Query(35)) {
Setup_Scene_Information(-7099.0f, 954.0f, 1866.0f, 502);
} else if (Game_Flag_Query(647)) {
Setup_Scene_Information(-7107.0f, 954.0f, 1742.0f, 502);
- Scene_Loop_Start_Special(0, 4, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 4, false);
} else {
Setup_Scene_Information(-7143.0f, 954.0f, 1868.0f, 733);
}
@@ -80,7 +80,7 @@ bool SceneScriptMA04::MouseClick(int x, int y) {
bool SceneScriptMA04::ClickedOn3DObject(const char *objectName, bool a2) {
if (Object_Query_Click("BED-SHEETS", objectName)) {
- sub_403DA8();
+ sleep();
return false;
}
if (Object_Query_Click("BED-TV-1", objectName) || Object_Query_Click("BED-TV-2", objectName)) {
@@ -89,7 +89,7 @@ bool SceneScriptMA04::ClickedOn3DObject(const char *objectName, bool a2) {
Unclickable_Object("BED-TV-1");
Unclickable_Object("BED-TV-2");
Sound_Play(132, 100, 0, 0, 50);
- sub_403864();
+ turnOnTV();
return false;
}
return true;
@@ -108,7 +108,7 @@ bool SceneScriptMA04::ClickedOnItem(int itemId, bool a2) {
bool SceneScriptMA04::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7099.0f, 954.0f, 1866.0f, 0, 1, false, 0)) {
- Game_Flag_Set(36);
+ Game_Flag_Set(kFlagMA04ToMA02);
Set_Enter(10, 49);
}
return true;
@@ -121,7 +121,7 @@ bool SceneScriptMA04::ClickedOnExit(int exitId) {
Overlay_Remove("MA04OVER");
}
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 955.0f, 1675.0f, 0, 0, false, 1);
- Game_Flag_Set(62);
+ Game_Flag_Set(kFlagMA04toMA05);
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
Async_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1568.0f, 0, false);
}
@@ -145,7 +145,7 @@ bool SceneScriptMA04::ClickedOn2DRegion(int region) {
return false;
}
if (region == 1) {
- sub_403DA8();
+ sleep();
return true;
}
if (region == 0) {
@@ -243,7 +243,7 @@ void SceneScriptMA04::PlayerWalkedIn() {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7143.0f, 954.0f, 1868.0f, 0, 1, false, 0);
}
Game_Flag_Reset(35);
- Game_Flag_Reset(63);
+ Game_Flag_Reset(kFlagMA05toMA04);
Game_Flag_Reset(647);
if (Game_Flag_Query(61)) {
if (Global_Variable_Query(1) == 2 && !Actor_Clue_Query(kActorMcCoy, kCluePhoneCallGuzza)) {
@@ -265,9 +265,9 @@ void SceneScriptMA04::PlayerWalkedIn() {
Actor_Says(kActorGuzza, 60, 3);
Actor_Says(kActorGuzza, 70, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallGuzza, 1, kActorGuzza);
- Spinner_Set_Selectable_Destination_Flag(5, 1);
- Game_Flag_Set(186);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallGuzza, false, kActorGuzza);
+ Spinner_Set_Selectable_Destination_Flag(kSpinnerDestinationTyrellBuilding, true);
+ Game_Flag_Set(kFlagRC01PoliceDone);
if (!Game_Flag_Query(163)) {
Game_Flag_Set(163);
Item_Remove_From_World(66);
@@ -295,10 +295,10 @@ void SceneScriptMA04::PlayerWalkedIn() {
}
void SceneScriptMA04::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
if (Game_Flag_Query(678)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(1, 0, -1);
Game_Flag_Reset(678);
@@ -368,7 +368,7 @@ void SceneScriptMA04::sub_4028A8() {
Actor_Says(kActorMcCoy, 2525, 15);
Actor_Says(kActorDektora, 420, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora1, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora1, true, -1);
} else {
Actor_Says_With_Pause(kActorMcCoy, 2505, 0.5f, 19);
Actor_Says(kActorDektora, 430, 3);
@@ -382,7 +382,7 @@ void SceneScriptMA04::sub_4028A8() {
Actor_Says(kActorDektora, 490, 3);
Sound_Play(123, 100, 0, 0, 50);
Actor_Says(kActorMcCoy, 2540, 15);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora2, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora2, true, -1);
}
}
@@ -403,7 +403,7 @@ void SceneScriptMA04::sub_402F2C() {
if (!Game_Flag_Query(378)) {
Actor_Says(kActorLucy, 640, 3);
}
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy2, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy2, true, -1);
} else {
Actor_Says(kActorLucy, 590, 3);
Actor_Says(kActorMcCoy, 2565, 12);
@@ -416,7 +416,7 @@ void SceneScriptMA04::sub_402F2C() {
if (!Game_Flag_Query(378)) {
Actor_Says(kActorLucy, 640, 3);
}
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy1, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy1, true, -1);
}
Sound_Play(123, 100, 0, 0, 50);
}
@@ -439,7 +439,7 @@ void SceneScriptMA04::sub_4032A0() {
Actor_Says(kActorSteele, 810, 3);
Actor_Says(kActorSteele, 820, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallCrystal, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallCrystal, true, -1);
}
void SceneScriptMA04::sub_4034D8() {
@@ -471,10 +471,10 @@ void SceneScriptMA04::sub_4034D8() {
Actor_Says(kActorClovis, 530, 3);
Actor_Says(kActorClovis, 540, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallClovis, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallClovis, true, -1);
}
-void SceneScriptMA04::sub_403864() {
+void SceneScriptMA04::turnOnTV() {
Overlay_Play("MA04OVR2", 0, 1, 0, 0);
switch (Global_Variable_Query(52)) {
case 4:
@@ -533,7 +533,7 @@ void SceneScriptMA04::sub_403864() {
}
}
-void SceneScriptMA04::sub_403DA8() {
+void SceneScriptMA04::sleep() {
if (!Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BED-SHEETS", 12, true, false)) {
Actor_Says(kActorMcCoy, 8530, 12);
Music_Stop(4);
@@ -558,7 +558,7 @@ void SceneScriptMA04::sub_403DA8() {
} else {
Set_Enter(10, 50);
}
- Scene_Loop_Start_Special(1, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, false);
}
}
diff --git a/engines/bladerunner/script/scene/ma05.cpp b/engines/bladerunner/script/scene/ma05.cpp
index fabe053bd4..51ae26a7b4 100644
--- a/engines/bladerunner/script/scene/ma05.cpp
+++ b/engines/bladerunner/script/scene/ma05.cpp
@@ -47,7 +47,7 @@ void SceneScriptMA05::InitializeScene() {
Ambient_Sounds_Add_Sound(403, 3, 3, 32, 32, 100, 100, -101, -101, 0, 0);
}
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
Scene_Loop_Set_Default(1);
}
@@ -78,8 +78,8 @@ bool SceneScriptMA05::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0)) {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0);
- Game_Flag_Set(63);
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Game_Flag_Set(kFlagMA05toMA04);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Async_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 953.97f, 1685.0f, 0, false);
Set_Enter(50, 50);
@@ -97,7 +97,7 @@ void SceneScriptMA05::SceneFrameAdvanced(int frame) {
if (frame == 20) {
Sound_Play(102, 70, -100, 100, 50);
}
- //return true;
+ //return true;
}
void SceneScriptMA05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
@@ -107,7 +107,7 @@ void SceneScriptMA05::PlayerWalkedIn() {
Music_Play(2, 52, 0, 2, -1, 0, 0);
if ((Random_Query(0, 4) == 1 || (Game_Flag_Query(146) == 1 && !Game_Flag_Query(61))) && Global_Variable_Query(1) == 1) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, true);
Sound_Play(69, 100, 0, 0, 50);
}
if (Game_Flag_Query(146) && !Game_Flag_Query(61)) {
diff --git a/engines/bladerunner/script/scene/ma06.cpp b/engines/bladerunner/script/scene/ma06.cpp
index 42845ecd8f..e545e291b3 100644
--- a/engines/bladerunner/script/scene/ma06.cpp
+++ b/engines/bladerunner/script/scene/ma06.cpp
@@ -28,7 +28,7 @@ void SceneScriptMA06::InitializeScene() {
Setup_Scene_Information(40.0f, 1.0f, -20.0f, 400);
Ambient_Sounds_Add_Looping_Sound(210, 50, 0, 1);
Ambient_Sounds_Add_Looping_Sound(408, 33, 0, 1);
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
Scene_Loop_Set_Default(1);
Sound_Play(209, 100, 50, 50, 100);
}
@@ -73,28 +73,29 @@ void SceneScriptMA06::PlayerWalkedIn() {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, 40.0f, 1.35f, 0.0f, 0, 0, false, 0);
Actor_Face_Object(kActorMcCoy, "panel", true);
Delay(500);
- sub_4014E4();
- if (sub_4012C0()) {
+ activateElevator();
+ if (isElevatorOnDifferentFloor()) {
Sound_Play(114, 25, 0, 0, 50);
Delay(4000);
}
- Game_Flag_Reset(37);
- Game_Flag_Reset(33);
- Game_Flag_Reset(57);
- if (Game_Flag_Query(38)) {
+ Game_Flag_Reset(kFlagMA01toMA06);
+ Game_Flag_Reset(kFlagMA02toMA06);
+ Game_Flag_Reset(kFlagMA07toMA06);
+
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Set_Enter(49, 48);
- } else if (Game_Flag_Query(34)) {
+ } else if (Game_Flag_Query(kFlagMA06ToMA02)) {
Set_Enter(10, 49);
- } else {
+ } else { // kFlagMA06ToMA07
Set_Enter(53, 53);
}
- Scene_Loop_Start_Special(1, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
Sound_Play(208, 100, 50, 50, 50);
//return true;
}
void SceneScriptMA06::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Player_Gains_Control();
}
@@ -102,34 +103,36 @@ void SceneScriptMA06::PlayerWalkedOut() {
void SceneScriptMA06::DialogueQueueFlushed(int a1) {
}
-bool SceneScriptMA06::sub_4012C0() {
- return (Game_Flag_Query(37) && !Game_Flag_Query(38)) || (Game_Flag_Query(33) && !Game_Flag_Query(34)) || (Game_Flag_Query(57) && !Game_Flag_Query(58));
+bool SceneScriptMA06::isElevatorOnDifferentFloor() {
+ return (Game_Flag_Query(kFlagMA01toMA06) && !Game_Flag_Query(kFlagMA06toMA01))
+ || (Game_Flag_Query(kFlagMA02toMA06) && !Game_Flag_Query(kFlagMA06ToMA02))
+ || (Game_Flag_Query(kFlagMA07toMA06) && !Game_Flag_Query(kFlagMA06toMA07));
}
-void SceneScriptMA06::sub_4014E4() {
- Game_Flag_Reset(38);
- Game_Flag_Reset(34);
- Game_Flag_Reset(58);
+void SceneScriptMA06::activateElevator() {
+ Game_Flag_Reset(kFlagMA06toMA01);
+ Game_Flag_Reset(kFlagMA06ToMA02);
+ Game_Flag_Reset(kFlagMA06toMA07);
while (true) {
- if (Game_Flag_Query(34)) {
+ if (Game_Flag_Query(kFlagMA06ToMA02)) {
break;
}
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
break;
}
- if (Game_Flag_Query(58)) {
+ if (Game_Flag_Query(kFlagMA06toMA07)) {
break;
}
Actor_Says(kActorAnsweringMachine, 80, 3);
Player_Gains_Control();
- int v1 = Elevator_Activate(1);
+ int floor = Elevator_Activate(1);
Player_Loses_Control();
- Scene_Loop_Start_Special(2, 1, 1);
- if (v1 > 1) {
- Game_Flag_Set(58);
- } else if (v1 == 1) {
- if (Game_Flag_Query(250)) {
- Game_Flag_Set(38);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 1, true);
+ if (floor > 1) {
+ Game_Flag_Set(kFlagMA06toMA07);
+ } else if (floor == 1) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
+ Game_Flag_Set(kFlagMA06toMA01);
} else {
Sound_Play(412, 100, 0, 0, 50);
Delay(500);
@@ -144,7 +147,7 @@ void SceneScriptMA06::sub_4014E4() {
Delay(500);
Actor_Says(kActorMcCoy, 8527, 3);
} else {
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Actor_Says(kActorAnsweringMachine, 90, 3);
}
}
diff --git a/engines/bladerunner/script/scene/ma07.cpp b/engines/bladerunner/script/scene/ma07.cpp
index 59d1593012..aa87a37721 100644
--- a/engines/bladerunner/script/scene/ma07.cpp
+++ b/engines/bladerunner/script/scene/ma07.cpp
@@ -76,9 +76,9 @@ bool SceneScriptMA07::ClickedOnExit(int exitId) {
if (Global_Variable_Query(1) == 4 && Game_Flag_Query(671)) {
Actor_Set_Goal_Number(kActorMcCoy, 400);
} else {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
- Game_Flag_Set(57);
+ Game_Flag_Set(kFlagMA07toMA06);
Set_Enter(52, 52);
}
}
@@ -86,7 +86,7 @@ bool SceneScriptMA07::ClickedOnExit(int exitId) {
}
if (exitId == 1) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -400.0f, -162.8f, 185.08f, 0, 1, false, 0)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Game_Flag_Set(672);
Game_Flag_Reset(179);
@@ -143,7 +143,7 @@ void SceneScriptMA07::PlayerWalkedIn() {
Actor_Voice_Over(1400, kActorVoiceOver);
Delay(1000);
Game_Flag_Reset(666);
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Set_Enter(10, 49);
}
//return false;
diff --git a/engines/bladerunner/script/scene/nr08.cpp b/engines/bladerunner/script/scene/nr08.cpp
index 15d5be7451..70b8542173 100644
--- a/engines/bladerunner/script/scene/nr08.cpp
+++ b/engines/bladerunner/script/scene/nr08.cpp
@@ -150,7 +150,7 @@ void SceneScriptNR08::SceneFrameAdvanced(int frame) {
Game_Flag_Set(636);
Scene_Exits_Disable();
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, true);
}
if (frame == 95) {
Actor_Put_In_Set(kActorDektora, 91);
diff --git a/engines/bladerunner/script/scene/nr10.cpp b/engines/bladerunner/script/scene/nr10.cpp
index 77f3cab3f6..8c07ac47a1 100644
--- a/engines/bladerunner/script/scene/nr10.cpp
+++ b/engines/bladerunner/script/scene/nr10.cpp
@@ -71,7 +71,7 @@ bool SceneScriptNR10::ClickedOn3DObject(const char *objectName, bool a2) {
Ambient_Sounds_Remove_Looping_Sound(452, true);
Sound_Play(453, 52, 0, 0, 50);
Scene_Loop_Set_Default(0);
- Scene_Loop_Start_Special(2, 0, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, true);
Un_Combat_Target_Object("BOX18");
Scene_Exits_Enable();
return true;
diff --git a/engines/bladerunner/script/scene/nr11.cpp b/engines/bladerunner/script/scene/nr11.cpp
index c194f5a17a..8c282d3387 100644
--- a/engines/bladerunner/script/scene/nr11.cpp
+++ b/engines/bladerunner/script/scene/nr11.cpp
@@ -122,7 +122,7 @@ bool SceneScriptNR11::ClickedOn3DObject(const char *objectName, bool a2) {
}
Actor_Set_Goal_Number(kActorMcCoy, 230);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
} else if (Actor_Query_Goal_Number(kActorDektora) == 250) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 24.0f, 0.33f, 0.0f, 0, 1, false, 0)) {
Actor_Face_XYZ(kActorMcCoy, -180.0f, 0.0f, -170.0f, true);
@@ -260,7 +260,7 @@ void SceneScriptNR11::SceneFrameAdvanced(int frame) {
}
Actor_Set_Goal_Number(kActorMcCoy, 230);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Reset(635);
} else {
if (frame < 61 || frame > 120) {
diff --git a/engines/bladerunner/script/scene/ps05.cpp b/engines/bladerunner/script/scene/ps05.cpp
index 656550e864..32eb5d5b46 100644
--- a/engines/bladerunner/script/scene/ps05.cpp
+++ b/engines/bladerunner/script/scene/ps05.cpp
@@ -162,31 +162,26 @@ void SceneScriptPS05::DialogueQueueFlushed(int a1) {
}
void SceneScriptPS05::sub_401B34() {
- int v0;
- int v1;
- int v3[7];
-
- v0 = 0;
+ int i = 0;
+ int arr[7];
if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) {
- v0 = 1;
- v3[0] = 0;
+ arr[i++] = 0;
}
- v1 = v0 + 1;
- v3[v0] = 1;
+ arr[i++] = 1;
if (Global_Variable_Query(1) >= 3) {
- v3[v1] = 2;
- v1 = v0 + 2;
+ arr[i++] = 2;
}
if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) {
- v3[v1++] = 3;
+ arr[i++] = 3;
}
if (Game_Flag_Query(171) && Game_Flag_Query(170)) {
- v3[v1++] = 4;
+ arr[i++] = 4;
}
- if (v1 <= 0) {
+ if (i == 0) {
Global_Variable_Set(52, -1);
- } else {
- Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]);
+ }
+ else {
+ Global_Variable_Set(52, arr[Random_Query(0, i - 1)]);
}
}
diff --git a/engines/bladerunner/script/scene/rc01.cpp b/engines/bladerunner/script/scene/rc01.cpp
index 642f4c7bb0..8a5b728c86 100644
--- a/engines/bladerunner/script/scene/rc01.cpp
+++ b/engines/bladerunner/script/scene/rc01.cpp
@@ -27,11 +27,11 @@ namespace BladeRunner {
void SceneScriptRC01::InitializeScene() {
#if _DEBUG
//TODO: not part of game, remove
- //Game_Flag_Set(24); // force skip intro
+ //Game_Flag_Set(kFlagIntroPlayed); // force skip intro
#endif
- if (!Game_Flag_Query(24)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ if (!Game_Flag_Query(kFlagIntroPlayed)) {
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(28, 1, -1); // WSTLGO_E.VQA
Outtake_Play(41, 1, -1); // BRLOGO_E.VQA
@@ -52,14 +52,14 @@ void SceneScriptRC01::InitializeScene() {
if (Global_Variable_Query(1) > 1 && Game_Flag_Query(710)) {
Scene_Exit_Add_2D_Exit(2, 0, 0, 10, 479, 3);
}
- if (!Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
Scene_2D_Region_Add(0, 0, 294, 296, 479);
}
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(0);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(false);
Ambient_Sounds_Add_Looping_Sound(54, 30, 0, 1); // CTRAIN1.AUD
- if (!Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0470R.AUD
Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0480R.AUD
Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0500R.AUD
@@ -83,9 +83,9 @@ void SceneScriptRC01::InitializeScene() {
Ambient_Sounds_Add_Sound(67, 10, 50, 30, 50, -100, 100, -101, -101, 0, 0); // SPIN2A.AUD
Ambient_Sounds_Add_Sound(87, 20, 80, 20, 40, -100, 100, -101, -101, 0, 0); // SIREN2.AUD
- if (Game_Flag_Query(186)) {
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- Scene_Loop_Start_Special(0, 5, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 5, false);
}
if (Game_Flag_Query(249)) {
Scene_Loop_Set_Default(6);
@@ -94,7 +94,7 @@ void SceneScriptRC01::InitializeScene() {
}
} else {
if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
Scene_Loop_Set_Default(1);
}
@@ -148,7 +148,7 @@ void SceneScriptRC01::SceneLoaded() {
Unclickable_Object("DOORWAY01");
Unobstacle_Object("DOORWAY01", true);
- if (Game_Flag_Query(186)) {
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
Unclickable_Object("70_1");
Unclickable_Object("70_2");
Unclickable_Object("70_3");
@@ -169,7 +169,7 @@ void SceneScriptRC01::SceneLoaded() {
Unobstacle_Object("BARICADE05", true);
}
- if (!Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
Preload(13);
Preload(14);
Preload(19);
@@ -181,7 +181,7 @@ void SceneScriptRC01::SceneLoaded() {
Item_Add_To_World(66, 938, 69, -148.60f, -0.30f, 225.15f, 256, 24, 24, false, true, false, true);
}
- if (!Game_Flag_Query(24)) {
+ if (!Game_Flag_Query(kFlagIntroPlayed)) {
ADQ_Flush();
Actor_Voice_Over(1830, kActorVoiceOver);
Actor_Voice_Over(1850, kActorVoiceOver);
@@ -190,7 +190,7 @@ void SceneScriptRC01::SceneLoaded() {
I_Sez("MG: Is David Leary a self-respecting human or is he powered by rechargeable");
I_Sez("batteries?\n");
}
- Game_Flag_Set(24);
+ Game_Flag_Set(kFlagIntroPlayed);
}
}
@@ -343,7 +343,7 @@ bool SceneScriptRC01::ClickedOnItem(int itemId, bool a2) {
}
-void SceneScriptRC01::sub_4037AC() {
+void SceneScriptRC01::walkToCenter() {
Player_Loses_Control();
Game_Flag_Set(182);
Actor_Set_Immunity_To_Obstacles(kActorMcCoy, true);
@@ -378,7 +378,7 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
}
if (exitId == 1) {
if (Game_Flag_Query(486)) {
- Spinner_Set_Selectable_Destination_Flag(6, 1);
+ Spinner_Set_Selectable_Destination_Flag(kSpinnerDestinationDNARow, true);
}
I_Sez("MG: Leaving already? The fun is just beginning!");
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -151.98f, -0.3f, 318.15f, 0, 1, false, 0)) {
@@ -400,115 +400,115 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
Game_Flag_Reset(179);
Game_Flag_Reset(178);
int spinnerDest;
- if (Game_Flag_Query(186)) {
- spinnerDest = Spinner_Interface_Choose_Dest(8, 1);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ spinnerDest = Spinner_Interface_Choose_Dest(kSpinnerDestinationNightclubRow, true);
} else {
- spinnerDest = Spinner_Interface_Choose_Dest(3, 1);
+ spinnerDest = Spinner_Interface_Choose_Dest(kSpinnerDestinationChinatown, true);
}
- if (spinnerDest) {
- switch (spinnerDest) {
- case 1:
- Game_Flag_Set(179);
- Game_Flag_Reset(249);
- Game_Flag_Set(250);
- Set_Enter(49, 48);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 3:
- Game_Flag_Set(176);
- Game_Flag_Reset(249);
- Game_Flag_Set(248);
- Set_Enter(4, 13);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 5:
- Game_Flag_Set(261);
- Game_Flag_Reset(249);
- Game_Flag_Set(307);
- Set_Enter(17, 82);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 4:
- Game_Flag_Set(180);
- Game_Flag_Reset(249);
- Game_Flag_Set(252);
- Set_Enter(0, 0);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 6:
- Game_Flag_Set(177);
- Game_Flag_Reset(249);
- Game_Flag_Set(253);
- Set_Enter(7, 25);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 7:
- Game_Flag_Set(258);
- Game_Flag_Reset(249);
- Game_Flag_Set(254);
- Set_Enter(20, 2);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 8:
- Game_Flag_Set(181);
- Game_Flag_Reset(249);
- Game_Flag_Set(255);
- Set_Enter(54, 54);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 9:
- Game_Flag_Set(257);
- Game_Flag_Reset(249);
- Game_Flag_Set(256);
- Set_Enter(37, 34);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- default:
- sub_4037AC();
- break;
- }
- } else {
+
+ switch (spinnerDest) {
+ case kSpinnerDestinationPoliceStation:
Game_Flag_Set(178);
Game_Flag_Reset(249);
Game_Flag_Set(251);
Set_Enter(61, 65);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationMcCoysApartment:
+ Game_Flag_Set(179);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(250);
+ Set_Enter(49, 48);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationChinatown:
+ Game_Flag_Set(176);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(248);
+ Set_Enter(4, 13);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationTyrellBuilding:
+ Game_Flag_Set(261);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(307);
+ Set_Enter(17, 82);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationAnimoidRow:
+ Game_Flag_Set(180);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(252);
+ Set_Enter(0, 0);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationDNARow:
+ Game_Flag_Set(177);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(253);
+ Set_Enter(7, 25);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationBradburyBuilding:
+ Game_Flag_Set(258);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(254);
+ Set_Enter(20, 2);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationNightclubRow:
+ Game_Flag_Set(181);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(255);
+ Set_Enter(54, 54);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationHysteriaHall:
+ Game_Flag_Set(257);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(256);
+ Set_Enter(37, 34);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
} else {
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
}
+ break;
+ default:
+ walkToCenter();
+ break;
}
}
return true;
@@ -526,7 +526,7 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
}
void SceneScriptRC01::sub_403850() {
- if (!Game_Flag_Query(186) && !Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BARICADE03", 36, true, false)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone) && !Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BARICADE03", 36, true, false)) {
Actor_Set_Goal_Number(kActorOfficerLeary, 0);
Actor_Face_Object(kActorMcCoy, "BARICADE03", true);
Loop_Actor_Walk_To_Actor(kActorOfficerLeary, kActorMcCoy, 36, 1, false);
@@ -575,7 +575,7 @@ void SceneScriptRC01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo
void SceneScriptRC01::PlayerWalkedIn() {
if (Game_Flag_Query(249) && !Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- sub_4037AC();
+ walkToCenter();
}
if (Game_Flag_Query(114)) {
@@ -603,10 +603,10 @@ void SceneScriptRC01::PlayerWalkedIn() {
}
void SceneScriptRC01::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
if (!Game_Flag_Query(8) && !Game_Flag_Query(115) && Global_Variable_Query(1)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(31, 1, -1);
}
diff --git a/engines/bladerunner/script/scene/tb07.cpp b/engines/bladerunner/script/scene/tb07.cpp
index d296e90467..efd4fba197 100644
--- a/engines/bladerunner/script/scene/tb07.cpp
+++ b/engines/bladerunner/script/scene/tb07.cpp
@@ -254,7 +254,7 @@ void SceneScriptTB07::sub_401B0C() {
Actor_Set_At_XYZ(kActorTyrell, 68.0f, 12.0f, 288.0f, 0);
Actor_Change_Animation_Mode(kActorTyrell, 0);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, false);
Actor_Start_Speech_Sample(kActorTyrell, 0);
Loop_Actor_Walk_To_XYZ(kActorTyrell, 44.0f, 12.0f, 176.0f, 0, 0, false, 0);
Actor_Face_Actor(kActorTyrell, kActorMcCoy, true);
diff --git a/engines/bladerunner/script/scene/ug01.cpp b/engines/bladerunner/script/scene/ug01.cpp
index 96e3cf1533..91d0d63467 100644
--- a/engines/bladerunner/script/scene/ug01.cpp
+++ b/engines/bladerunner/script/scene/ug01.cpp
@@ -80,7 +80,7 @@ bool SceneScriptUG01::ClickedOn3DObject(const char *objectName, bool a2) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -9.0f, -50.13f, -148.0f, 0, 1, false, 0) && !Game_Flag_Query(324)) {
Actor_Says(kActorMcCoy, 8525, 13);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Set(324);
} else {
Actor_Says(kActorMcCoy, 8525, 13);
diff --git a/engines/bladerunner/script/scene/ug10.cpp b/engines/bladerunner/script/scene/ug10.cpp
index dfb616471f..1f07c6d828 100644
--- a/engines/bladerunner/script/scene/ug10.cpp
+++ b/engines/bladerunner/script/scene/ug10.cpp
@@ -74,7 +74,7 @@ void SceneScriptUG10::SceneLoaded() {
Obstacle_Object("SLUICEGATE_LEVER", true);
if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(474) && Game_Flag_Query(172) && !Game_Flag_Query(693)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Game_Flag_Set(693);
//return true;
}
@@ -158,13 +158,13 @@ bool SceneScriptUG10::ClickedOn2DRegion(int region) {
} else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 4.98f, 0.38f, 83.15f, 0, 1, false, 0)) {
if (Game_Flag_Query(474)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Game_Flag_Reset(474);
Obstacle_Object("BOX01 BRIDGE", true);
Player_Loses_Control();
} else {
Scene_Loop_Set_Default(4);
- Scene_Loop_Start_Special(2, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, false);
Game_Flag_Set(474);
Unobstacle_Object("BOX01 BRIDGE", true);
Player_Loses_Control();
diff --git a/engines/bladerunner/script/scene/ug13.cpp b/engines/bladerunner/script/scene/ug13.cpp
index 0188782316..f380f07ace 100644
--- a/engines/bladerunner/script/scene/ug13.cpp
+++ b/engines/bladerunner/script/scene/ug13.cpp
@@ -87,13 +87,13 @@ bool SceneScriptUG13::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Face_Object(kActorMcCoy, "BOLLARD", true);
if (Game_Flag_Query(431)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Game_Flag_Reset(431);
Game_Flag_Set(436);
return true;
} else {
Scene_Loop_Set_Default(4);
- Scene_Loop_Start_Special(2, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, false);
Game_Flag_Set(431);
Scene_Exit_Remove(0);
return true;
diff --git a/engines/bladerunner/script/scene/ug15.cpp b/engines/bladerunner/script/scene/ug15.cpp
index b866561367..6d0ae376e5 100644
--- a/engines/bladerunner/script/scene/ug15.cpp
+++ b/engines/bladerunner/script/scene/ug15.cpp
@@ -168,7 +168,7 @@ void SceneScriptUG15::SceneFrameAdvanced(int frame) {
Game_Flag_Set(724);
Game_Flag_Set(682);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Actor_Set_Goal_Number(kActorMcCoy, 390);
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
if (-200.0f < x && -62.0f > x) {
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 25d78e4991..aa3e23da52 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -38,6 +38,7 @@
#include "bladerunner/items.h"
#include "bladerunner/item_pickup.h"
#include "bladerunner/movement_track.h"
+#include "bladerunner/music.h"
#include "bladerunner/overlays.h"
#include "bladerunner/regions.h"
#include "bladerunner/set.h"
@@ -423,12 +424,14 @@ int ScriptBase::Actor_Query_Animation_Mode(int actorId) {
bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int distance, int a4, bool run) {
_vm->gameWaitForActive();
- if (actorId == _vm->_walkingActorId) {
+ if (_vm->_walkingActorId == actorId) {
run = true;
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToActor(otherActorId, distance, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle) {
result = true;
_vm->_playerActorIdle = false;
@@ -436,8 +439,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int dis
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
@@ -449,7 +452,9 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToItem(itemId, a3, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle == 1) {
result = true;
_vm->_playerActorIdle = false;
@@ -457,8 +462,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
@@ -470,7 +475,9 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToSceneObject(objectName, destinationOffset, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle) {
result = true;
_vm->_playerActorIdle = false;
@@ -478,52 +485,79 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int a4, bool run) {
- //TODO
- warning("Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, a4, run);
- return false;
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+ _vm->_playerActorIdle = false;
+ bool isRunning;
+
+ bool result = _vm->_actors[actorId]->loopWalkToWaypoint(waypointId, destinationOffset, a4, run, true, &isRunning);
+
+ if (_vm->_playerActorIdle) {
+ result = true;
+ _vm->_playerActorIdle = false;
+ }
+ if (isRunning == 1) {
+ _vm->_walkingActorId = actorId;
+ }
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
+ return result;
}
bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, int a5, bool run, int a7) {
_vm->gameWaitForActive();
- if(_vm->_walkingActorId == actorId) {
- if(a7) {
+ if (_vm->_walkingActorId == actorId) {
+ if (a7) {
_vm->_walkingActorId = -1;
} else {
run = true;
}
}
- //TODO:
- //PlayerActorIdle = 0;
+ _vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), destinationOffset, a5, run, true, &isRunning);
-// if (PlayerActorIdle == 1) {
-// result = 1;
-// PlayerActorIdle = 0;
-// }
- if(isRunning) {
+ if (_vm->_playerActorIdle) {
+ result = true;
+ _vm->_playerActorIdle = false;
+ }
+ if (isRunning) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int run) {
- //TODO
- warning("Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run);
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+
+ _vm->_actors[actorId]->asyncWalkToWaypoint(waypointId, destinationOffset, run, true);
}
void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) {
- //TODO
- warning("Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run);
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+
+ _vm->_actors[actorId]->asyncWalkToXYZ(Vector3(x, y, z), destinationOffset, run, true);
}
void ScriptBase::Actor_Force_Stop_Walking(int actorId) {
@@ -796,30 +830,25 @@ void ScriptBase::Footstep_Sound_Override_Off() {
_vm->_scene->_set->resetFoodstepSoundOverride();
}
-bool ScriptBase::Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7) {
- //TODO
- warning("Music_Play(%d, %d, %d, %d, %d, %d, %d)", a1, a2, a3, a4, a5, a6, a7);
- return false;
+bool ScriptBase::Music_Play(int musicId, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) {
+ const char *musicName = _vm->_gameInfo->getMusicTrack(musicId);
+ return _vm->_music->play(musicName, volume, pan, timeFadeIn, timePlay, loop, timeFadeOut);
}
-void ScriptBase::Music_Adjust(int a1, int a2, int a3) {
- //TODO
- warning("Music_Adjust(%d, %d, %d)", a1, a2, a3);
+void ScriptBase::Music_Adjust(int volume, int pan, int delay) {
+ _vm->_music->adjust(volume, pan, delay);
}
-void ScriptBase::Music_Stop(int a1) {
- //TODO
- warning("Music_Stop(%d)", a1);
+void ScriptBase::Music_Stop(int delay) {
+ _vm->_music->stop(delay);
}
bool ScriptBase::Music_Is_Playing() {
- //TODO
- warning("Music_Is_Playing()");
- return false;
+ return _vm->_music->isPlaying();
}
-void ScriptBase::Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5) {
- _vm->_overlays->play(overlay, a2, a3, a4, a5);
+void ScriptBase::Overlay_Play(const char *overlay, int loopId, int loopForever, int startNow, int a5) {
+ _vm->_overlays->play(overlay, loopId, loopForever, startNow, a5);
}
void ScriptBase::Overlay_Remove(const char *overlay) {
@@ -908,7 +937,7 @@ bool ScriptBase::Dialogue_Menu_Clear_List() {
}
bool ScriptBase::Dialogue_Menu_Add_To_List(int answer) {
- _vm->_dialogueMenu->addToList(answer, 0, 5, 5, 5);
+ _vm->_dialogueMenu->addToList(answer, false, 5, 5, 5);
return false;
}
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index c282bccd1d..48bda147d6 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -429,6 +429,34 @@ enum SpinnerDestinations {
kSpinnerDestinationHysteriaHall = 9
};
+enum Flags {
+ kFlagIntroPlayed = 24,
+ kFlagMA02toMA06 = 33,
+ kFlagMA06ToMA02 = 34,
+ kFlagMA02ToMA04 = 35,
+ kFlagMA04ToMA02 = 36,
+ kFlagMA01toMA06 = 37,
+ kFlagMA06toMA01 = 38,
+ kFlagMA07toMA06 = 57,
+ kFlagMA06toMA07 = 58,
+ kFlagMA04toMA05 = 62,
+ kFlagMA05toMA04 = 63,
+ kFlagRC01PoliceDone = 186,
+ kFlagMA01Locked = 250
+};
+
+enum Variables {
+ kVariableWalkLoopActor = 37,
+ kVariableWalkLoopRun = 38
+};
+
+enum Outtakes {
+ kOuttakeIntro = 0,
+ kOuttakeWestwood = 28,
+ kOuttakeDescent = 33,
+ kOuttakeBladeRunner = 41
+};
+
class BladeRunnerEngine;
class ScriptBase {
@@ -561,11 +589,11 @@ protected:
void Footstep_Sounds_Set(int index, int value);
void Footstep_Sound_Override_On(int footstepSoundOverride);
void Footstep_Sound_Override_Off();
- bool Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
- void Music_Adjust(int a1, int a2, int a3);
- void Music_Stop(int a1);
+ bool Music_Play(int musicId, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut);
+ void Music_Adjust(int volume, int pan, int delay);
+ void Music_Stop(int delay);
bool Music_Is_Playing();
- void Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5);
+ void Overlay_Play(const char *overlay, int loopId, int loopForever, int startNow, int a5);
void Overlay_Remove(const char *overlay);
void Scene_Loop_Set_Default(int loopId);
void Scene_Loop_Start_Special(int sceneLoopMode, int loopId, bool immediately);