[Scummvm-git-logs] scummvm master -> 3b9d950c7a41bedd27e4366d3cf9eb28905e8e3c

mduggan mgithub at guarana.org
Thu Jul 30 07:27:37 UTC 2020


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

Summary:
a1eeed8343 ULTIMA8: Run Crusader at 2 usecode events per frame, much better!
3b9d950c7a ULTIMA8: Use GuardProcess and proper death noises in Crusader


Commit: a1eeed8343485dd3319a2311ec80cdf7b0934ca5
    https://github.com/scummvm/scummvm/commit/a1eeed8343485dd3319a2311ec80cdf7b0934ca5
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-30T16:26:18+09:00

Commit Message:
ULTIMA8: Run Crusader at 2 usecode events per frame, much better!

Changed paths:
    engines/ultima/ultima8/graphics/anim_dat.cpp
    engines/ultima/ultima8/misc/direction_util.h
    engines/ultima/ultima8/ultima8.cpp


diff --git a/engines/ultima/ultima8/graphics/anim_dat.cpp b/engines/ultima/ultima8/graphics/anim_dat.cpp
index 7f87f6763d..36875ff5cd 100644
--- a/engines/ultima/ultima8/graphics/anim_dat.cpp
+++ b/engines/ultima/ultima8/graphics/anim_dat.cpp
@@ -125,13 +125,9 @@ void AnimDat::load(Common::SeekableReadStream *rs) {
 	_anims.resize(2048);
 
 	unsigned int actioncount = 64;
-	unsigned int frame_repeat_factor = 1;
 
 	if (GAME_IS_CRUSADER) {
 		actioncount = 256;
-		// TODO: this is based on making the game "feel" right, not disassembly.
-		// Should confirm if this is the right way to do it.
-		frame_repeat_factor = 2;
 	}
 
 	for (unsigned int shape = 0; shape < _anims.size(); shape++) {
@@ -166,7 +162,7 @@ void AnimDat::load(Common::SeekableReadStream *rs) {
 			uint32 actionsize = rs->readByte();
 			a->_actions[action]->_size = actionsize;
 			a->_actions[action]->_flags = rs->readByte();
-			a->_actions[action]->_frameRepeat = rs->readByte() / frame_repeat_factor;
+			a->_actions[action]->_frameRepeat = rs->readByte();
 			a->_actions[action]->_flags |= rs->readByte() << 8;
 
 			unsigned int dirCount = 8;
@@ -200,7 +196,7 @@ void AnimDat::load(Common::SeekableReadStream *rs) {
 						// byte 2, 3: unknown; byte 3 might contain flags
 						f._unk1 = rs->readSint16LE();
 						// byte 4: deltadir (signed) - convert to pixels
-						f._deltaDir = rs->readSByte() * 2;
+						f._deltaDir = rs->readSByte();
 						// byte 5: flags?
 						f._flags = rs->readByte();
 						// byte 6, 7: unknown
diff --git a/engines/ultima/ultima8/misc/direction_util.h b/engines/ultima/ultima8/misc/direction_util.h
index dd229d12d0..7c9c71f2b5 100644
--- a/engines/ultima/ultima8/misc/direction_util.h
+++ b/engines/ultima/ultima8/misc/direction_util.h
@@ -36,14 +36,20 @@ namespace Ultima8 {
 
 inline int Direction_XFactor(Direction dir) {
 	static const int _x_fact[] = {  0, +1, +1, +1,  0, -1, -1, -1 };
-	//static const int _x_fact16[] = {  0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2, -2, -2, -2, -1 };
-	return _x_fact[(int)dir / 2];
+	static const int _x_fact16[] = {  0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2, -2, -2, -2, -1 };
+	if (GAME_IS_U8)
+		return _x_fact[(int)dir / 2];
+	else
+		return _x_fact16[(int)dir];
 }
 
 inline int Direction_YFactor(Direction dir) {
 	static const int _y_fact[] = { -1, -1,  0, +1, +1, +1,  0, -1 };
-	//static const int _y_fact16[] = { -2, -2, -2, -1,  0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2 };
-	return _y_fact[(int)dir / 2];
+	static const int _y_fact16[] = { -2, -2, -2, -1,  0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2 };
+	if (GAME_IS_U8)
+		return _y_fact[(int)dir / 2];
+	else
+		return _y_fact16[(int)dir];
 }
 
 /**
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index c009487807..56881ce979 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -491,6 +491,8 @@ void Ultima8Engine::runGame() {
 
 		if (!_frameLimit) {
 			_kernel->runProcesses();
+			if (GAME_IS_CRUSADER)
+				_kernel->runProcesses();
 			_desktopGump->run();
 			_inBetweenFrame = false;
 			next_ticks = _animationRate + g_system->getMillis() * 3;
@@ -502,6 +504,8 @@ void Ultima8Engine::runGame() {
 			while (diff < 0) {
 				next_ticks += _animationRate;
 				_kernel->runProcesses();
+				if (GAME_IS_CRUSADER)
+					_kernel->runProcesses();
 				_desktopGump->run();
 #if 0
 				perr << "--------------------------------------" << Std::endl;


Commit: 3b9d950c7a41bedd27e4366d3cf9eb28905e8e3c
    https://github.com/scummvm/scummvm/commit/3b9d950c7a41bedd27e4366d3cf9eb28905e8e3c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-30T16:27:20+09:00

Commit Message:
ULTIMA8: Use GuardProcess and proper death noises in Crusader

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


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index fa7ab480ca..f708971a3e 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -47,6 +47,7 @@
 #include "ultima/ultima8/world/actors/pathfinder_process.h"
 #include "ultima/ultima8/graphics/shape.h"
 #include "ultima/ultima8/world/actors/loiter_process.h"
+#include "ultima/ultima8/world/actors/guard_process.h"
 #include "ultima/ultima8/world/actors/combat_process.h"
 #include "ultima/ultima8/world/actors/surrender_process.h"
 #include "ultima/ultima8/audio/audio_process.h"
@@ -670,8 +671,7 @@ uint16 Actor::setActivityCru(int activity) {
 		return Kernel::get_instance()->addProcess(new SurrenderProcess(this));
 	    break;
 	case 8:
-		perr << "Actor::setActivityCru TODO: Implement new GuardProcess(this);" << Std::endl;
-		return Kernel::get_instance()->addProcess(new LoiterProcess(this));
+		return Kernel::get_instance()->addProcess(new GuardProcess(this));
 	    break;
 	case 5:
 	case 9:
@@ -1040,10 +1040,11 @@ ProcId Actor::die(uint16 damageType) {
 	Kernel::get_instance()->killProcesses(getObjId(), 6, true); // CONSTANT!
 #endif
 
+	// TODO: In Crusader, this should default to 0x12, but randomly choose anim 0x14
+	// if it's available.
 	if (!animprocid)
 		animprocid = doAnim(Animation::die, dir_current);
 
-
 	MainActor *avatar = getMainActor();
 	// if hostile to avatar
 	if (GAME_IS_U8 && (getEnemyAlignment() & avatar->getAlignment())) {
@@ -1053,6 +1054,21 @@ ProcId Actor::die(uint16 damageType) {
 			// and resume combat music afterwards
 			MusicProcess::get_instance()->queueMusic(98);
 		}
+	} else if (GAME_IS_CRUSADER) {
+		uint16 sfxno;
+		static const uint16 FADING_SCREAM_SFX[] = { 0xD9, 0xDA };
+		static const uint16 MALE_DEATH_SFX[] = { 0x88, 0x8C, 0x8F };
+		static const uint16 FEMALE_DEATH_SFX[] = { 0xD8, 0x10 };
+		if (damageType == 0xf) {
+			sfxno = FADING_SCREAM_SFX[getRandom() % 2];
+		} else {
+			if (hasExtFlags(EXT_FEMALE)) {
+				sfxno = FEMALE_DEATH_SFX[getRandom() % 2];
+			} else {
+				sfxno = MALE_DEATH_SFX[getRandom() % 3];
+			}
+		}
+		AudioProcess::get_instance()->playSFX(sfxno, 0x10, _objId, 0, true);
 	}
 
 	destroyContents();
diff --git a/engines/ultima/ultima8/world/actors/guard_process.cpp b/engines/ultima/ultima8/world/actors/guard_process.cpp
index 71ce6e38ee..a25d408f9f 100644
--- a/engines/ultima/ultima8/world/actors/guard_process.cpp
+++ b/engines/ultima/ultima8/world/actors/guard_process.cpp
@@ -72,8 +72,11 @@ void GuardProcess::run() {
 			return;
 		} else {
 			// TODO: What animation happens in here?
-			//int animno = (getRandom() % 2 ? 0x1e : 0x1f);
-			//a->tryAnim(0x1e, a->getDir());
+			int animno = (getRandom() % 2 ? 0x1e : 0x1f);
+			int animproc = a->doAnim(static_cast<Animation::Sequence>(animno), dir_current);
+			Process *animstand = new ActorAnimProcess(a, Animation::stand, dir_current, 0);
+			Kernel::get_instance()->addProcess(animstand);
+			animstand->waitFor(animproc);
 		}
 		return;
 	}




More information about the Scummvm-git-logs mailing list