[Scummvm-git-logs] scummvm master -> fa48015bbddcb5e8a11707107efb9249fa7395b4

athrxx athrxx at scummvm.org
Sun Jun 6 14:30:53 UTC 2021


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

Summary:
c57243ae85 SCUMM: (ZAK) - fix bug #12278 ("Zak's positioning in the intro")
74ed6d94c8 SCUMM: (SCUMM1-3) - (very minor) fix for walk dir interpolation
f5ed4d54d3 SCUMM: (SCUMM1-3) - fix actor facing for diagonal walks
a408f44c1b SCUMM: (SCUMM1/2) - fix bug no. 4594 ("Zak keeps walk animation without moving")
fa48015bbd SCUMM: (ZAK/TOWNS) - fix bug no. 4594 and 4601


Commit: c57243ae85cd6e49ad86969eafb2ab727ed39c3f
    https://github.com/scummvm/scummvm/commit/c57243ae85cd6e49ad86969eafb2ab727ed39c3f
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-06T16:00:51+02:00

Commit Message:
SCUMM: (ZAK) - fix bug #12278 ("Zak's positioning in the intro")

(added 2 lines of code from disasm)

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b7f6778dd8..961993c607 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -536,6 +536,9 @@ int Actor::actorWalkStep() {
 			startWalkAnim(1, nextFacing);
 		}
 		_moving |= MF_IN_LEG;
