[Scummvm-git-logs] scummvm master -> 5033dc8393d9bf9d589947bb37d1336ee8719829

aquadran noreply at scummvm.org
Fri Nov 27 05:04:25 UTC 2026


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

Summary:
5033dc8393 GRIM: Make IsActorMoving only report path walks


Commit: 5033dc8393d9bf9d589947bb37d1336ee8719829
    https://github.com/scummvm/scummvm/commit/5033dc8393d9bf9d589947bb37d1336ee8719829
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-27T06:04:21+01:00

Commit Message:
GRIM: Make IsActorMoving only report path walks

The original IsActorMoving only checks the path walk flag. In EMI,
Canard is stopped and leaves the current set in the same frame, so
he never stopped reporting moving. His walkto script then outlived
him and failed every frame on his freed table.

Update IsActorResting to ignore path walking. This doesn't seem to make
a difference, but it's more accurate to the original.

Additionally, the bug still occurred, however 2c997d175cb caused it to
only log once.

Fixes #11788

Changed paths:
    engines/grim/actor.cpp
    engines/grim/actor.h
    engines/grim/lua_v1_actor.cpp


diff --git a/engines/grim/actor.cpp b/engines/grim/actor.cpp
index fe75651416a..6e8fe7e4db8 100644
--- a/engines/grim/actor.cpp
+++ b/engines/grim/actor.cpp
@@ -84,7 +84,7 @@ Actor::Actor() :
 		_pitch(0), _yaw(0), _roll(0), _walkRate(0.3f),
 		_turnRateMultiplier(0.f), _talkAnim(0),
 		_reflectionAngle(80), _scale(1.f), _timeScale(1.f),
-		_visible(true), _lipSync(nullptr), _turning(false), _singleTurning(false), _walking(false),
+		_visible(true), _lipSync(nullptr), _turning(false), _singleTurning(false), _pathWalking(false),
 		_walkedLast(false), _walkedCur(false),
 		_collisionMode(CollisionOff), _collisionScale(1.f),
 		_lastTurnDir(0), _currTurnDir(0),
