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

mduggan mgithub at guarana.org
Thu Apr 15 14:11:11 UTC 2021


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

Summary:
cf8f7b7bb8 ULTIMA8: Drop lowest bit of flags in Crusader
2893f475c4 ULTIMA8: Comment to explain fix to original game bug
e11f26ffc3 ULTIMA8: Fix small TODO now needed code is implemented
b2bfe6592b ULTIMA8: Only update Cruasder targeting on shape change if old shape was valid
f85fd6ac39 ULTIMA8: Only reset item gravityPID if it was the current gravity process
fcf2d469f6 ULTIMA8: Disable overly chatty debug output


Commit: cf8f7b7bb8f8f9f780bc9b5779a4664f7b6a18e8
    https://github.com/scummvm/scummvm/commit/cf8f7b7bb8f8f9f780bc9b5779a4664f7b6a18e8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T22:35:40+09:00

Commit Message:
ULTIMA8: Drop lowest bit of flags in Crusader

And add a comment explaining why - it's just a spare sign bit for the deltaDir
value which we don't actually need.

Changed paths:
    engines/ultima/ultima8/graphics/anim_dat.cpp


diff --git a/engines/ultima/ultima8/graphics/anim_dat.cpp b/engines/ultima/ultima8/graphics/anim_dat.cpp
index 4a6bd4a4cd..3c230f00c7 100644
--- a/engines/ultima/ultima8/graphics/anim_dat.cpp
+++ b/engines/ultima/ultima8/graphics/anim_dat.cpp
@@ -245,8 +245,13 @@ void AnimDat::load(Common::SeekableReadStream *rs) {
 						f._sfx = rs->readByte();
 						// byte 4: deltadir (signed) - convert to pixels
 						f._deltaDir = rs->readSByte();
-						// byte 5: flags
-						f._flags = rs->readByte();
+						// byte 5: flags.  The lowest bit is actually a sign bit for
+						// deltaDir, which is technically 9 bits long.  There are no
+						// animations in the game exceeding 8-bit signed, the 9th bit
+						// is there so that multiple frames can be stacked in the same
+						// struct by the original game when it's skipping frames.
+						// We have more memory and don't frame-skip, so just ignore it.
+						f._flags = rs->readByte() & 0xFE;
 						f._flags += (x & 0xF0) << 8;
 						// bytes 6, 7: more flags
 						f._flags += rs->readUint16LE() << 16;


Commit: 2893f475c42a81818fee77ed05f8d345cf5e148c
    https://github.com/scummvm/scummvm/commit/2893f475c42a81818fee77ed05f8d345cf5e148c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T22:35:40+09:00

Commit Message:
ULTIMA8: Comment to explain fix to original game bug

Changed paths:
    engines/ultima/ultima8/world/item.cpp


diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 74472e2d23..f8ab427041 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1694,7 +1694,17 @@ void Item::setupLerp(int32 gametick) {
 	// Clear the flag
 	_extendedFlags &= ~EXT_LERP_NOPREV;
 
-	// Animate it, if needed
+	// Animate it, if needed.
+	//
+	// We use (tick % speed == 0) here. To be completely faithful to the original
+	// game it should be (tick % speed == tick % _objId).  That is how the game
+	// does it, but it also causes animation frame mismatches on multi-shape
+	// objects.  This is easily noticable on the waterfall West of Tenebrae,
+	// which appears to tear slightly even on the original.
+	//
+	// In the original it was likely done to spread CPU time over different frames,
+	// but it's a little bit nicer to do it correctly now that we can afford to..
+	//
 	const ShapeInfo *info = getShapeInfo();
 	if (info->_animType &&
 			((gametick % info->_animSpeed) == 0))


Commit: e11f26ffc39679cc17a587764998c3c1c75729b0
    https://github.com/scummvm/scummvm/commit/e11f26ffc39679cc17a587764998c3c1c75729b0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T22:35:40+09:00

Commit Message:
ULTIMA8: Fix small TODO now needed code is implemented

Changed paths:
    engines/ultima/ultima8/world/actors/actor.cpp


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 6692a7e148..c9b401270d 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -997,8 +997,8 @@ void Actor::receiveHitCru(uint16 other, Direction dir, int damage, uint16 damage
 void Actor::tookHitCru() {
 	Animation::Sequence lastanim = getLastAnim();
 	if (lastanim == Animation::unknownAnim30 || lastanim == Animation::startRunLargeWeapon) {
-		//uint16 controllednpc = World::get_instance()->getControlledNPCNum();
-		bool canseecontrolled = true; //this->canSee(controllednpc);
+		Actor *controlled = getActor(World::get_instance()->getControlledNPCNum());
+		bool canseecontrolled = controlled && (getRangeIfVisible(*controlled) > 0);
 		if (canseecontrolled) {
 			if (getRandom() % 4)
 				setActivity(5);


Commit: b2bfe6592b44057a92ebaea3550d6f469fe71528
    https://github.com/scummvm/scummvm/commit/b2bfe6592b44057a92ebaea3550d6f469fe71528
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T23:06:23+09:00

Commit Message:
ULTIMA8: Only update Cruasder targeting on shape change if old shape was valid

Changed paths:
    engines/ultima/ultima8/world/item.cpp


diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index f8ab427041..9356347844 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -471,7 +471,7 @@ Box Item::getWorldBox() const {
 void Item::setShape(uint32 shape) {
 	_cachedShape = nullptr;
 
-	if (GAME_IS_CRUSADER) {
+	if (GAME_IS_CRUSADER && _shape && shape != _shape) {
 		// In Crusader, here we need to check if the shape
 		// changed from targetable to not-targetable, or vice-versa
 		const ShapeInfo *oldinfo = getShapeInfo();
@@ -479,7 +479,7 @@ void Item::setShape(uint32 shape) {
 		_cachedShapeInfo = nullptr;
 		const ShapeInfo *newinfo = getShapeInfo();
 
-		if (!hasFlags(FLG_BROKEN)) {
+		if (!hasFlags(FLG_BROKEN) && oldinfo && newinfo) {
 			if (oldinfo->is_targetable() && !newinfo->is_targetable()) {
 				World::get_instance()->getCurrentMap()->removeTargetItem(this);
 			}


Commit: f85fd6ac3948a8771ab0d9cb34ded8eeaa3727ef
    https://github.com/scummvm/scummvm/commit/f85fd6ac3948a8771ab0d9cb34ded8eeaa3727ef
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T23:07:27+09:00

Commit Message:
ULTIMA8: Only reset item gravityPID if it was the current gravity process

This is a rareish corner case where the PID changes to a new GravityProcess
before the old GravityProcess terminates.  In this case we don't "own" the PID
any more and shouldn't reset it.

Changed paths:
    engines/ultima/ultima8/world/gravity_process.cpp


diff --git a/engines/ultima/ultima8/world/gravity_process.cpp b/engines/ultima/ultima8/world/gravity_process.cpp
index 77452a5ef1..7e28898f55 100644
--- a/engines/ultima/ultima8/world/gravity_process.cpp
+++ b/engines/ultima/ultima8/world/gravity_process.cpp
@@ -267,10 +267,12 @@ void GravityProcess::terminate() {
 	if (item) {
 		// This is strange, but not impossible (one terminates
 		// and another starts before terminate() gets called).
+		// Don't reset the item's gravityPID in this case.
 		if (item->getGravityPID() != 0 && item->getGravityPID() != _pid)
-			warning("GravityProcess::terminate %d on item %d which has gravityPID %d",
+			warning("GravityProcess::terminate %d on item %d which now has gravityPID %d",
 					_pid, _itemNum, item->getGravityPID());
-		item->setGravityPID(0);
+		else
+			item->setGravityPID(0);
 
 		// no longer bouncing
 		item->clearFlag(Item::FLG_BOUNCING);


Commit: fcf2d469f66c4c173d5783eb655e619949a8d62e
    https://github.com/scummvm/scummvm/commit/fcf2d469f66c4c173d5783eb655e619949a8d62e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-15T23:08:55+09:00

Commit Message:
ULTIMA8: Disable overly chatty debug output

Changed paths:
    engines/ultima/ultima8/world/actors/actor.cpp


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index c9b401270d..4e7b65b833 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -541,13 +541,13 @@ uint16 Actor::doAnim(Animation::Sequence anim, Direction dir, unsigned int steps
 
 	}
 
-#if 1
+#if 0
 	if (_objId == 1) {
 		int32 x, y, z;
 		getLocation(x, y, z);
 		int32 actionno = AnimDat::getActionNumberForSequence(anim, this);
 		const AnimAction *action = GameData::get_instance()->getMainShapes()->getAnim(getShape(), actionno);
-		debug(6, "Actir::doAnim(%d, %d, %d) from (%d, %d, %d) frame repeat %d", anim, dir, steps, x, y, z, action->getFrameRepeat());
+		debug(6, "Actor::doAnim(%d, %d, %d) from (%d, %d, %d) frame repeat %d", anim, dir, steps, x, y, z, action->getFrameRepeat());
 	}
 #endif
 




More information about the Scummvm-git-logs mailing list