[Scummvm-git-logs] scummvm master -> 9c1dbba83d55cb914deeb2214559660aa800578c

antoniou79 a.antoniou79 at gmail.com
Thu Jun 17 05:44:36 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
08d95bae75 BLADERUNNER: Fix Gordo walking on air and floating in NR02
9c1dbba83d BLADERUNNER: JANITORIAL: Fix spacing for commented out debug()


Commit: 08d95bae75b483c6dec472fb14643962e124e2e1
    https://github.com/scummvm/scummvm/commit/08d95bae75b483c6dec472fb14643962e124e2e1
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2021-06-17T08:44:20+03:00

Commit Message:
BLADERUNNER: Fix Gordo walking on air and floating in NR02

Original bug - If McCoy exits and re-enters quickly while Gordo walks to podium

Related to the movementTrackWaypointReached() while McCoy is not on the actor's set

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/actor.h
    engines/bladerunner/script/script.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index f57ff55c78..b791fb6764 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -393,6 +393,7 @@ void Actor::movementTrackNext(bool omitAiScript) {
 		int waypointSetId = _vm->_waypoints->getSetId(waypointId);
 		_vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z);
 		if (_setId == waypointSetId && waypointSetId == _vm->_actors[0]->_setId) {
+			// if target waypointSetId is in same set as both the actor and McCoy then call movementTrackWaypointReached
 			stopWalking(false);
 			_walkInfo->setup(_id, running, _position, waypointPosition, false, &arrived);
 
@@ -402,6 +403,8 @@ void Actor::movementTrackNext(bool omitAiScript) {
 				movementTrackWaypointReached();
 			}
 		} else {
+			// teleport to target waypoint's set and position anyway
+			// and schedule next movementTrackNext() using the kActorTimerMovementTrack
 			setSetId(waypointSetId);
 
 			setAtXYZ(waypointPosition, angle, true, false, false);
@@ -412,6 +415,7 @@ void Actor::movementTrackNext(bool omitAiScript) {
 			if (delayMillis > 1) {
 				changeAnimationMode(kAnimationModeIdle, false);
 			}
+
 			timerStart(kActorTimerMovementTrack, delayMillis);
 		}
 		//return true;
@@ -448,16 +452,31 @@ void Actor::movementTrackUnpause() {
 void Actor::movementTrackWaypointReached() {
 	if (!_movementTrack->isPaused() && _id != kActorMcCoy) {
 		if (_movementTrackWalkingToWaypointId >= 0 && _movementTrackDelayOnNextWaypoint >= 0) {
-			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);
+			Vector3 waypointPosition;
+			int waypointSetId = _vm->_waypoints->getSetId(_movementTrackWalkingToWaypointId);
+			_vm->_waypoints->getXYZ(_movementTrackWalkingToWaypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z);
+			if (_setId != waypointSetId || waypointSetId != _vm->_actors[0]->_setId) {
+				// teleport to target waypoint's set and position anyway
+				// Code similar to movementTrackNext()
+				setSetId(waypointSetId);
+				if (_movementTrackNextAngle == -1) {
+					_movementTrackNextAngle = 0;
+				}
+				setAtXYZ(waypointPosition, _movementTrackNextAngle, true, false, false);
+			} else {
+				// Honor the heading defined by the AI_Movement_Track_Append_With_Facing method
+				if (_movementTrackNextAngle >= 0) {
+					faceHeading(_movementTrackNextAngle, true);
+				}
 			}
 #endif
+			if (!_movementTrackDelayOnNextWaypoint) {
+				_movementTrackDelayOnNextWaypoint = 1;
+			}
+
 			if (_vm->_aiScripts->reachedMovementTrackWaypoint(_id, _movementTrackWalkingToWaypointId)) {
+				// schedule next movementTrackNext() using the kActorTimerMovementTrack
 				int32 delay = _movementTrackDelayOnNextWaypoint;
 				if (delay > 1) {
 					changeAnimationMode(kAnimationModeIdle, false);
@@ -490,7 +509,7 @@ void Actor::setAtXYZ(const Vector3 &position, int facing, bool snapFacing, bool
 	}
 }
 
-void Actor::setAtWaypoint(int waypointId, int angle, int moving, bool retired) {
+void Actor::setAtWaypoint(int waypointId, int angle, bool moving, bool retired) {
 	Vector3 waypointPosition;
 	_vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z);
 	setAtXYZ(waypointPosition, angle, true, moving, retired);
diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h
index e58c2e8df3..84a9c913b8 100644
--- a/engines/bladerunner/actor.h
+++ b/engines/bladerunner/actor.h
@@ -126,7 +126,7 @@ public:
 	void setup(int actorId);
 
 	void setAtXYZ(const Vector3 &pos, int facing, bool setFacing = true, bool moving = false, bool retired = false);
-	void setAtWaypoint(int waypointId, int angle, int unknown, bool retired);
+	void setAtWaypoint(int waypointId, int angle, bool moving, bool retired);
 
 	int  getId() const { return _id; };
 	float getX() const;
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 52067dcf54..eb30bd2595 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -91,7 +91,7 @@ void ScriptBase::Actor_Set_At_XYZ(int actorId, float x, float y, float z, int di
 
 void ScriptBase::Actor_Set_At_Waypoint(int actorId, int waypointId, int angle) {
 	debugC(kDebugScript, "Actor_Set_At_Waypoint(%d, %d, %d)", actorId, waypointId, angle);
-	_vm->_actors[actorId]->setAtWaypoint(waypointId, angle, 0, false);
+	_vm->_actors[actorId]->setAtWaypoint(waypointId, angle, false, false);
 }
 
 bool ScriptBase::Region_Check(int left, int top, int right, int down) {


Commit: 9c1dbba83d55cb914deeb2214559660aa800578c
    https://github.com/scummvm/scummvm/commit/9c1dbba83d55cb914deeb2214559660aa800578c
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2021-06-17T08:44:20+03:00

Commit Message:
BLADERUNNER: JANITORIAL: Fix spacing for commented out debug()

Changed paths:
    engines/bladerunner/audio_player.cpp


diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp
index 265ad46b93..dc283462e3 100644
--- a/engines/bladerunner/audio_player.cpp
+++ b/engines/bladerunner/audio_player.cpp
@@ -140,7 +140,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panStart, i
 
 	for (int i = 0; i != kTracks; ++i) {
 		if (!isActive(i)) {
-			//debug ("Assigned track %i to %s", i, name.c_str());
+			//debug("Assigned track %i to %s", i, name.c_str());
 			track = i;
 			break;
 		}
@@ -155,14 +155,14 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panStart, i
 	 * the new priority
 	 */
 	if (track == -1 && lowestPriority < priority) {
-		//debug ("Stop lowest priority  track (with lower prio: %d %d), for %s %d!", lowestPriorityTrack, lowestPriority, name.c_str(), priority);
+		//debug("Stop lowest priority  track (with lower prio: %d %d), for %s %d!", lowestPriorityTrack, lowestPriority, name.c_str(), priority);
 		stop(lowestPriorityTrack, true);
 		track = lowestPriorityTrack;
 	}
 
 	/* If there's still no available track, give up */
 	if (track == -1) {
-		//debug ("No available track for %s %d - giving up", name.c_str(), priority);
+		//debug("No available track for %s %d - giving up", name.c_str(), priority);
 		return -1;
 	}
 
@@ -171,7 +171,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panStart, i
 	if (!_vm->_audioCache->findByHash(hash)) {
 		Common::SeekableReadStream *r = _vm->getResourceStream(name);
 		if (!r) {
-			//debug ("Could not get stream for %s %d - giving up", name.c_str(), priority);
+			//debug("Could not get stream for %s %d - giving up", name.c_str(), priority);
 			return -1;
 		}
 
@@ -179,7 +179,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panStart, i
 		while (!_vm->_audioCache->canAllocate(size)) {
 			if (!_vm->_audioCache->dropOldest()) {
 				delete r;
-				//debug ("No available mem in cache for %s %d - giving up", name.c_str(), priority);
+				//debug("No available mem in cache for %s %d - giving up", name.c_str(), priority);
 				return -1;
 			}
 		}
@@ -208,7 +208,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panStart, i
 
 	if (channel == -1) {
 		delete audioStream;
-		//debug ("No available channel for %s %d - giving up", name.c_str(), priority);
+		//debug("No available channel for %s %d - giving up", name.c_str(), priority);
 		return -1;
 	}
 




More information about the Scummvm-git-logs mailing list