@@ -185,7 +185,7 @@ void Actor::saveState(SaveGame *savedState) const {
 	savedState->writeFloat(_movePitch.getDegrees());
 	savedState->writeFloat(_moveRoll.getDegrees());
 
-	savedState->writeBool(_walking);
+	savedState->writeBool(_pathWalking);
 	savedState->writeVector3d(_destPos);
 
 	_restChore.saveState(savedState);
@@ -362,7 +362,7 @@ bool Actor::restoreState(SaveGame *savedState) {
 		_moveRoll = _roll;
 	}
 
-	_walking = savedState->readBool();
+	_pathWalking = savedState->readBool();
 	_destPos = savedState->readVector3d();
 
 	_restChore.restoreState(savedState, this);
@@ -514,7 +514,7 @@ void Actor::setRot(const Math::Angle &pitchParam, const Math::Angle &yawParam, c
 }
 
 void Actor::setPos(const Math::Vector3d &position) {
-	_walking = false;
+	_pathWalking = false;
 	_pos = position;
 
 	// Don't allow positions outside the sectors.
@@ -602,9 +602,9 @@ void Actor::turnTo(const Math::Angle &pitchParam, const Math::Angle &yawParam, c
 
 void Actor::walkTo(const Math::Vector3d &p) {
 	if (p == _pos)
-		_walking = false;
+		_pathWalking = false;
 	else {
-		_walking = true;
+		_pathWalking = true;
 		_destPos = p;
 		_path.clear();
 
@@ -751,7 +751,7 @@ void Actor::walkTo(const Math::Vector3d &p) {
 			if (!pathFound) {
 				warning("Actor::walkTo(): No path found for %s", _name.c_str());
 				if (g_grim->getGameType() == GType_MONKEY4) {
-					_walking = false;
+					_pathWalking = false;
 					return;
 				}
 			}
@@ -761,8 +761,12 @@ void Actor::walkTo(const Math::Vector3d &p) {
 	}
 }
 
-bool Actor::isWalking() const {
-	return _walkedLast || _walkedCur || _walking;
+bool Actor::isPathWalking() const {
+	return _pathWalking;
+}
+
+bool Actor::hasWalked() const {
+	return _walkedCur || _walkedLast;
 }
 
 bool Actor::isTurning() const {
@@ -887,7 +891,7 @@ void Actor::walkForward() {
 		_walkedCur = true;
 	}
 
-	_walking = false;
+	_pathWalking = false;
 
 	if (!_followBoxes) {
 		Math::Vector3d forwardVec(-_moveYaw.getSine(),
@@ -1154,7 +1158,7 @@ void Actor::stopAllChores(bool ignoreLoopingChores) {
 }
 
 void Actor::turn(int dir) {
-	_walking = false;
+	_pathWalking = false;
 	float delta = g_grim->getPerSecond(_turnRate) * dir * _timeScale;
 	if (g_grim->getGameType() == GType_MONKEY4) {
 		delta = -delta;
@@ -1568,13 +1572,12 @@ void Actor::updateWalk() {
 	Math::Vector3d dir = destPos - _pos;
 	float dist = dir.getMagnitude();
 
-	_walkedCur = true;
 	float walkAmt = g_grim->getPerSecond(_walkRate) * _timeScale;
 	if (walkAmt >= dist) {
 		walkAmt = dist;
 		_path.pop_back();
 		if (_path.empty()) {
-			_walking = false;
+			_pathWalking = false;
 			_pos = destPos;
 			// It seems that we need to allow an already active turning motion to
 			// continue or else turning actors away from barriers won't work right
@@ -1582,6 +1585,7 @@ void Actor::updateWalk() {
 			return;
 		}
 	}
+	_walkedCur = true;
 
 	turnTo(destPos, true);
 
@@ -1604,7 +1608,7 @@ void Actor::update(uint frameTime) {
 	// Snap actor to walkboxes if following them.  This might be
 	// necessary for example after activating/deactivating
 	// walkboxes, etc.
-	if (_followBoxes && !_walking) {
+	if (_followBoxes && !_pathWalking) {
 		set->findClosestSector(_pos, nullptr, &_pos);
 	}
 
@@ -1639,7 +1643,7 @@ void Actor::update(uint frameTime) {
 		}
 	}
 
-	if (_walking) {
+	if (_pathWalking) {
 		updateWalk();
 	}
 
diff --git a/engines/grim/actor.h b/engines/grim/actor.h
index 486505bb5ea..038166fbe75 100644
--- a/engines/grim/actor.h
+++ b/engines/grim/actor.h
@@ -164,23 +164,29 @@ public:
 	 *
 	 * @param position The destination position.
 	 * @see stopWalking
-	 * @see isWalking
+	 * @see isPathWalking
 	 */
 	void walkTo(const Math::Vector3d &position);
 	/**
 	 * Stops immediately the actor's walk.
 	 *
 	 * @see walkTo
-	 * @see isWalking
+	 * @see isPathWalking
 	 */
-	void stopWalking() { _walking = false; }
+	void stopWalking() { _pathWalking = false; }
 	/**
 	 * Returns true if the actor is walking to a position.
 	 *
 	 * @see walkTo
 	 * @see stopWalking
 	 */
-	bool isWalking() const;
+	bool isPathWalking() const;
+	/**
+	 * Returns true if the actor moved by walking in this frame or the last one.
+	 *
+	 * @see isPathWalking
+	 */
+	bool hasWalked() const;
 
 	/**
 	 * Sets the rotation of thes actor in the 3D scene.
@@ -645,7 +651,7 @@ private:
 	float _turnRateMultiplier;
 
 	// Variables for walking to a point
-	bool _walking;
+	bool _pathWalking;
 	Math::Vector3d _destPos;
 
 	//chores
diff --git a/engines/grim/lua_v1_actor.cpp b/engines/grim/lua_v1_actor.cpp
index 62bed7ba138..e582e02b015 100644
--- a/engines/grim/lua_v1_actor.cpp
+++ b/engines/grim/lua_v1_actor.cpp
@@ -610,7 +610,7 @@ void Lua_V1::IsActorMoving() {
 		return;
 
 	Actor *actor = getactor(actorObj);
-	pushbool(actor->isWalking());
+	pushbool(actor->isPathWalking());
 }
 
 void Lua_V1::IsActorResting() {
@@ -620,7 +620,7 @@ void Lua_V1::IsActorResting() {
 
 	Actor *actor = getactor(actorObj);
 	// FIXME verify if exist one flag for resting mode
-	pushbool(!(actor->isWalking() || actor->isTurning()));
+	pushbool(!(actor->hasWalked() || actor->isTurning()));
 }
 
 /* Get the location of one of the actor's nodes, this is




More information about the Scummvm-git-logs mailing list