diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/actor.cpp | 158 | ||||
-rw-r--r-- | engines/bladerunner/actor.h | 28 | ||||
-rw-r--r-- | engines/bladerunner/actor_walk.cpp | 22 | ||||
-rw-r--r-- | engines/bladerunner/actor_walk.h | 8 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/combat.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/game_constants.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/script/scene/nr10.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/script/script.cpp | 42 | ||||
-rw-r--r-- | engines/bladerunner/script/script.h | 14 |
10 files changed, 143 insertions, 141 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index d0ba7cc7e8..59af72d87c 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -59,8 +59,8 @@ Actor::Actor(BladeRunnerEngine *vm, int actorId) { _friendlinessToOther.resize(_vm->_gameInfo->getActorCount()); - _inWalkLoop = false; - _damageAnimIfMoving = false; + _mustReachWalkDestination = false; + _damageAnimIfMoving = false; setup(actorId); } @@ -367,19 +367,19 @@ void Actor::setAtWaypoint(int waypointId, int angle, int moving, bool retired) { setAtXYZ(waypointPosition, angle, true, moving, retired); } -bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool interruptible, bool runFlag, const Vector3 &start, float targetWidth, float targetSize, bool a8, bool *isRunningFlag, bool async) { +bool Actor::loopWalk(const Vector3 &destination, int proximity, bool interruptible, bool runFlag, const Vector3 &start, float targetWidth, float targetSize, bool mustReach, bool *isRunningFlag, bool async) { *isRunningFlag = false; - if (destinationOffset > 0) { + if (proximity > 0) { float dist = distance(_position, destination); - if (dist - targetSize <= destinationOffset) { + if (dist - targetSize <= proximity) { return false; } } - if (a8 && !async && _id != kActorMcCoy && destinationOffset <= 24) { + if (mustReach && !async && _id != kActorMcCoy && proximity <= 24) { if (distance(_vm->_playerActor->_position, destination) <= 24.0f) { - _vm->_playerActor->walkToNearestPoint(destination, 48.0f); + _vm->_playerActor->stepAway(destination, 48.0f); } } @@ -389,18 +389,18 @@ bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool int Vector3 destinationX(destination); - if (destinationOffset > 0) { - walkFindU2(&destinationX, targetWidth, destinationOffset, targetSize, _position, destination); + if (proximity > 0) { + findNearestPosition(&destinationX, targetWidth, proximity, targetSize, _position, destination); } - bool walking = walkTo(runFlag, destinationX, a8); + bool walking = walkTo(runFlag, destinationX, mustReach); if (async) { return false; } - if (!walking && destinationOffset > 0) { - walking = walkTo(runFlag, destination, a8); + if (!walking && proximity > 0) { + walking = walkTo(runFlag, destination, mustReach); } if (!walking) { @@ -419,8 +419,8 @@ bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool int _vm->playerLosesControl(); } - if (a8) { - _inWalkLoop = true; + if (mustReach) { + _mustReachWalkDestination = true; } bool wasInterrupted = false; @@ -434,44 +434,48 @@ bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool int wasInterrupted = true; } } - if (a8) { - _inWalkLoop = false; + + if (mustReach) { + _mustReachWalkDestination = false; } + if (interruptible) { _vm->_isWalkingInterruptible = false; } else { _vm->playerGainsControl(); } - if (!wasInterrupted && destinationOffset == 0 && !_vm->_playerActorIdle) { + + if (!wasInterrupted && proximity == 0 && !_vm->_playerActorIdle) { setAtXYZ(destination, _facing, true, false, false); } + if (_id != kActorMcCoy) { _vm->_mouse->enable(); } + return wasInterrupted; } -bool Actor::walkTo(bool runFlag, const Vector3 &destination, bool a3) { +bool Actor::walkTo(bool runFlag, const Vector3 &destination, bool mustReach) { bool arrived; - - return _walkInfo->setup(_id, runFlag, _position, destination, a3, &arrived); + return _walkInfo->setup(_id, runFlag, _position, destination, mustReach, &arrived); } -bool Actor::loopWalkToActor(int otherActorId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag) { - return loopWalk(_vm->_actors[otherActorId]->_position, destinationOffset, interruptible, runFlag, _position, 24.0f, 24.0f, a5, isRunningFlag, false); +bool Actor::loopWalkToActor(int otherActorId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag) { + return loopWalk(_vm->_actors[otherActorId]->_position, proximity, interruptible, runFlag, _position, 24.0f, 24.0f, mustReach, isRunningFlag, false); } -bool Actor::loopWalkToItem(int itemId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag) { +bool Actor::loopWalkToItem(int itemId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag) { float x, y, z; int width, height; _vm->_items->getXYZ(itemId, &x, &y, &z); _vm->_items->getWidthHeight(itemId, &width, &height); Vector3 itemPosition(x, y, z); - return loopWalk(itemPosition, destinationOffset, interruptible, runFlag, _position, width, 24.0f, a5, isRunningFlag, false); + return loopWalk(itemPosition, proximity, interruptible, runFlag, _position, width, 24.0f, mustReach, isRunningFlag, false); } -bool Actor::loopWalkToSceneObject(const Common::String &objectName, int destinationOffset, bool interruptible, bool runFlag, bool a5, bool *isRunningFlag) { +bool Actor::loopWalkToSceneObject(const Common::String &objectName, int proximity, bool interruptible, bool runFlag, bool mustReach, bool *isRunningFlag) { int sceneObject = _vm->_scene->_set->findObject(objectName); if (sceneObject < 0) { return true; @@ -513,29 +517,29 @@ bool Actor::loopWalkToSceneObject(const Common::String &objectName, int destinat float y = _vm->_scene->_set->getAltitudeAtXZ(closestX, closestZ, &inWalkbox); Vector3 destination(closestX, y, closestZ); - return loopWalk(destination, destinationOffset, interruptible, runFlag, _position, 0.0f, 24.0f, a5, isRunningFlag, false); + return loopWalk(destination, proximity, interruptible, runFlag, _position, 0.0f, 24.0f, mustReach, isRunningFlag, false); } -bool Actor::loopWalkToWaypoint(int waypointId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag) { +bool Actor::loopWalkToWaypoint(int waypointId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag) { Vector3 waypointPosition; _vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z); - return loopWalk(waypointPosition, destinationOffset, interruptible, runFlag, _position, 0.0f, 24.0f, a5, isRunningFlag, false); + return loopWalk(waypointPosition, proximity, interruptible, runFlag, _position, 0.0f, 24.0f, mustReach, isRunningFlag, false); } -bool Actor::loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool interruptible, bool runFlag, bool a5, bool *isRunningFlag) { - return loopWalk(destination, destinationOffset, interruptible, runFlag, _position, 0.0f, 24.0f, a5, isRunningFlag, false); +bool Actor::loopWalkToXYZ(const Vector3 &destination, int proximity, bool interruptible, bool runFlag, bool mustReach, bool *isRunningFlag) { + return loopWalk(destination, proximity, interruptible, runFlag, _position, 0.0f, 24.0f, mustReach, isRunningFlag, false); } -bool Actor::asyncWalkToWaypoint(int waypointId, int destinationOffset, bool runFlag, bool a5) { +bool Actor::asyncWalkToWaypoint(int waypointId, int proximity, bool runFlag, bool mustReach) { bool running; Vector3 waypointPosition; _vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z); - return loopWalk(waypointPosition, destinationOffset, false, runFlag, _position, 0.0f, 24.0f, a5, &running, true); + return loopWalk(waypointPosition, proximity, false, runFlag, _position, 0.0f, 24.0f, mustReach, &running, true); } -void Actor::asyncWalkToXYZ(const Vector3 &destination, int destinationOffset, bool runFlag, int a6) { +void Actor::asyncWalkToXYZ(const Vector3 &destination, int proximity, bool runFlag, bool mustReach) { bool running; - loopWalk(destination, destinationOffset, false, runFlag, _position, 0.0f, 24.0f, a6, &running, true); + loopWalk(destination, proximity, false, runFlag, _position, 0.0f, 24.0f, mustReach, &running, true); } void Actor::run() { @@ -589,13 +593,13 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) { _targetFacing = -1; - bool walked = _walkInfo->tick(_id, -positionChange.y, false); + bool walkInterrupted = _walkInfo->tick(_id, -positionChange.y, _mustReachWalkDestination); Vector3 pos; int facing; _walkInfo->getCurrentPosition(_id, &pos, &facing); setAtXYZ(pos, facing, false, _isMoving, false); - if (walked) { + if (walkInterrupted) { _vm->_actors[_id]->changeAnimationMode(kAnimationModeIdle); movementTrackWaypointReached(); @@ -1197,76 +1201,78 @@ int Actor::findTargetUnderMouse(BladeRunnerEngine *vm, int mouseX, int mouseY) { return -1; } -bool Actor::walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *newDestination) { - newDestination->x = 0.0f; - newDestination->y = 0.0f; - newDestination->z = 0.0f; - int facing = angle_1024(targetPosition, startPosition); - int facing1 = 0; +bool Actor::findEmptyPositionAround(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *emptyPosition) { + emptyPosition->x = 0.0f; + emptyPosition->y = 0.0f; + emptyPosition->z = 0.0f; + + int facingLeft = angle_1024(targetPosition, startPosition); + int facingRight = facingLeft; + + int facingLeftCounter = 0; + int facingRightCounter = 0; - int facing2 = facing; - int facing3 = 0; while (true) { - float rotatedX = targetPosition.x + size * _vm->_sinTable1024->at(facing); - float rotatedZ = targetPosition.z - size * _vm->_cosTable1024->at(facing); + float rotatedX = targetPosition.x + size * _vm->_sinTable1024->at(facingLeft); + float rotatedZ = targetPosition.z - size * _vm->_cosTable1024->at(facingLeft); - if (!_walkInfo->isXYZEmpty(rotatedX, targetPosition.y, rotatedZ, _id)) { + if (!_walkInfo->isXYZOccupied(rotatedX, targetPosition.y, rotatedZ, _id)) { if (_vm->_scene->_set->findWalkbox(rotatedX, rotatedZ) >= 0) { - newDestination->x = rotatedX; - newDestination->y = targetPosition.y; - newDestination->z = rotatedZ; + emptyPosition->x = rotatedX; + emptyPosition->y = targetPosition.y; + emptyPosition->z = rotatedZ; return true; } - } else { - facing += 20; - if (facing > 1024) { - facing -= 1024; + } else { // looks like a bug as it might not find anything when there is no walkbox at this angle + facingLeft += 20; + if (facingLeft > 1024) { + facingLeft -= 1024; } - facing3 += 20; + facingLeftCounter += 20; } - rotatedX = size * _vm->_sinTable1024->at(facing2) + targetPosition.x; - rotatedZ = size * _vm->_cosTable1024->at(facing2) + targetPosition.z; + rotatedX = size * _vm->_sinTable1024->at(facingRight) + targetPosition.x; + rotatedZ = size * _vm->_cosTable1024->at(facingRight) + targetPosition.z; - if (!_walkInfo->isXYZEmpty(rotatedX, targetPosition.y, rotatedZ, _id)) { + if (!_walkInfo->isXYZOccupied(rotatedX, targetPosition.y, rotatedZ, _id)) { if (_vm->_scene->_set->findWalkbox(rotatedX, rotatedZ) >= 0) { - newDestination->x = rotatedX; - newDestination->y = targetPosition.y; - newDestination->z = rotatedZ; + emptyPosition->x = rotatedX; + emptyPosition->y = targetPosition.y; + emptyPosition->z = rotatedZ; return true; } - } else { - facing2 -= 20; - if (facing2 < 0) { - facing2 += 1024; + } else { // looks like a bug as it might not find anything when there is no walkbox at this angle + facingRight -= 20; + if (facingRight < 0) { + facingRight += 1024; } - facing1 += 20; + facingRightCounter += 20; } - if (facing3 > 1024 && facing1 > 1024) { + if (facingLeftCounter > 1024 && facingRightCounter > 1024) { return false; } } } -bool Actor::walkFindU2(Vector3 *newDestination, float targetWidth, int destinationOffset, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition) { - newDestination->x = 0.0f; - newDestination->y = 0.0f; - newDestination->z = 0.0f; - float size = destinationOffset + targetSize * 0.5f + targetWidth * 0.5f; +bool Actor::findNearestPosition(Vector3 *nearestPosition, float targetWidth, int proximity, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition) { + nearestPosition->x = 0.0f; + nearestPosition->y = 0.0f; + nearestPosition->z = 0.0f; + float size = proximity + targetSize * 0.5f + targetWidth * 0.5f; float distance = (startPosition - targetPosition).length() - targetWidth * 0.5f - targetSize * 0.5f; if (size < distance) { - return walkFindU1(startPosition, targetPosition, size, newDestination); + return findEmptyPositionAround(startPosition, targetPosition, size, nearestPosition); } else { - *newDestination = targetPosition; + *nearestPosition = targetPosition; return true; } } -bool Actor::walkToNearestPoint(const Vector3 &destination, float distance) { +bool Actor::stepAway(const Vector3 &destination, float distance) { Vector3 out; bool running; - if (_walkInfo->findNearestEmptyPosition(_id, destination, distance, out)) { + if (_walkInfo->findEmptyPositionAround(_id, destination, distance, out)) { loopWalk(out, 0, false, false, _position, 0.0f, 24.0f, false, &running, false); return true; } diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h index 90588c80dd..492db6dd5f 100644 --- a/engines/bladerunner/actor.h +++ b/engines/bladerunner/actor.h @@ -77,7 +77,7 @@ private: bool _isTarget; bool _isInvisible; bool _isImmuneToObstacles; - bool _inWalkLoop; + bool _mustReachWalkDestination; bool _isRetired; bool _inCombat; bool _isMoving; @@ -148,15 +148,15 @@ public: void movementTrackUnpause(); void movementTrackWaypointReached(); - bool loopWalk(const Vector3 &destination, int destinationOffset, bool interruptible, bool runFlag, const Vector3 &start, float a6, float a7, bool a8, bool *isRunningFlag, bool async); - bool walkTo(bool runFlag, const Vector3 &destination, bool a3); - bool loopWalkToActor(int otherActorId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag); - bool loopWalkToItem(int itemId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag); - bool loopWalkToSceneObject(const Common::String &objectName, int destinationOffset, bool interruptible, bool runFlag, bool a5, bool *isRunningFlag); - bool loopWalkToWaypoint(int waypointId, int destinationOffset, int interruptible, bool runFlag, bool a5, bool *isRunningFlag); - bool loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool interruptible, bool runFlag, bool a5, bool *isRunningFlag); - bool asyncWalkToWaypoint(int waypointId, int destinationOffset, bool runFlag, bool a5); - void asyncWalkToXYZ(const Vector3 &destination, int destinationOffset, bool runFlag, int a6); + bool loopWalk(const Vector3 &destination, int proximity, bool interruptible, bool runFlag, const Vector3 &start, float targetWidth, float targetSize, bool mustReach, bool *isRunningFlag, bool async); + bool walkTo(bool runFlag, const Vector3 &destination, bool mustReach); + bool loopWalkToActor(int otherActorId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag); + bool loopWalkToItem(int itemId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag); + bool loopWalkToSceneObject(const Common::String &objectName, int proximity, bool interruptible, bool runFlag, bool mustReach, bool *isRunningFlag); + bool loopWalkToWaypoint(int waypointId, int proximity, int interruptible, bool runFlag, bool mustReach, bool *isRunningFlag); + bool loopWalkToXYZ(const Vector3 &destination, int proximity, bool interruptible, bool runFlag, bool mustReach, bool *isRunningFlag); + bool asyncWalkToWaypoint(int waypointId, int proximity, bool runFlag, bool mustReach); + void asyncWalkToXYZ(const Vector3 &destination, int proximity, bool runFlag, bool mustReach); void run(); bool tick(bool forceUpdate, Common::Rect *screenRect); @@ -178,7 +178,7 @@ public: bool isMoving() const { return _isMoving; } void setMoving(bool value) { _isMoving = value; } - bool inWalkLoop() const { return _inWalkLoop; } + bool mustReachWalkDestination() const { return _mustReachWalkDestination; } bool isWalking() const; bool isRunning() const; void stopWalking(bool value); @@ -264,9 +264,9 @@ private: void setBoundingBox(const Vector3 &position, bool retired); float distanceFromView(View *view) const; - bool walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float a3, Vector3 *newDestination); - bool walkFindU2(Vector3 *newDestination, float targetWidth, int destinationOffset, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition); - bool walkToNearestPoint(const Vector3 &destination, float distance); + bool findEmptyPositionAround(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *emptyPosition); + bool findNearestPosition(Vector3 *nearestPosition, float targetWidth, int proximity, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition); + bool stepAway(const Vector3 &destination, float distance); //bool walkFindU3(int actorId, Vector3 from, int distance, Vector3 *out); }; diff --git a/engines/bladerunner/actor_walk.cpp b/engines/bladerunner/actor_walk.cpp index 985c92fb8d..25daef0795 100644 --- a/engines/bladerunner/actor_walk.cpp +++ b/engines/bladerunner/actor_walk.cpp @@ -48,7 +48,7 @@ ActorWalk::ActorWalk(BladeRunnerEngine *vm) { ActorWalk::~ActorWalk() {} -bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool unk1, bool *arrived) { +bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool mustReach, bool *arrived) { Vector3 next; *arrived = false; @@ -108,11 +108,11 @@ bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vect return true; } -bool ActorWalk::tick(int actorId, float stepDistance, bool inWalkLoop) { +bool ActorWalk::tick(int actorId, float stepDistance, bool mustReachWalkDestination) { bool walkboxFound; if (_status == 5) { - if (inWalkLoop) { + if (mustReachWalkDestination) { stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle); return true; } @@ -128,18 +128,18 @@ bool ActorWalk::tick(int actorId, float stepDistance, bool inWalkLoop) { nearActorExists = true; if (_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, _destination.x, _destination.z, true, true)) { if (actorId > 0) { - if (_vm->_actors[actorId]->inWalkLoop()) { + if (_vm->_actors[actorId]->mustReachWalkDestination()) { stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle); _nearActors.clear(); return true; } else { Vector3 newDestination; - findNearestEmptyPositionToOriginalDestination(actorId, newDestination); + findEmptyPositionAroundToOriginalDestination(actorId, newDestination); _destination = newDestination; return false; } } else { - if (_vm->_playerActor->inWalkLoop()) { + if (_vm->_playerActor->mustReachWalkDestination()) { _destination = _current; } stop(0, true, kAnimationModeCombatIdle, kAnimationModeIdle); @@ -284,7 +284,7 @@ void ActorWalk::load(SaveFileReadStream &f) { _status = f.readInt(); } -bool ActorWalk::isXYZEmpty(float x, float y, float z, int actorId) const { +bool ActorWalk::isXYZOccupied(float x, float y, float z, int actorId) const { if (_vm->_scene->_set->findWalkbox(x, z) == -1) { return true; } @@ -294,7 +294,7 @@ bool ActorWalk::isXYZEmpty(float x, float y, float z, int actorId) const { return _vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, x, z, false, false); } -bool ActorWalk::findNearestEmptyPosition(int actorId, const Vector3 &destination, int dist, Vector3 &out) const { +bool ActorWalk::findEmptyPositionAround(int actorId, const Vector3 &destination, int dist, Vector3 &out) const { bool inWalkbox; int facingToMinDistance = -1; @@ -328,7 +328,7 @@ bool ActorWalk::findNearestEmptyPosition(int actorId, const Vector3 &destination break; } - x = destination.x + _vm->_sinTable1024->at(facingLeft) * dist; + x = destination.x + _vm->_sinTable1024->at(facingLeft) * dist; z = destination.z - _vm->_cosTable1024->at(facingLeft) * dist; if (!_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { @@ -356,8 +356,8 @@ bool ActorWalk::findNearestEmptyPosition(int actorId, const Vector3 &destination return false; } -bool ActorWalk::findNearestEmptyPositionToOriginalDestination(int actorId, Vector3 &out) const { - return findNearestEmptyPosition(actorId, _originalDestination, 30, out); +bool ActorWalk::findEmptyPositionAroundToOriginalDestination(int actorId, Vector3 &out) const { + return findEmptyPositionAround(actorId, _originalDestination, 30, out); } bool ActorWalk::addNearActors(int skipActorId) { diff --git a/engines/bladerunner/actor_walk.h b/engines/bladerunner/actor_walk.h index 45298e2794..c0cdd937c0 100644 --- a/engines/bladerunner/actor_walk.h +++ b/engines/bladerunner/actor_walk.h @@ -49,15 +49,15 @@ public: ActorWalk(BladeRunnerEngine *vm); ~ActorWalk(); - bool setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool unk1, bool *arrived); + bool setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool mustReach, bool *arrived); void getCurrentPosition(int actorId, Vector3 *pos, int *facing) const; bool tick(int actorId, float stepDistance, bool flag); bool isWalking() const { return _walking; } bool isRunning() const { return _running; } - bool isXYZEmpty(float x, float y, float z, int actorId) const; - bool findNearestEmptyPosition(int actorId, const Vector3 &from, int distance, Vector3 &out) const; + bool isXYZOccupied(float x, float y, float z, int actorId) const; + bool findEmptyPositionAround(int actorId, const Vector3 &from, int distance, Vector3 &out) const; void stop(int actorId, bool immediately, int combatAnimationMode, int animationMode); void run(int actorId); @@ -68,7 +68,7 @@ public: private: int nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, Vector3 &next) const; - bool findNearestEmptyPositionToOriginalDestination(int actorId, Vector3 &out) const; + bool findEmptyPositionAroundToOriginalDestination(int actorId, Vector3 &out) const; bool addNearActors(int skipActorId); diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index e2510cae0d..9b0ffaff16 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -1287,7 +1287,7 @@ void BladeRunnerEngine::handleMouseAction(int x, int y, bool mainButton, bool bu handleMouseClick3DObject(sceneObjectId - kSceneObjectOffsetObjects, buttonDown, isClickable, isTarget); } } else if (buttonDown) { - if (_playerActor->inWalkLoop()) { + if (_playerActor->mustReachWalkDestination()) { if (!_isWalkingInterruptible) { return; } @@ -1579,7 +1579,7 @@ void BladeRunnerEngine::handleMouseClickActor(int actorId, bool mainButton, bool if (!_combat->isActive()) { _kia->openLastOpened(); } - } else if (!_playerActor->inWalkLoop()) { + } else if (!_playerActor->mustReachWalkDestination()) { _combat->change(); } return; diff --git a/engines/bladerunner/combat.cpp b/engines/bladerunner/combat.cpp index 90c879f6d1..3bc876f4e8 100644 --- a/engines/bladerunner/combat.cpp +++ b/engines/bladerunner/combat.cpp @@ -75,7 +75,7 @@ void Combat::deactivate() { } void Combat::change() { - if (!_vm->_playerActor->inWalkLoop() && _enabled) { + if (!_vm->_playerActor->mustReachWalkDestination() && _enabled) { if (_active) { deactivate(); } else { diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 8eb4960e97..62a00ec036 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -1790,7 +1790,7 @@ enum GoalClovis { kGoalClovisBB11WalkToMcCoy = 101, kGoalClovisBB11StopSadik = 102, kGoalClovisBB11TalkWithSadik = 103, - kGoalClovisBB11PrepareTalkToMcCoy = 104, // bug? this is not triggered when player skips dialogue + kGoalClovisBB11PrepareTalkToMcCoy = 104, // bug? this is not triggered when player skips dialogue too fast kGoalClovisBB11TalkToMcCoy = 105 // ends Chapter 2 }; diff --git a/engines/bladerunner/script/scene/nr10.cpp b/engines/bladerunner/script/scene/nr10.cpp index 6031952f27..a3f7adcd84 100644 --- a/engines/bladerunner/script/scene/nr10.cpp +++ b/engines/bladerunner/script/scene/nr10.cpp @@ -22,8 +22,6 @@ #include "bladerunner/script/scene_script.h" -#include "common/debug.h" - namespace BladeRunner { void SceneScriptNR10::InitializeScene() { @@ -121,8 +119,6 @@ bool SceneScriptNR10::ClickedOn2DRegion(int region) { } void SceneScriptNR10::SceneFrameAdvanced(int frame) { - debug("%i", frame); - if (frame == 122) { Game_Flag_Set(kFlagNR10McCoyBlinded); Actor_Set_Invisible(kActorMcCoy, true); diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 9795e296ae..796b4da397 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -475,8 +475,8 @@ int ScriptBase::Actor_Query_Animation_Mode(int actorId) { return _vm->_actors[actorId]->getAnimationMode(); } -bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int distance, bool interruptible, bool run) { - debugC(kDebugScript, "Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, distance, interruptible, run); +bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int proximity, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, proximity, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -486,7 +486,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int dis _vm->_playerActorIdle = false; bool isRunning; - bool result = _vm->_actors[actorId]->loopWalkToActor(otherActorId, distance, interruptible, run, true, &isRunning); + bool result = _vm->_actors[actorId]->loopWalkToActor(otherActorId, proximity, interruptible, run, true, &isRunning); if (_vm->_playerActorIdle) { result = true; @@ -500,8 +500,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int dis return result; } -bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinationOffset, bool interruptible, bool run) { - debugC(kDebugScript, "Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, destinationOffset, interruptible, run); +bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int proximity, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, proximity, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -511,7 +511,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinatio _vm->_playerActorIdle = false; bool isRunning; - bool result = _vm->_actors[actorId]->loopWalkToItem(itemId, destinationOffset, interruptible, run, true, &isRunning); + bool result = _vm->_actors[actorId]->loopWalkToItem(itemId, proximity, interruptible, run, true, &isRunning); if (_vm->_playerActorIdle) { result = true; @@ -525,8 +525,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinatio return result; } -bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int destinationOffset, bool interruptible, bool run) { - debugC(kDebugScript, "Loop_Actor_Walk_To_Scene_Object(%d, %s, %d, %d, %d)", actorId, objectName, destinationOffset, interruptible, run); +bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int proximity, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Scene_Object(%d, %s, %d, %d, %d)", actorId, objectName, proximity, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -536,7 +536,7 @@ 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, interruptible, run, true, &isRunning); + bool result = _vm->_actors[actorId]->loopWalkToSceneObject(objectName, proximity, interruptible, run, true, &isRunning); if (_vm->_playerActorIdle) { result = true; @@ -550,8 +550,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object return result; } -bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool interruptible, bool run) { - debugC(kDebugScript, "Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, interruptible, run); +bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int proximity, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, proximity, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -561,7 +561,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int de _vm->_playerActorIdle = false; bool isRunning; - bool result = _vm->_actors[actorId]->loopWalkToWaypoint(waypointId, destinationOffset, interruptible, run, true, &isRunning); + bool result = _vm->_actors[actorId]->loopWalkToWaypoint(waypointId, proximity, interruptible, run, true, &isRunning); if (_vm->_playerActorIdle) { result = true; @@ -575,8 +575,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int de return result; } -bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool interruptible, bool run, int a7) { - debugC(kDebugScript, "Loop_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d, %d, %d)", actorId, x, y, z, destinationOffset, interruptible, run, a7); +bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int proximity, bool interruptible, bool run, bool a7) { + debugC(kDebugScript, "Loop_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d, %d, %d)", actorId, x, y, z, proximity, interruptible, run, a7); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -589,7 +589,7 @@ bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, _vm->_playerActorIdle = false; bool isRunning; - bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), destinationOffset, interruptible, run, true, &isRunning); + bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), proximity, interruptible, run, true, &isRunning); if (_vm->_playerActorIdle) { result = true; @@ -603,26 +603,26 @@ bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, return result; } -void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool run) { - debugC(kDebugScript, "Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run); +void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int proximity, bool run) { + debugC(kDebugScript, "Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, proximity, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { run = true; } - _vm->_actors[actorId]->asyncWalkToWaypoint(waypointId, destinationOffset, run, true); + _vm->_actors[actorId]->asyncWalkToWaypoint(waypointId, proximity, run, true); } -void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) { - debugC(kDebugScript, "Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run); +void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int proximity, bool run) { + debugC(kDebugScript, "Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, proximity, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { run = true; } - _vm->_actors[actorId]->asyncWalkToXYZ(Vector3(x, y, z), destinationOffset, run, true); + _vm->_actors[actorId]->asyncWalkToXYZ(Vector3(x, y, z), proximity, run, true); } void ScriptBase::Actor_Force_Stop_Walking(int actorId) { diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index e2e3e2772a..3511461e9b 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -103,13 +103,13 @@ protected: int Slice_Animation_Query_Number_Of_Frames(int animationId); void Actor_Change_Animation_Mode(int actorId, int animationMode); int Actor_Query_Animation_Mode(int actorId); - bool Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int distance, bool interruptible, bool run); - bool Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinationOffset, bool interruptible, bool run); - bool Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int distance, bool interruptible, bool run); - bool Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool interruptible, bool run); - bool Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool interruptible, bool run, int a7); - void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool run); - void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run); + bool Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int proximity, bool interruptible, bool run); + bool Loop_Actor_Walk_To_Item(int actorId, int itemId, int proximity, bool interruptible, bool run); + bool Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int proximity, bool interruptible, bool run); + bool Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int proximity, bool interruptible, bool run); + bool Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int proximity, bool interruptible, bool run, bool a7); + void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int proximity, bool run); + void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int proximity, bool run); void Actor_Force_Stop_Walking(int actorId); void Loop_Actor_Travel_Stairs(int actorId, int stepCount, bool up, int animationModeEnd); void Loop_Actor_Travel_Ladder(int actorId, int stepCount, bool up, int animationModeEnd); |