+		// The next two lines fix bug #12278. I limit this to <= SCUMM3 for now, since I have only checked disasms of ZAK FM-TOWNS, ZAK DOS V1, LOOM DOS.
+		if (_vm->_game.version <= 3)
+			return 1;
 	}
 
 	if (_walkbox != _walkdata.curbox && _vm->checkXYInBoxBounds(_walkdata.curbox, _pos.x, _pos.y)) {
@@ -1116,7 +1119,7 @@ void Actor_v2::walkActor() {
 	if (_moving & MF_TURN) {
 		new_dir = updateActorDirection(false);
 		if (_facing != new_dir) {
-			setDirection(new_dir);
+			setDirection(new_dir); 
 		} else {
 			_moving = 0;
 		}


Commit: 74ed6d94c8fa6f4f770f57b888c9be2f5e6768ce
    https://github.com/scummvm/scummvm/commit/74ed6d94c8fa6f4f770f57b888c9be2f5e6768ce
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-06T16:01:10+02:00

Commit Message:
SCUMM: (SCUMM1-3) - (very minor) fix for walk dir interpolation

Our current interpolation does not always turn characters in the same direction as the original, e. g. when walking straight up or down the original will always turn the character counter-clockwise. I implemented the interpolation table used by the original interpreters for more faithful display. Verified visually for v1-v3, and from disasm for v3 and v1.

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 961993c607..6bafc1aeff 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1379,21 +1379,26 @@ int Actor::updateActorDirection(bool is_walking) {
 	dir &= 1023;
 
 	if (shouldInterpolate) {
-		int to = toSimpleDir(dirType, dir);
-		int num = dirType ? 8 : 4;
-
-		// Turn left or right, depending on which is shorter.
-		int diff = to - from;
-		if (ABS(diff) > (num >> 1))
-			diff = -diff;
+		if (_vm->_game.version <= 3) {
+			static const uint8 tbl[] = { 0, 2, 2, 3, 2, 1, 2, 3, 0, 1, 2, 1, 0, 1, 0, 3 };
+			dir = oldDirToNewDir(tbl[newDirToOldDir(dir) | (newDirToOldDir(_facing) << 2)]);
+		} else {
+			int to = toSimpleDir(dirType, dir);
+			int num = dirType ? 8 : 4;
+
+			// Turn left or right, depending on which is shorter.
+			int diff = to - from;
+			if (ABS(diff) > (num >> 1))
+				diff = -diff;
+
+			if (diff > 0) {
+				to = from + 1;
+			} else if (diff < 0) {
+				to = from - 1;
+			}
 
-		if (diff > 0) {
-			to = from + 1;
-		} else if (diff < 0){
-			to = from - 1;
+			dir = fromSimpleDir(dirType, (to + num) % num);
 		}
-
-		dir = fromSimpleDir(dirType, (to + num) % num);
 	}
 
 	return dir;


Commit: f5ed4d54d3fb31172da899d2cb2ceb69acd58bf7
    https://github.com/scummvm/scummvm/commit/f5ed4d54d3fb31172da899d2cb2ceb69acd58bf7
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-06T16:01:19+02:00

Commit Message:
SCUMM: (SCUMM1-3) - fix actor facing for diagonal walks

While testing fixes for bug no. 12278 I also noticed that the actor facing when walking diagonally did not match the original behavior when I had the ZAK intros running in ScummVM and UNZ (for Zak-Towns) and ScummVM and DosBox (for Zak-DOS-V1 and V2).

This is about the decision whether a character that walks diagonally should face up/down or left/right. I implemented the original method to determine the facing.

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 6bafc1aeff..b0f92d4d9e 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -515,8 +515,9 @@ int Actor::calcMovementFactor(const Common::Point& next) {
 	_walkdata.xfrac = 0;
 	_walkdata.yfrac = 0;
 
-	if (_vm->_game.version <= 2)
-		_targetFacing = getAngleFromPos(V12_X_MULTIPLIER*deltaXFactor, V12_Y_MULTIPLIER*deltaYFactor, false);
+	if (_vm->_game.version <= 3)
+		// The x/y distance ratio which determines whether to face up/down instead of left/right is different for SCUMM1/2 and SCUMM3.
+		_targetFacing = oldDirToNewDir(((ABS(diffY) * (_vm->_game.version == 3 ? 3 : 1)) > ABS(diffX)) ? 3 - (diffY >= 0 ? 1 : 0) : (diffX >= 0 ? 1 : 0));
 	else
 		_targetFacing = getAngleFromPos(deltaXFactor, deltaYFactor, (_vm->_game.id == GID_DIG || _vm->_game.id == GID_CMI));
 


Commit: a408f44c1b689673d5d101a848d938f0f97e05af
    https://github.com/scummvm/scummvm/commit/a408f44c1b689673d5d101a848d938f0f97e05af
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-06T16:01:50+02:00

Commit Message:
SCUMM: (SCUMM1/2) - fix bug no. 4594 ("Zak keeps walk animation without moving")

This is only the fix for SCUMM1/2. It fixes at least the bug described in the ticket (clicking on the shop manager after buying a lotto ticket). Unlike later versions V1/2 adds and removes the MF_TURN flag on the actor without touching the other bits. I have verified this from disasm and dosbox debugging.

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b0f92d4d9e..62acc07ae8 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1122,7 +1122,7 @@ void Actor_v2::walkActor() {
 		if (_facing != new_dir) {
 			setDirection(new_dir); 
 		} else {
-			_moving = 0;
+			_moving &= ~MF_TURN;
 		}
 		return;
 	}
@@ -1484,11 +1484,12 @@ void Actor::turnToDirection(int newdir) {
 	if (_vm->_game.version <= 6) {
 		_targetFacing = newdir;
 
-		if (_vm->_game.version == 0) {
+		if (_vm->_game.version == 0)
 			setDirection(newdir);
-			return;
-		}
-		_moving = MF_TURN;
+		else if (_vm->_game.version <= 2)
+			_moving |= MF_TURN;
+		else
+			_moving = MF_TURN;
 
 	} else {
 		_moving &= ~MF_TURN;


Commit: fa48015bbddcb5e8a11707107efb9249fa7395b4
    https://github.com/scummvm/scummvm/commit/fa48015bbddcb5e8a11707107efb9249fa7395b4
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-06T16:02:00+02:00

Commit Message:
SCUMM: (ZAK/TOWNS) - fix bug no. 4594 and 4601

4594: "Zak keeps walk animation without moving"

4601: "SCUMM: Zak McKracken (FM-Towns) - shopkeeper keeps walking"

Bug 4594 also happens with the original ZAK FM-TOWNS interpreter (unlike SCUMM1/2). I have added a workaround similiar to PR #2991.

Bug 4601 does not happen with the original, although it seems to have the exaxct same cause and is also fixed by this workaround. So I have stopped exploring this one for now.

I have limited the workaround to ZAK, since the bug reports are all from that game. To me, it looks like an oversight when converting the original SCUMM1/2 scripts to SCUMM3.

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 62acc07ae8..b07a3d3042 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1188,10 +1188,19 @@ void Actor_v3::walkActor() {
 
 		if (_moving & MF_TURN) {
 			new_dir = updateActorDirection(false);
-			if (_facing != new_dir)
+			if (_facing != new_dir) {
 				setDirection(new_dir);
-			else
+			} else {
+				// WORKAROUND for bug #4594 ("SCUMM: Zak McKracken - Zak keeps walk animation without moving")
+				// This bug also happens with the original SCUMM3 (ZAK FM-TOWNS) interpreter (unlike SCUMM1/2
+				// where the actors are apparently supposed to continue walking after being turned). We have
+				// to stop the walking animation here...
+				// This also fixes bug #4601 ("SCUMM: Zak McKracken (FM-Towns) - shopkeeper keeps walking"),
+				// although that one does not happen with the original interpreter.
+				if (_vm->_game.id == GID_ZAK && _moving == MF_TURN)
+					startAnimActor(_standFrame);
 				_moving = 0;
+			}
 			return;
 		}
 




More information about the Scummvm-git-logs mailing list