[Scummvm-git-logs] scummvm master -> 20e084259c92f8d2314c8e1ee3a2d7e2b44fda05

mduggan noreply at scummvm.org
Sat Jan 1 11:43:22 UTC 2022


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

Summary:
6dde48b8c9 ULTIMA8: slight damage and targeting tweaks for No Regret
739cd1bf5c ULTIMA8: Fix turns in Crusader pace process
6a5a46eac6 ULTIMA8: Fix initial NPC directions
9d6b535d86 ULTIMA8: JANITORIAL: Remove out-of-date comment
b08bf2d4c4 ULTIMA8: Slight cleanup, remove hard-coded actor nums
2df1a2cb30 ULTIMA8: Make initializer value explicit
20e084259c ULTIMA8: Fix on-screen checks for Crusader games


Commit: 6dde48b8c94e7b37e505b55aa490c3871639cf56
    https://github.com/scummvm/scummvm/commit/6dde48b8c94e7b37e505b55aa490c3871639cf56
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: slight damage and targeting tweaks for No Regret

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


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 5bab5a92c72..d7ac36c564c 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -1764,7 +1764,7 @@ bool Actor::isFalling() const {
 	return (proc && proc->is_active());
 }
 
-CombatProcess *Actor::getCombatProcess() {
+CombatProcess *Actor::getCombatProcess() const {
 	Process *p = Kernel::get_instance()->findProcess(_objId, 0xF2); // CONSTANT!
 	if (!p)
 		return nullptr;
@@ -1774,7 +1774,7 @@ CombatProcess *Actor::getCombatProcess() {
 	return cp;
 }
 
-AttackProcess *Actor::getAttackProcess() {
+AttackProcess *Actor::getAttackProcess() const {
 	Process *p = Kernel::get_instance()->findProcess(_objId, AttackProcess::ATTACK_PROCESS_TYPE);
 	if (!p)
 		return nullptr;
diff --git a/engines/ultima/ultima8/world/actors/actor.h b/engines/ultima/ultima8/world/actors/actor.h
index f80a5b98efa..cb59e494d8c 100644
--- a/engines/ultima/ultima8/world/actors/actor.h
+++ b/engines/ultima/ultima8/world/actors/actor.h
@@ -89,8 +89,8 @@ public:
 
 	bool isFalling() const;
 
-	CombatProcess *getCombatProcess(); 	// in U8
-	AttackProcess *getAttackProcess();	// in Crusader
+	CombatProcess *getCombatProcess() const; 	// in U8
+	AttackProcess *getAttackProcess() const;	// in Crusader
 	virtual void setInCombat(int activity);
 	virtual void clearInCombat();
 
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index e9f14e56adf..7fe237b184b 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -53,6 +53,7 @@
 #include "ultima/ultima8/world/super_sprite_process.h"
 #include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/world/actors/main_actor.h"
+#include "ultima/ultima8/world/actors/attack_process.h"
 #include "ultima/ultima8/world/missile_tracker.h"
 #include "ultima/ultima8/world/crosshair_process.h"
 #include "ultima/ultima8/world/actors/anim_action.h"
@@ -1269,15 +1270,34 @@ uint16 Item::fireWeapon(int32 x, int32 y, int32 z, Direction dir, int firetype,
 	// is clean for both Item and Actor.
 	DirectionMode dirmode = dirmode_8dirs;
 	const Actor *thisactor = dynamic_cast<Actor *>(this);
+	Item *target = nullptr;
 	if (thisactor) {
-		// TODO: Get damage for active inventory item if not a weapon?
 		dirmode = thisactor->animDirMode(thisactor->getLastAnim());
+
+		// In the original code there is logic here deciding whether to get
+		// damage for the active weapon or some other item, but in the end
+		// it always gets random damage for the same firetype, so as far as
+		// I can tell it makes no difference.
+
+		// In No Regret, we get another chance to increase damage.  We also
+		// set target based on the npc attack rather than whatever controlled
+		// actor is.
+		if (GAME_IS_REGRET) {
+			if (damage < 2)
+				damage = firetypedat->getRandomDamage();
+
+			AttackProcess *attackproc = thisactor->getAttackProcess();
+			if (attackproc) {
+				target = getActor(attackproc->getTarget());
+			}
+		}
 	}
 
-	Item *target = nullptr;
 	if (findtarget) {
 		if (this != getControlledActor()) {
-			target = getControlledActor();
+			if (GAME_IS_REMORSE || !thisactor)
+				target = getControlledActor();
+			// else already set above to attackproc target
 		} else {
 			target = currentmap->findBestTargetItem(ix, iy, iz - z, dir, dirmode);
 		}


Commit: 739cd1bf5c09c98f8b2b169d0511869baad55c84
    https://github.com/scummvm/scummvm/commit/739cd1bf5c09c98f8b2b169d0511869baad55c84
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: Fix turns in Crusader pace process

Previously we were not waiting for the correct anim process in the turn, which
caused frequent ANIM_LOCK warnings and the actors did not turn to the correct
final direction.

This fixes pace so they now correctly pace back and forth.

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


diff --git a/engines/ultima/ultima8/world/actors/pace_process.cpp b/engines/ultima/ultima8/world/actors/pace_process.cpp
index 790f132e757..b131a5ad784 100644
--- a/engines/ultima/ultima8/world/actors/pace_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pace_process.cpp
@@ -98,12 +98,12 @@ void PaceProcess::run() {
 
 		// Stand, turn around, and wait for 60.
 		uint16 standprocid = a->doAnim(Animation::stand, a->getDir());
-		uint16 turnprocid = a->turnTowardDir(Direction_Invert(a->getDir()));
-		Process *turnproc = kernel->getProcess(turnprocid);
-		turnproc->waitFor(standprocid);
+		//debug("PaceProcess: actor %d turning from %d to %d", a->getObjId(),
+		//	  a->getDir(), Direction_Invert(a->getDir()));
+		uint16 turnprocid = a->turnTowardDir(Direction_Invert(a->getDir()), standprocid);
 		Process *waitproc = new DelayProcess(60);
 		Kernel::get_instance()->addProcess(waitproc);
-		waitproc->waitFor(turnproc);
+		waitproc->waitFor(turnprocid);
 		waitFor(waitproc);
 	}
 }


Commit: 6a5a46eac66bac45fb6ec9a902e0cc61ee318530
    https://github.com/scummvm/scummvm/commit/6a5a46eac66bac45fb6ec9a902e0cc61ee318530
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: Fix initial NPC directions

The original multiplies the direction value by 2 on load.

This and the previous fix to Pace Process fixes the first NPC guard in No
Remorse difficulty level so he now behaves almost identical to the original
game, yay!

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 d7ac36c564c..53a5a10a2be 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -1999,7 +1999,7 @@ void Actor::dumpInfo() const {
 	     << ", dex: " << _dexterity << ", int: " << _intelligence
 	     << ", ac: " << getArmourClass() << ", defense: " << ConsoleStream::hex
 	     << getDefenseType() << " align: " << getAlignment() << " enemy: "
-	     << getEnemyAlignment() << ", flags: " << _actorFlags
+	     << getEnemyAlignment() << ", flags: " << _actorFlags << ", activity: " << _currentActivityNo
 	     << ConsoleStream::dec << Std::endl;
 }
 
@@ -2597,7 +2597,8 @@ uint32 Actor::I_createActor(const uint8 *args, unsigned int /*argsize*/) {
 	UCMachine::get_instance()->assignPointer(ptr, buf, 2);
 
 #if 0
-	perr << "I_createActor: created actor #" << objID << " with shape " << shape << Std::endl;
+	perr << "I_createActor: created actor #" << objID << " shape "
+		 << shape << " frame " << frame << Std::endl;
 #endif
 
 	return objID;
@@ -2647,7 +2648,7 @@ uint32 Actor::I_createActorCru(const uint8 *args, unsigned int /*argsize*/) {
 		return 0;
 	}
 
-	newactor->setDir(Direction_FromUsecodeDir(dir));
+	newactor->setDir(static_cast<Direction>(dir * 2));
 
 	int32 x, y, z;
 	item->getLocation(x, y, z);


Commit: 9d6b535d86d62739d0916cc8ae38d96fc34b1af1
    https://github.com/scummvm/scummvm/commit/9d6b535d86d62739d0916cc8ae38d96fc34b1af1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: JANITORIAL: Remove out-of-date comment

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


diff --git a/engines/ultima/ultima8/world/item_factory.cpp b/engines/ultima/ultima8/world/item_factory.cpp
index 9a24c6c5495..cf7db431a08 100644
--- a/engines/ultima/ultima8/world/item_factory.cpp
+++ b/engines/ultima/ultima8/world/item_factory.cpp
@@ -125,11 +125,6 @@ static Actor *getActorForNpcNum(uint32 npcnum) {
 Actor *ItemFactory::createActor(uint32 shape, uint32 frame, uint16 quality,
 								uint16 flags, uint16 npcnum, uint16 mapnum,
 								uint32 extendedflags, bool objId) {
-	/*
-	    // This makes it rather hard to create new NPCs...
-	    if (npcnum == 0) // or do monsters have npcnum 0? we'll see...
-	        return nullptr;
-	*/
 	// New actor, no lerping
 	extendedflags |= Item::EXT_LERP_NOPREV;
 


Commit: b08bf2d4c4ec85c9bb20084448d40eb535438a4a
    https://github.com/scummvm/scummvm/commit/b08bf2d4c4ec85c9bb20084448d40eb535438a4a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: Slight cleanup, remove hard-coded actor nums

Changed paths:
    engines/ultima/ultima8/gumps/game_map_gump.cpp
    engines/ultima/ultima8/world/camera_process.cpp


diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index f103440fc35..3b471f4185e 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -321,9 +321,8 @@ void GameMapGump::onMouseClick(int button, int32 mx, int32 my) {
 			item->dumpInfo();
 
 #if 1
-			Actor *devon = getActor(1);
-			PathfinderProcess *pfp = new PathfinderProcess(devon, xv, yv, zv);
-//			PathfinderProcess* pfp = new PathfinderProcess(devon, objID, false);
+			Actor *avatar = getControlledActor();
+			PathfinderProcess *pfp = new PathfinderProcess(avatar, xv, yv, zv);
 			Kernel::get_instance()->addProcess(pfp);
 #elif 0
 			if (dynamic_cast<Actor *>(item)) {
diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 673d5b69d4f..fab4e54c872 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -81,14 +81,15 @@ void CameraProcess::GetCameraLocation(int32 &x, int32 &y, int32 &z) {
 		World *world = World::get_instance();
 		CurrentMap *map = world->getCurrentMap();
 		int map_num = map->getNum();
-		Actor *av = getActor(1);
+		Actor *av = getControlledActor();
 
 		if (!av || av->getMapNum() != map_num) {
 			x = 8192;
 			y = 8192;
 			z = 64;
-		} else
+		} else {
 			av->getLocation(x, y, z);
+		}
 
 		if (_earthquake) {
 			x += 2 * _eqX + 4 * _eqY;


Commit: 2df1a2cb30f226207c318393e559d655873da2a1
    https://github.com/scummvm/scummvm/commit/2df1a2cb30f226207c318393e559d655873da2a1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: Make initializer value explicit

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


diff --git a/engines/ultima/ultima8/world/snap_process.cpp b/engines/ultima/ultima8/world/snap_process.cpp
index a7968aced52..41ce4027a18 100644
--- a/engines/ultima/ultima8/world/snap_process.cpp
+++ b/engines/ultima/ultima8/world/snap_process.cpp
@@ -34,7 +34,7 @@ SnapProcess *SnapProcess::_instance = nullptr;
 
 DEFINE_RUNTIME_CLASSTYPE_CODE(SnapProcess)
 
-SnapProcess::SnapProcess() : Process(), _currentSnapEgg() {
+SnapProcess::SnapProcess() : Process(), _currentSnapEgg(0) {
 	_instance = this;
 	_type = 1; // persistent
 }


Commit: 20e084259c92f8d2314c8e1ee3a2d7e2b44fda05
    https://github.com/scummvm/scummvm/commit/20e084259c92f8d2314c8e1ee3a2d7e2b44fda05
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-01T20:41:07+09:00

Commit Message:
ULTIMA8: Fix on-screen checks for Crusader games

Previously these checked against the whole footpad but they should check
against the shape frame dimensions to be faithful to the original games.

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 7fe237b184b..965911e4004 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -31,6 +31,7 @@
 #include "ultima/ultima8/graphics/main_shape_archive.h"
 #include "ultima/ultima8/graphics/gump_shape_archive.h"
 #include "ultima/ultima8/graphics/shape.h"
+#include "ultima/ultima8/graphics/shape_frame.h"
 #include "ultima/ultima8/world/item_factory.h"
 #include "ultima/ultima8/world/current_map.h"
 #include "ultima/ultima8/world/fire_type.h"
@@ -612,11 +613,15 @@ bool Item::isOnScreen() const {
 	int32 screeny = -1;
 	game_map->GetLocationOfItem(_objId, screenx, screeny);
 	game_map->GetDims(game_map_dims);
-	int32 xd, yd, zd;
-	getFootpadWorld(xd, yd, zd);
+	const Shape *shape = getShapeObject();
+	if (!shape)
+		return false;
+	const ShapeFrame *frame = shape->getFrame(getFrame());
+	if (!frame)
+		return false;
 
-	if (game_map_dims.contains(screenx, screeny) &&
-	    game_map_dims.contains(screenx + xd, screeny + yd)) {
+	if (game_map_dims.contains(screenx - frame->_xoff, screeny - frame->_yoff) &&
+	    game_map_dims.contains(screenx + frame->_width, screeny + frame->_height)) {
 		return true;
 	}
 
@@ -634,11 +639,15 @@ bool Item::isPartlyOnScreen() const {
 	int32 screeny = -1;
 	game_map->GetLocationOfItem(_objId, screenx, screeny);
 	game_map->GetDims(game_map_dims);
-	int32 xd, yd, zd;
-	getFootpadWorld(xd, yd, zd);
+	const Shape *shape = getShapeObject();
+	if (!shape)
+		return false;
+	const ShapeFrame *frame = shape->getFrame(getFrame());
+	if (!frame)
+		return false;
 
-	if (game_map_dims.contains(screenx, screeny) ||
-		game_map_dims.contains(screenx + xd, screeny + yd)) {
+	if (game_map_dims.contains(screenx - frame->_xoff, screeny - frame->_yoff) ||
+		game_map_dims.contains(screenx + frame->_width, screeny + frame->_height)) {
 		return true;
 	}
 




More information about the Scummvm-git-logs mailing list