aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorThanasis Antoniou2019-06-22 01:00:46 +0300
committerThanasis Antoniou2019-06-22 01:22:05 +0300
commit5c2489fd5488cc8dd9c74fae97d413678186a799 (patch)
tree1c895c8f187a6e7f5d850c19d37a7f1ad19d41de /engines/bladerunner
parent0ddfe927cec767631161a23d55b9c07fff925745 (diff)
downloadscummvm-rg350-5c2489fd5488cc8dd9c74fae97d413678186a799.tar.gz
scummvm-rg350-5c2489fd5488cc8dd9c74fae97d413678186a799.tar.bz2
scummvm-rg350-5c2489fd5488cc8dd9c74fae97d413678186a799.zip
BLADERUNNER: Improve fix possible collision with genwalkers
This is in CT01 (restored content). Uses kVariableGenericWalkerConfig which was previously largely unused.
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/game_constants.h9
-rw-r--r--engines/bladerunner/script/ai/generic_walker_a.cpp31
-rw-r--r--engines/bladerunner/script/ai/generic_walker_b.cpp24
-rw-r--r--engines/bladerunner/script/ai/generic_walker_c.cpp24
-rw-r--r--engines/bladerunner/script/scene/ct01.cpp14
-rw-r--r--engines/bladerunner/script/scene/ct12.cpp2
-rw-r--r--engines/bladerunner/script/scene/rc04.cpp2
7 files changed, 61 insertions, 45 deletions
diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index 5b7877fb1f..32d3d4f77a 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -1197,7 +1197,7 @@ enum Variables {
kVariableGenericWalkerAModel = 32,
kVariableGenericWalkerBModel = 33,
kVariableGenericWalkerCModel = 34,
- kVariableGenericWalkerConfig = 35, // has no use
+ kVariableGenericWalkerConfig = 35, // Re-purposed in restored cut content version - original: has no real use
kVariableBB10ShelvesAvailable = 36,
kVariableWalkLoopActor = 37,
kVariableWalkLoopRun = 38,
@@ -2347,6 +2347,13 @@ enum GoalBulletBob {
kGoalBulletBobGone = 99
};
+// applies to all generic walkers
+enum GoalGenericWalker {
+ kGoalGenwalkerDefault = 0, // setup walker model and path
+ kGoalGenwalkerMoving = 1,
+ kGoalGenwalkerABulletBobsTrackGun = 200 // only kActorGenWalkerA will change goal to this
+};
+
enum GoalRachael {
kGoalRachaelDefault = 0,
kGoalRachaelLeavesAfterTyrellMeeting = 200,
diff --git a/engines/bladerunner/script/ai/generic_walker_a.cpp b/engines/bladerunner/script/ai/generic_walker_a.cpp
index ddf566573b..57aa681e1c 100644
--- a/engines/bladerunner/script/ai/generic_walker_a.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_a.cpp
@@ -43,22 +43,22 @@ void AIScriptGenericWalkerA::Initialize() {
isInside = false;
deltaX = 0.0f;
deltaZ = 0.0f;
- Actor_Set_Goal_Number(kActorGenwalkerA, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
}
bool AIScriptGenericWalkerA::Update() {
switch (Actor_Query_Goal_Number(kActorGenwalkerA)) {
- case 0:
+ case kGoalGenwalkerDefault:
if (prepareWalker()) {
return true;
}
break;
- case 1:
+ case kGoalGenwalkerMoving:
if (deltaX != 0.0f || deltaZ != 0.0f) {
movingUpdate();
}
break;
- case 200: // Automatic gun at Bullet Bob
+ case kGoalGenwalkerABulletBobsTrackGun: // Automatic gun at Bullet Bob
Actor_Face_Actor(kActorGenwalkerA, kActorMcCoy, true);
break;
}
@@ -75,8 +75,8 @@ void AIScriptGenericWalkerA::TimerExpired(int timer) {
}
void AIScriptGenericWalkerA::CompletedMovementTrack() {
- if (Actor_Query_Goal_Number(kActorGenwalkerA) > 0) {
- Actor_Set_Goal_Number(kActorGenwalkerA, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerA) > kGoalGenwalkerDefault) {
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
if (!Game_Flag_Query(kFlagGenericWalkerWaiting)) {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerA, kActorTimerAIScriptCustomTask2);
@@ -93,7 +93,7 @@ void AIScriptGenericWalkerA::ReceivedClue(int clueId, int fromActorId) {
void AIScriptGenericWalkerA::ClickedByPlayer() {
Actor_Face_Actor(kActorMcCoy, kActorGenwalkerA, true);
- if (Actor_Query_Goal_Number(kActorGenwalkerA) == 200) {
+ if (Actor_Query_Goal_Number(kActorGenwalkerA) == kGoalGenwalkerABulletBobsTrackGun) {
Actor_Says(kActorMcCoy, 5290, 18); // kActorGenwalkerA here is actually the tracking gun in Bullet Bob's
} else {
switch (Random_Query(1, 10)) {
@@ -141,8 +141,8 @@ void AIScriptGenericWalkerA::OtherAgentEnteredThisScene(int otherActorId) {
}
void AIScriptGenericWalkerA::OtherAgentExitedThisScene(int otherActorId) {
- if (Actor_Query_Goal_Number(kActorGenwalkerA) && otherActorId == kActorMcCoy) {
- Actor_Set_Goal_Number(kActorGenwalkerA, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerA) > kGoalGenwalkerDefault && otherActorId == kActorMcCoy) {
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
}
//return false;
}
@@ -156,7 +156,7 @@ void AIScriptGenericWalkerA::ShotAtAndMissed() {
}
bool AIScriptGenericWalkerA::ShotAtAndHit() {
- if (Actor_Query_Goal_Number(kActorGenwalkerA)) {
+ if (Actor_Query_Goal_Number(kActorGenwalkerA) > kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerA);
_animationState = kGenericWalkerAStatesDie;
_animationFrame = 0;
@@ -176,14 +176,15 @@ int AIScriptGenericWalkerA::GetFriendlinessModifierIfGetsClue(int otherActorId,
}
bool AIScriptGenericWalkerA::GoalChanged(int currentGoalNumber, int newGoalNumber) {
- if (newGoalNumber == 0) {
+ if (newGoalNumber == kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerA);
Actor_Put_In_Set(kActorGenwalkerA, kSetFreeSlotH);
Global_Variable_Set(kVariableGenericWalkerAModel, -1);
return false;
- } else if (newGoalNumber == 1) {
+ } else if (newGoalNumber == kGoalGenwalkerMoving) {
return true;
- } else if (newGoalNumber == 200) {
+ } else if (newGoalNumber == kGoalGenwalkerABulletBobsTrackGun) {
+ // Bullet Bob's tracking gun
Actor_Put_In_Set(kActorGenwalkerA, kSetRC04);
Actor_Set_At_XYZ(kActorGenwalkerA, 0.0, 36.0, -172.0, 491);
Actor_Change_Animation_Mode(kActorGenwalkerA, kAnimationModeCombatIdle);
@@ -249,7 +250,7 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(874))
{
_animationFrame = 0;
- Actor_Set_Goal_Number(kActorGenwalkerA, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
_animationState = kGenericWalkerAStatesIdle;
deltaX = 0.0f;
deltaZ = 0.0f;
@@ -360,7 +361,7 @@ bool AIScriptGenericWalkerA::prepareWalker() {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerA, kActorTimerAIScriptCustomTask2);
AI_Countdown_Timer_Start(kActorGenwalkerA, kActorTimerAIScriptCustomTask2, Random_Query(4, 12));
- Actor_Set_Goal_Number(kActorGenwalkerA, 1);
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerMoving);
return true;
}
diff --git a/engines/bladerunner/script/ai/generic_walker_b.cpp b/engines/bladerunner/script/ai/generic_walker_b.cpp
index b4c37e8048..ebeb2d3606 100644
--- a/engines/bladerunner/script/ai/generic_walker_b.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_b.cpp
@@ -42,17 +42,17 @@ void AIScriptGenericWalkerB::Initialize() {
isInside = false;
deltaX = 0.0f;
deltaZ = 0.0f;
- Actor_Set_Goal_Number(kActorGenwalkerB, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
}
bool AIScriptGenericWalkerB::Update() {
switch (Actor_Query_Goal_Number(kActorGenwalkerB)) {
- case 0:
+ case kGoalGenwalkerDefault:
if (prepareWalker()) {
return true;
}
break;
- case 1:
+ case kGoalGenwalkerMoving:
if (deltaX != 0.0f || deltaZ != 0.0f) {
movingUpdate();
}
@@ -71,8 +71,8 @@ void AIScriptGenericWalkerB::TimerExpired(int timer) {
}
void AIScriptGenericWalkerB::CompletedMovementTrack() {
- if (Actor_Query_Goal_Number(kActorGenwalkerB) > 0) {
- Actor_Set_Goal_Number(kActorGenwalkerB, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerB) > kGoalGenwalkerDefault) {
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
if (!Game_Flag_Query(kFlagGenericWalkerWaiting)) {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerB, kActorTimerAIScriptCustomTask2);
@@ -133,8 +133,8 @@ void AIScriptGenericWalkerB::OtherAgentEnteredThisScene(int otherActorId) {
}
void AIScriptGenericWalkerB::OtherAgentExitedThisScene(int otherActorId) {
- if (Actor_Query_Goal_Number(kActorGenwalkerB) && otherActorId == kActorMcCoy) {
- Actor_Set_Goal_Number(kActorGenwalkerB, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerB) > kGoalGenwalkerDefault && otherActorId == kActorMcCoy) {
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
}
//return false;
}
@@ -148,7 +148,7 @@ void AIScriptGenericWalkerB::ShotAtAndMissed() {
}
bool AIScriptGenericWalkerB::ShotAtAndHit() {
- if (Actor_Query_Goal_Number(kActorGenwalkerB)) {
+ if (Actor_Query_Goal_Number(kActorGenwalkerB) > kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerB);
_animationState = kGenericWalkerBStatesDie;
_animationFrame = 0;
@@ -168,12 +168,12 @@ int AIScriptGenericWalkerB::GetFriendlinessModifierIfGetsClue(int otherActorId,
}
bool AIScriptGenericWalkerB::GoalChanged(int currentGoalNumber, int newGoalNumber) {
- if (newGoalNumber == 0) {
+ if (newGoalNumber == kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerB);
Actor_Put_In_Set(kActorGenwalkerB, kSetFreeSlotH);
Global_Variable_Set(kVariableGenericWalkerBModel, -1);
return false;
- } else if (newGoalNumber == 1) {
+ } else if (newGoalNumber == kGoalGenwalkerMoving) {
return true;
}
return false;
@@ -236,7 +236,7 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(874))
{
_animationFrame = 0;
- Actor_Set_Goal_Number(kActorGenwalkerB, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
_animationState = kGenericWalkerBStatesIdle;
deltaX = 0.0f;
deltaZ = 0.0f;
@@ -336,7 +336,7 @@ bool AIScriptGenericWalkerB::prepareWalker() {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerB, kActorTimerAIScriptCustomTask2);
AI_Countdown_Timer_Start(kActorGenwalkerB, kActorTimerAIScriptCustomTask2, Random_Query(4, 12));
- Actor_Set_Goal_Number(kActorGenwalkerB, 1);
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerMoving);
return true;
}
diff --git a/engines/bladerunner/script/ai/generic_walker_c.cpp b/engines/bladerunner/script/ai/generic_walker_c.cpp
index 80b1191c46..3bac200358 100644
--- a/engines/bladerunner/script/ai/generic_walker_c.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_c.cpp
@@ -43,17 +43,17 @@ void AIScriptGenericWalkerC::Initialize() {
isInside = false;
deltaX = 0.0f;
deltaZ = 0.0f;
- Actor_Set_Goal_Number(kActorGenwalkerC, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
}
bool AIScriptGenericWalkerC::Update() {
switch (Actor_Query_Goal_Number(kActorGenwalkerC)) {
- case 0:
+ case kGoalGenwalkerDefault:
if (prepareWalker()) {
return true;
}
break;
- case 1:
+ case kGoalGenwalkerMoving:
if (deltaX != 0.0f || deltaZ != 0.0f) {
movingUpdate();
}
@@ -72,8 +72,8 @@ void AIScriptGenericWalkerC::TimerExpired(int timer) {
}
void AIScriptGenericWalkerC::CompletedMovementTrack() {
- if (Actor_Query_Goal_Number(kActorGenwalkerC) > 0) {
- Actor_Set_Goal_Number(kActorGenwalkerC, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerC) > kGoalGenwalkerDefault) {
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
if (!Game_Flag_Query(kFlagGenericWalkerWaiting)) {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerC, kActorTimerAIScriptCustomTask2);
@@ -134,8 +134,8 @@ void AIScriptGenericWalkerC::OtherAgentEnteredThisScene(int otherActorId) {
}
void AIScriptGenericWalkerC::OtherAgentExitedThisScene(int otherActorId) {
- if (Actor_Query_Goal_Number(kActorGenwalkerC) && otherActorId == kActorMcCoy) {
- Actor_Set_Goal_Number(kActorGenwalkerC, 0);
+ if (Actor_Query_Goal_Number(kActorGenwalkerC) > kGoalGenwalkerDefault && otherActorId == kActorMcCoy) {
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
}
//return false;
}
@@ -149,7 +149,7 @@ void AIScriptGenericWalkerC::ShotAtAndMissed() {
}
bool AIScriptGenericWalkerC::ShotAtAndHit() {
- if (Actor_Query_Goal_Number(kActorGenwalkerC)) {
+ if (Actor_Query_Goal_Number(kActorGenwalkerC) > kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerC);
_animationState = kGenericWalkerCStatesDie;
_animationFrame = 0;
@@ -169,12 +169,12 @@ int AIScriptGenericWalkerC::GetFriendlinessModifierIfGetsClue(int otherActorId,
}
bool AIScriptGenericWalkerC::GoalChanged(int currentGoalNumber, int newGoalNumber) {
- if (newGoalNumber == 0) {
+ if (newGoalNumber == kGoalGenwalkerDefault) {
AI_Movement_Track_Flush(kActorGenwalkerC);
Actor_Put_In_Set(kActorGenwalkerC, kSetFreeSlotH);
Global_Variable_Set(kVariableGenericWalkerCModel, -1);
return false;
- } else if (newGoalNumber == 1) {
+ } else if (newGoalNumber == kGoalGenwalkerMoving) {
return true;
}
return false;
@@ -237,7 +237,7 @@ bool AIScriptGenericWalkerC::UpdateAnimation(int *animation, int *frame) {
if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(874))
{
_animationFrame = 0;
- Actor_Set_Goal_Number(kActorGenwalkerC, 0);
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
_animationState = kGenericWalkerCStatesIdle;
deltaX = 0.0f;
deltaZ = 0.0f;
@@ -339,7 +339,7 @@ bool AIScriptGenericWalkerC::prepareWalker() {
Game_Flag_Set(kFlagGenericWalkerWaiting);
AI_Countdown_Timer_Reset(kActorGenwalkerC, kActorTimerAIScriptCustomTask2);
AI_Countdown_Timer_Start(kActorGenwalkerC, kActorTimerAIScriptCustomTask2, Random_Query(4, 12));
- Actor_Set_Goal_Number(kActorGenwalkerC, 1);
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerMoving);
return true;
}
diff --git a/engines/bladerunner/script/scene/ct01.cpp b/engines/bladerunner/script/scene/ct01.cpp
index 34a2a5b0d9..18fbda0246 100644
--- a/engines/bladerunner/script/scene/ct01.cpp
+++ b/engines/bladerunner/script/scene/ct01.cpp
@@ -79,9 +79,17 @@ void SceneScriptCT01::InitializeScene() {
}
// Pause generic walkers outside special loop
// so that they're always paused when McCoy enters (less chance to collide with him)
+ // We use the previously unused kVariableGenericWalkerConfig
+ // The flag kFlagGenericWalkerWaiting will not do, because it can be reset
+ // if a walker is already moving (goal == 1).
// There's also another flag called kFlagUnpauseGenWalkers
// but the usage of that flag seems more obscure and dubious for this purpose
- Game_Flag_Set(kFlagGenericWalkerWaiting);
+ // Furthermore, kFlagUnpauseGenWalkers seems to be a code remnant, since the
+ // walkers tracks are never pause in that occasion (or any other)
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
+ Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
+ Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
+ Global_Variable_Set(kVariableGenericWalkerConfig, -1);
}
Setup_Scene_Information(-530.0f, -6.5f, 241.0f, 506);
Game_Flag_Set(kFlagArrivedFromSpinner1);
@@ -505,9 +513,9 @@ void SceneScriptCT01::PlayerWalkedIn() {
if (_vm->_cutContent) {
// unpause generic walkers here, less chance to collide with McCOy while he enters the scene
if( Game_Flag_Query(kFlagArrivedFromSpinner1)
- && Game_Flag_Query(kFlagGenericWalkerWaiting)
+ && Global_Variable_Query(kVariableGenericWalkerConfig) < 0
) {
- Game_Flag_Reset(kFlagGenericWalkerWaiting);
+ Global_Variable_Set(kVariableGenericWalkerConfig, 2);
}
}
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -314.0f, -6.5f, 326.0f, 0, false, false, false);
diff --git a/engines/bladerunner/script/scene/ct12.cpp b/engines/bladerunner/script/scene/ct12.cpp
index e4abbcbcd3..6074714092 100644
--- a/engines/bladerunner/script/scene/ct12.cpp
+++ b/engines/bladerunner/script/scene/ct12.cpp
@@ -318,7 +318,7 @@ void SceneScriptCT12::PlayerWalkedIn() {
}
void SceneScriptCT12::PlayerWalkedOut() {
- Game_Flag_Reset(kFlagGenericWalkerWaiting);
+ Game_Flag_Reset(kFlagGenericWalkerWaiting); // A bug? why is this here? Left over code?
if (Game_Flag_Query(kFlagCT12ToUG09)) {
Game_Flag_Reset(kFlagMcCoyInChinaTown);
Game_Flag_Set(kFlagMcCoyInUnderground);
diff --git a/engines/bladerunner/script/scene/rc04.cpp b/engines/bladerunner/script/scene/rc04.cpp
index 6619e3c672..774eca6b76 100644
--- a/engines/bladerunner/script/scene/rc04.cpp
+++ b/engines/bladerunner/script/scene/rc04.cpp
@@ -51,7 +51,7 @@ void SceneScriptRC04::SceneLoaded() {
Obstacle_Object("GRNDNEON07", true);
Unobstacle_Object("DisplayTrim", true);
Unobstacle_Object("Display01", true);
- Actor_Set_Goal_Number(kActorGenwalkerA, 200);
+ Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerABulletBobsTrackGun);
}
bool SceneScriptRC04::MouseClick(int x, int y) {