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

OMGPizzaGuy noreply at scummvm.org
Sun Feb 19 05:36:27 UTC 2023


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

Summary:
c1089937c3 ULTIMA8: Stop gravity process from putting items in a negative Z coordinate


Commit: c1089937c35e905425d75976ee7be748f9294ade
    https://github.com/scummvm/scummvm/commit/c1089937c35e905425d75976ee7be748f9294ade
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-02-18T23:36:10-06:00

Commit Message:
ULTIMA8: Stop gravity process from putting items in a negative Z coordinate
This better follows original behavior and fixes accidental deletion of main actor. Fixes #14053

Changed paths:
    engines/ultima/ultima8/world/actors/actor_anim_process.cpp
    engines/ultima/ultima8/world/actors/u8_avatar_mover_process.cpp
    engines/ultima/ultima8/world/gravity_process.cpp


diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index b58f546868f..c1962b15f63 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -211,7 +211,7 @@ void ActorAnimProcess::run() {
 #endif
 
 				// TODO: there are _three_ places where we can fall; clean up
-				if (_tracker->isUnsupported()) {
+				if (_tracker->isUnsupported() && z > 0) {
 #ifdef WATCHACTOR
 					if (_itemNum == watchactor) {
 						debugC(kDebugActor, "Animation [%u] ActorAnimProcess falling at end",
@@ -239,7 +239,7 @@ void ActorAnimProcess::run() {
 						  Kernel::get_instance()->getFrameNum());
 #endif
 
-				if (_tracker->isUnsupported()) {
+				if (_tracker->isUnsupported() && z > 0) {
 #ifdef WATCHACTOR
 					if (_itemNum == watchactor) {
 						debugC(kDebugActor, "Animation [%u] ActorAnimProcess falling from blocked",
@@ -352,7 +352,7 @@ void ActorAnimProcess::run() {
 
 
 	if (_repeatCounter == _tracker->getAnimAction()->getFrameRepeat()) {
-		if (_tracker->isUnsupported()) {
+		if (_tracker->isUnsupported() && z > 0) {
 			_animAborted = !_tracker->getAnimAction()->hasFlags(AnimAction::AAF_UNSTOPPABLE);
 
 #ifdef WATCHACTOR
diff --git a/engines/ultima/ultima8/world/actors/u8_avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/u8_avatar_mover_process.cpp
index b60e3b9c271..14f700d1771 100644
--- a/engines/ultima/ultima8/world/actors/u8_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/u8_avatar_mover_process.cpp
@@ -681,11 +681,15 @@ void U8AvatarMoverProcess::step(Animation::Sequence action, Direction direction,
 
 	if (action == Animation::step && res == Animation::END_OFF_LAND &&
 	        lastanim != Animation::keepBalance && !adjusted) {
-		if (checkTurn(stepdir, false))
+		int32 ax, ay, az;
+		avatar->getLocation(ax, ay, az);
+		if (az > 0) {
+			if (checkTurn(stepdir, false))
+				return;
+			debug(6, "Step: end off land both altdirs failed, keep balance.");
+			waitFor(avatar->doAnim(Animation::keepBalance, stepdir));
 			return;
-		debug(6, "Step: end off land both altdirs failed, keep balance.");
-		waitFor(avatar->doAnim(Animation::keepBalance, stepdir));
-		return;
+		}
 	}
 
 	if (action == Animation::step && res == Animation::FAILURE) {
diff --git a/engines/ultima/ultima8/world/gravity_process.cpp b/engines/ultima/ultima8/world/gravity_process.cpp
index a5188a01708..360fa611c94 100644
--- a/engines/ultima/ultima8/world/gravity_process.cpp
+++ b/engines/ultima/ultima8/world/gravity_process.cpp
@@ -99,18 +99,9 @@ void GravityProcess::run() {
 	int32 ix, iy, iz;
 	item->getLocation(ix, iy, iz);
 
-	//
-	// Shouldn't go very negative as item should always hit the floor.
-	//
-	// Slight hack here because Mordea falls through the floor when she
-	// wakes up - set a value big enough that the next event can happen
-	// before we destroy the actor.
-	//
-	if (iz < -5000) {
-		warning("Item %d fell too far, stopping GravityProcess", _itemNum);
+	// Shouldn't go negative as original did not allow it
+	if (iz <= 0 && _zSpeed < 0) {
 		terminate();
-		_itemNum = 0;
-		item->destroy();
 		return;
 	}
 
@@ -119,6 +110,9 @@ void GravityProcess::run() {
 	ty = iy + _ySpeed;
 	tz = iz + _zSpeed;
 
+	if (tz < 0)
+		tz = 0;
+
 //#define BOUNCE_DIAG
 
 	ObjId hititemid;




More information about the Scummvm-git-logs mailing list