aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-08-28 21:32:12 +0300
committerThanasis Antoniou2019-08-28 21:32:12 +0300
commitac3ed34610c89911127d1335012583f7e92bccb7 (patch)
tree58e301c2e261d11135dbb60b4585b5d594d06317
parent0486b301e43cb63df32ceccc8b65350534f15883 (diff)
downloadscummvm-rg350-ac3ed34610c89911127d1335012583f7e92bccb7.tar.gz
scummvm-rg350-ac3ed34610c89911127d1335012583f7e92bccb7.tar.bz2
scummvm-rg350-ac3ed34610c89911127d1335012583f7e92bccb7.zip
BLADERUNNER: Fix restored walkers idle behavior and AI_Movement_Track_Append_With_Facing
-rw-r--r--engines/bladerunner/actor.cpp23
-rw-r--r--engines/bladerunner/script/ai/generic_walker_a.cpp21
-rw-r--r--engines/bladerunner/script/ai/generic_walker_b.cpp19
-rw-r--r--engines/bladerunner/script/ai/generic_walker_c.cpp19
4 files changed, 67 insertions, 15 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 4f91218a50..e5933f6619 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -384,6 +384,12 @@ void Actor::movementTrackWaypointReached() {
if (!_movementTrackDelayOnNextWaypoint) {
_movementTrackDelayOnNextWaypoint = 1;
}
+#if !BLADERUNNER_ORIGINAL_BUGS
+ // Honor the heading defined by the AI_Movement_Track_Append_With_Facing method
+ if (_movementTrackNextAngle >= 0) {
+ faceHeading(_movementTrackNextAngle, true);
+ }
+#endif
if (_vm->_aiScripts->reachedMovementTrackWaypoint(_id, _movementTrackWalkingToWaypointId)) {
int32 delay = _movementTrackDelayOnNextWaypoint;
if (delay > 1) {
@@ -657,14 +663,12 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
_targetFacing = -1;
bool walkInterrupted = _walkInfo->tick(_id, -positionChange.y, _mustReachWalkDestination);
-
Vector3 pos;
int facing;
_walkInfo->getCurrentPosition(_id, &pos, &facing);
setAtXYZ(pos, facing, false, _isMoving, false);
if (walkInterrupted) {
_vm->_actors[_id]->changeAnimationMode(kAnimationModeIdle);
-
movementTrackWaypointReached();
if (inCombat()) {
changeAnimationMode(_animationModeCombatIdle, false);
@@ -673,6 +677,7 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
}
}
} else {
+ // actor is not walking / is idle
if (angleChange != 0.0f) {
int facingChange = angleChange * (512.0f / M_PI);
if (facingChange != 0) {
@@ -687,6 +692,20 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
}
}
+ if (_vm->_cutContent) {
+ // the following Generic Walker models don't have an animation Id that is idle
+ // so we use a frame of their walking animation to show them as stopped
+ // However, we also need to override the positionChange vector for their walking animation too
+ if ( (_id == kActorGenwalkerA || _id == kActorGenwalkerB || _id == kActorGenwalkerC)
+ &&
+ (_animationId == 436 || _animationId == 434 || _animationId == 435 || _animationId == 422 || _animationId == 423)
+ ) {
+ positionChange.x = 0.0f;
+ positionChange.y = 0.0f;
+ positionChange.z = 0.0f;
+ }
+ }
+
if (0.0f != positionChange.x || 0.0f != positionChange.y || 0.0f != positionChange.z) {
if (_actorSpeed.x != 0.0f) {
positionChange.x = positionChange.x * _actorSpeed.x;
diff --git a/engines/bladerunner/script/ai/generic_walker_a.cpp b/engines/bladerunner/script/ai/generic_walker_a.cpp
index d1e0d0469e..131e7befc6 100644
--- a/engines/bladerunner/script/ai/generic_walker_a.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_a.cpp
@@ -226,7 +226,14 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
*animation = 430; // Hooded person with umbrella still
break;
case 2:
- *animation = 437; // Hatted lady with wooden umbrella still (different from 436 model!)
+#if BLADERUNNER_ORIGINAL_BUGS
+ // Hatted lady with wooden umbrella still (different from 436 model!)
+ *animation = 437;
+#else
+ // use model 436 and animation frame 4
+ *animation = 436;
+ _animationFrame = 4;
+#endif // BLADERUNNER_ORIGINAL_BUGS
break;
case 3:
*animation = 431; // Person with glasses and beard still
@@ -242,8 +249,8 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
_animationFrame = 11;
break;
case 7:
- *animation = 435; // Child walking // frame 5 could be used for still
- _animationFrame = 5;
+ *animation = 435; // Child walking // frame 5 or 0 could be used for still
+ _animationFrame = 0;
break;
case 8:
*animation = 422; // Hatted person walking fast // frame 1 could be used for still
@@ -255,7 +262,7 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
break;
}
if (!_vm->_cutContent
- || Global_Variable_Query(kVariableGenericWalkerAModel) < 6
+ || (Global_Variable_Query(kVariableGenericWalkerAModel) < 6 && Global_Variable_Query(kVariableGenericWalkerAModel) != 2)
) {
_animationFrame = 0;
}
@@ -328,7 +335,11 @@ bool AIScriptGenericWalkerA::ChangeAnimationMode(int mode) {
switch (mode) {
case kAnimationModeIdle:
_animationState = kGenericWalkerAStatesIdle;
- _animationFrame = 0;
+ if (!_vm->_cutContent
+ || (Global_Variable_Query(kVariableGenericWalkerAModel) < 6 && Global_Variable_Query(kVariableGenericWalkerAModel) != 2)
+ ) {
+ _animationFrame = 0;
+ }
break;
case kAnimationModeWalk:
_animationState = kGenericWalkerAStatesWalk;
diff --git a/engines/bladerunner/script/ai/generic_walker_b.cpp b/engines/bladerunner/script/ai/generic_walker_b.cpp
index 4f8d4d3d60..748748b228 100644
--- a/engines/bladerunner/script/ai/generic_walker_b.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_b.cpp
@@ -190,7 +190,14 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
*animation = 430;
break;
case 2:
+#if BLADERUNNER_ORIGINAL_BUGS
+ // Hatted lady with wooden umbrella still (different from 436 model!)
*animation = 437;
+#else
+ // use model 436 and animation frame 4
+ *animation = 436;
+ _animationFrame = 4;
+#endif // BLADERUNNER_ORIGINAL_BUGS
break;
case 3:
*animation = 431;
@@ -206,8 +213,8 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
_animationFrame = 11;
break;
case 7:
- *animation = 435; // Child walking // frame 5 could be used for still
- _animationFrame = 5;
+ *animation = 435; // Child walking // frame 5 or 0 could be used for still
+ _animationFrame = 0;
break;
case 8:
*animation = 422; // Hatted person walking fast // frame 1 could be used for still
@@ -219,7 +226,7 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
break;
}
if (!_vm->_cutContent
- || Global_Variable_Query(kVariableGenericWalkerAModel) < 6
+ || (Global_Variable_Query(kVariableGenericWalkerBModel) < 6 && Global_Variable_Query(kVariableGenericWalkerBModel) != 2)
) {
_animationFrame = 0;
}
@@ -285,7 +292,11 @@ bool AIScriptGenericWalkerB::ChangeAnimationMode(int mode) {
switch (mode) {
case kAnimationModeIdle:
_animationState = kGenericWalkerBStatesIdle;
- _animationFrame = 0;
+ if (!_vm->_cutContent
+ || (Global_Variable_Query(kVariableGenericWalkerBModel) < 6 && Global_Variable_Query(kVariableGenericWalkerBModel) != 2)
+ ) {
+ _animationFrame = 0;
+ }
break;
case kAnimationModeWalk:
_animationState = kGenericWalkerBStatesWalk;
diff --git a/engines/bladerunner/script/ai/generic_walker_c.cpp b/engines/bladerunner/script/ai/generic_walker_c.cpp
index b92cf71622..9a07aff73d 100644
--- a/engines/bladerunner/script/ai/generic_walker_c.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_c.cpp
@@ -191,7 +191,14 @@ bool AIScriptGenericWalkerC::UpdateAnimation(int *animation, int *frame) {
*animation = 430;
break;
case 2:
+#if BLADERUNNER_ORIGINAL_BUGS
+ // Hatted lady with wooden umbrella still (different from 436 model!)
*animation = 437;
+#else
+ // use model 436 and animation frame 4
+ *animation = 436;
+ _animationFrame = 4;
+#endif // BLADERUNNER_ORIGINAL_BUGS
break;
case 3:
*animation = 431;
@@ -207,8 +214,8 @@ bool AIScriptGenericWalkerC::UpdateAnimation(int *animation, int *frame) {
_animationFrame = 11;
break;
case 7:
- *animation = 435; // Child walking // frame 5 could be used for still
- _animationFrame = 5;
+ *animation = 435; // Child walking // frame 5 or 0 could be used for still
+ _animationFrame = 0;
break;
case 8:
*animation = 422; // Hatted person walking fast // frame 1 could be used for still
@@ -220,7 +227,7 @@ bool AIScriptGenericWalkerC::UpdateAnimation(int *animation, int *frame) {
break;
}
if (!_vm->_cutContent
- || Global_Variable_Query(kVariableGenericWalkerAModel) < 6
+ || (Global_Variable_Query(kVariableGenericWalkerCModel) < 6 && Global_Variable_Query(kVariableGenericWalkerCModel) != 2)
) {
_animationFrame = 0;
}
@@ -286,7 +293,11 @@ bool AIScriptGenericWalkerC::ChangeAnimationMode(int mode) {
switch (mode) {
case kAnimationModeIdle:
_animationState = kGenericWalkerCStatesIdle;
- _animationFrame = 0;
+ if (!_vm->_cutContent
+ || (Global_Variable_Query(kVariableGenericWalkerCModel) < 6 && Global_Variable_Query(kVariableGenericWalkerCModel) != 2)
+ ) {
+ _animationFrame = 0;
+ }
break;
case kAnimationModeWalk:
_animationState = kGenericWalkerCStatesWalk;