[Scummvm-git-logs] scummvm master -> 2d16aed6c5c7cf386e7f11a378fb5100971997a4

mduggan mgithub at guarana.org
Fri Apr 2 08:38:56 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:
383ca2256a ULTIMA8: Tweak Crusader selection to be closer to original
3bb576676c ULTIMA8: More Crusader firing tweaks closer to original
03c7245669 ULTIMA8: Fix egg hatcher range for Crusader
0a365c44ae ULTIMA8: Update comments
2d16aed6c5 ULTIMA8: Restore Crusader music after loading game


Commit: 383ca2256a2a09c1a6e55622021bf6c16ecebfbb
    https://github.com/scummvm/scummvm/commit/383ca2256a2a09c1a6e55622021bf6c16ecebfbb
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-02T17:38:31+09:00

Commit Message:
ULTIMA8: Tweak Crusader selection to be closer to original

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


diff --git a/engines/ultima/ultima8/world/item_selection_process.cpp b/engines/ultima/ultima8/world/item_selection_process.cpp
index a8a5c60895..f0c45a7476 100644
--- a/engines/ultima/ultima8/world/item_selection_process.cpp
+++ b/engines/ultima/ultima8/world/item_selection_process.cpp
@@ -59,11 +59,12 @@ bool ItemSelectionProcess::selectNextItem() {
 		return false;
 
 	mainactor->getCentre(_ax, _ay, _az);
+	_az = mainactor->getZ();
 
 	UCList uclist(2);
 	LOOPSCRIPT(script, LS_TOKEN_TRUE); // we want all items
 	currentmap->areaSearch(&uclist, script, sizeof(script),
-						   mainactor, 0x120, false);
+						   mainactor, 0x200, false);
 
 	Std::vector<Item *> candidates;
 
@@ -77,7 +78,7 @@ bool ItemSelectionProcess::selectNextItem() {
 
 		// Maybe this can be done with a loopscript,
 		// but this is how the game does it..
-		if (item->hasFlags(Actor::FLG_HANGING))
+		if (item->hasFlags(Item::FLG_HANGING))
 			continue;
 		uint16 family = item->getFamily();
 		if (item->getShape() == 0x4ed || family == ShapeInfo::SF_CRUWEAPON ||
@@ -87,7 +88,9 @@ bool ItemSelectionProcess::selectNextItem() {
 
 			int32 cx, cy, cz;
 			item->getCentre(cx, cy, cz);
-			if (abs(cx - _ax) > 0x100 || abs(cy - _ay) > 0x100 || abs(cz - _az) > 50)
+			int32 iz = item->getZ();
+			if (abs(cx - _ax) > 0x100 || abs(cy - _ay) > 0x100 ||
+				(iz - _az) >= 0x50 || (_az - iz) >= 0x18)
 				continue;
 
 			candidates.push_back(item);


Commit: 3bb576676c92128ae84ba69a9ba73f98d3f7ee55
    https://github.com/scummvm/scummvm/commit/3bb576676c92128ae84ba69a9ba73f98d3f7ee55
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-02T17:38:31+09:00

Commit Message:
ULTIMA8: More Crusader firing tweaks closer to original

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


diff --git a/engines/ultima/ultima8/world/super_sprite_process.cpp b/engines/ultima/ultima8/world/super_sprite_process.cpp
index 81ecf5ee90..105c69f669 100644
--- a/engines/ultima/ultima8/world/super_sprite_process.cpp
+++ b/engines/ultima/ultima8/world/super_sprite_process.cpp
@@ -224,9 +224,11 @@ void SuperSpriteProcess::run() {
 		}
 	}
 
-	// TODO: Clamp Z values as original does ~lines 280-290 of
-	// SuperSpriteProcess::run()
 	_pt3 = newpt;
+	if (_pt3.z < 0)
+		_pt3.z = 0;
+	if (_pt3.z > 0xfa)
+		_pt3.z = 0xfa;
 
 	_counter++;
 
@@ -237,7 +239,7 @@ void SuperSpriteProcess::run() {
 		sprite->move(_nowpt);
 	}
 
-	if (_pt3.z != 0 && _pt3.z != 0xfa) {
+	if (_pt3.z > 0 && _pt3.z < 0xfa) {
 		int32 duration = firetypedat->getRoundDuration() + 25;
 
 		if (_counter < duration) {
@@ -408,7 +410,7 @@ void SuperSpriteProcess::advanceFrame() {
 	if (_fireType == 3) {
 		if (_pt5.x != -1) {
 			// Create a little sparkly thing
-			Process *p = new SpriteProcess(0x426, 0, 9, 0, 3, _pt5.x, _pt5.y, _pt5.z);
+			Process *p = new SpriteProcess(0x426, 0, 9, 1, 3, _pt5.x, _pt5.y, _pt5.z);
 			Kernel::get_instance()->addProcess(p);
 		}
 		_pt5 = _nextpt;
@@ -427,14 +429,14 @@ bool SuperSpriteProcess::areaSearch() {
 		item->getLocation(start[0], start[1], start[2]);
 
 	Std::list<CurrentMap::SweepItem> hits;
-	bool collision = map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
+	map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
 							   _source, true, &hits);
 
 	if (hits.size() > 0) {
 		_item0x77 = hits.front()._item;
 	}
 
-	return !collision;
+	return hits.size() == 0;
 }
 
 
@@ -449,17 +451,19 @@ void SuperSpriteProcess::saveData(Common::WriteStream *ws) {
 	_startpt.saveData(ws);
 	_pt5.saveData(ws);
 	_destpt.saveData(ws);
+	ws->writeUint16LE(_frame);
 	ws->writeUint16LE(_fireType);
 	ws->writeUint16LE(_damage);
 	ws->writeUint16LE(_source);
 	ws->writeUint16LE(_target);
+	ws->writeUint16LE(_counter);
 	ws->writeUint16LE(_item0x77);
 	ws->writeUint16LE(_spriteNo);
 	ws->writeFloatLE(_xstep);
 	ws->writeFloatLE(_ystep);
 	ws->writeFloatLE(_zstep);
-
-	// TODO: Update save and load functions once this is finished.
+	ws->writeByte(_startedAsFiretype9);
+	ws->writeByte(_expired);
 }
 
 bool SuperSpriteProcess::loadData(Common::ReadStream *rs, uint32 version) {
@@ -473,15 +477,19 @@ bool SuperSpriteProcess::loadData(Common::ReadStream *rs, uint32 version) {
 	_startpt.loadData(rs, version);
 	_pt5.loadData(rs, version);
 	_destpt.loadData(rs, version);
+	_frame = rs->readUint16LE();
 	_fireType = rs->readUint16LE();
 	_damage = rs->readUint16LE();
 	_source = rs->readUint16LE();
 	_target = rs->readUint16LE();
+	_counter = rs->readUint16LE();
 	_item0x77 = rs->readUint16LE();
 	_spriteNo = rs->readUint16LE();
 	_xstep = rs->readFloatLE();
 	_ystep = rs->readFloatLE();
 	_zstep = rs->readFloatLE();
+	_startedAsFiretype9 = (rs->readByte() != 0);
+	_expired = (rs->readByte() != 0);
 
 	return true;
 }


Commit: 03c724566916c78fa24de3ae412ccf7c5f1f53b6
    https://github.com/scummvm/scummvm/commit/03c724566916c78fa24de3ae412ccf7c5f1f53b6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-02T17:38:31+09:00

Commit Message:
ULTIMA8: Fix egg hatcher range for Crusader

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


diff --git a/engines/ultima/ultima8/world/egg_hatcher_process.cpp b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
index 8f47c76856..90a078fb93 100644
--- a/engines/ultima/ultima8/world/egg_hatcher_process.cpp
+++ b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
@@ -25,6 +25,7 @@
 #include "ultima/ultima8/world/actors/main_actor.h"
 #include "ultima/ultima8/world/teleport_egg.h"
 #include "ultima/ultima8/world/get_object.h"
+#include "ultima/ultima8/ultima8.h"
 
 namespace Ultima {
 namespace Ultima8 {
@@ -52,6 +53,10 @@ void EggHatcherProcess::run() {
 	MainActor *av = getMainActor();
 	assert(av);
 
+	// CONSTANTS!
+	const int range_mul = GAME_IS_U8 ? 32 : 64;
+	const int z_range = GAME_IS_U8 ? 48 : 96;
+
 	for (unsigned int i = 0; i < _eggs.size(); i++) {
 		uint16 eggid = _eggs[i];
 		Egg *egg = dynamic_cast<Egg *>(getObject(eggid));
@@ -61,10 +66,10 @@ void EggHatcherProcess::run() {
 		egg->getLocation(x, y, z);
 
 		//! constants
-		int32 x1 = x - 32 * egg->getXRange();
-		int32 x2 = x + 32 * egg->getXRange();
-		int32 y1 = y - 32 * egg->getYRange();
-		int32 y2 = y + 32 * egg->getYRange();
+		int32 x1 = x - range_mul * egg->getXRange();
+		int32 x2 = x + range_mul * egg->getXRange();
+		int32 y1 = y - range_mul * egg->getYRange();
+		int32 y2 = y + range_mul * egg->getYRange();
 
 		// get avatar location
 		int32 ax, ay, az;
@@ -79,7 +84,7 @@ void EggHatcherProcess::run() {
 		TeleportEgg *tegg = dynamic_cast<TeleportEgg *>(egg);
 
 		if (x1 <= ax && ax - axs < x2 && y1 <= ay && ay - ays < y2 &&
-		        z - 48 < az && az <= z + 48) { // CONSTANTS!
+		        z - z_range < az && az <= z + z_range) {
 			if (tegg && tegg->isTeleporter())
 				nearteleporter = true;
 


Commit: 0a365c44ae077bad3b9e694a73df351e44310562
    https://github.com/scummvm/scummvm/commit/0a365c44ae077bad3b9e694a73df351e44310562
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-02T17:38:31+09:00

Commit Message:
ULTIMA8: Update comments

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


diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index ca99520249..44c8866a1a 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -249,6 +249,7 @@ int16 MainActor::addItemCru(Item *item, bool showtoast) {
 		} else {
 			Item *existing = getFirstItemWithShape(shapeno, true);
 			if (!existing) {
+				// Shields. Note, these are the same in Remorse and Regret.
 				if ((shapeno == 0x52e) || (shapeno == 0x52f) || (shapeno == 0x530)) {
 					int shieldtype;
 					switch (shapeno) {
@@ -906,7 +907,7 @@ void MainActor::useInventoryItem(Item *item) {
 
 	// 0x4d4 = datalink, 0x52d = scanner, 0x52e = ionic,
 	// 0x52f = plasma, 0x530 = graviton
-	// TODO: check these for no regret
+	// Note: These are the same in Remorse and Regret.
 	if (GAME_IS_CRUSADER && (shapenum != 0x4d4 && shapenum != 0x52d &&
 							 shapenum != 0x530 && shapenum != 0x52f &&
 							 shapenum != 0x52e)) {


Commit: 2d16aed6c5c7cf386e7f11a378fb5100971997a4
    https://github.com/scummvm/scummvm/commit/2d16aed6c5c7cf386e7f11a378fb5100971997a4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-02T17:38:31+09:00

Commit Message:
ULTIMA8: Restore Crusader music after loading game

Changed paths:
    engines/ultima/ultima8/audio/remorse_music_process.cpp
    engines/ultima/ultima8/audio/remorse_music_process.h


diff --git a/engines/ultima/ultima8/audio/remorse_music_process.cpp b/engines/ultima/ultima8/audio/remorse_music_process.cpp
index 732f9a1cf9..64e1d82774 100644
--- a/engines/ultima/ultima8/audio/remorse_music_process.cpp
+++ b/engines/ultima/ultima8/audio/remorse_music_process.cpp
@@ -35,7 +35,8 @@ namespace Ultima8 {
 static const int MAX_TRACK_REMORSE = 21;
 static const int MAX_TRACK_REGRET = 22;
 
-// NOTE: This order is chosen to match the list in Crusader: No Remorse.
+// NOTE: The order of these lists has to be the same as the original games
+// as they come as numbers from the usecode.
 static const char *TRACK_FILE_NAMES_REMORSE[] = {
 	nullptr,
 	"M01",
@@ -84,7 +85,7 @@ static const char *TRACK_FILE_NAMES_REGRET[] = {
 	"m13",
 	"retro",
 	"metal",
-	"xmas" // for demo
+	"xmas" // for christmas easter egg
 };
 
 static const int REGRET_MAP_TRACKS[] = {
@@ -95,7 +96,7 @@ static const int REGRET_MAP_TRACKS[] = {
 
 DEFINE_RUNTIME_CLASSTYPE_CODE(RemorseMusicProcess)
 
-RemorseMusicProcess::RemorseMusicProcess() : MusicProcess(), _currentTrack(0), _savedTrack(0), _m16offset(0), _combatMusicActive(false) {
+RemorseMusicProcess::RemorseMusicProcess() : MusicProcess(), _currentTrack(0), _savedTrack(0), _m16offset(0) {
 	_maxTrack = (GAME_IS_REMORSE ? MAX_TRACK_REMORSE : MAX_TRACK_REGRET);
 	_trackNames = (GAME_IS_REMORSE ? TRACK_FILE_NAMES_REMORSE
 				   : TRACK_FILE_NAMES_REGRET);
@@ -204,8 +205,8 @@ void RemorseMusicProcess::run() {
 		return;
 	}
 
-	// hit end of stream, play it again.
-	// TODO: This doesn't loop to the correct spot, should do something a bit nicer..
+	// Hit end of stream, play it again.  This normally won't happen because
+	// the mods should loop infinitely, but just in case.
 	playMusic_internal(_currentTrack);
 }
 
@@ -213,12 +214,22 @@ void RemorseMusicProcess::saveData(Common::WriteStream *ws) {
 	Process::saveData(ws);
 
 	ws->writeUint32LE(static_cast<uint32>(_currentTrack));
+	ws->writeUint32LE(static_cast<uint32>(_savedTrack));
+	ws->writeByte(_m16offset);
 }
 
 bool RemorseMusicProcess::loadData(Common::ReadStream *rs, uint32 version) {
 	if (!Process::loadData(rs, version)) return false;
 
 	_currentTrack = static_cast<int32>(rs->readUint32LE());
+	_savedTrack = static_cast<int32>(rs->readUint32LE());
+	_m16offset = rs->readByte();
+
+	_theMusicProcess = this;
+
+	// Slight hack - resuming from savegame we want to restore the game
+	// track (not the menu track)
+	restoreTrackState();
 
 	return true;
 }
diff --git a/engines/ultima/ultima8/audio/remorse_music_process.h b/engines/ultima/ultima8/audio/remorse_music_process.h
index 0231ba0c02..d85e6685ce 100644
--- a/engines/ultima/ultima8/audio/remorse_music_process.h
+++ b/engines/ultima/ultima8/audio/remorse_music_process.h
@@ -45,15 +45,13 @@ protected:
 private:
 	int _currentTrack;      //! Currently playing track (don't save)
 
-	//! Is the current music "combat" music
-	bool _combatMusicActive;
-
 	int _savedTrack;
 
 	uint8 _m16offset;
 
 	Audio::SoundHandle _soundHandle;
 
+	// These are both initialized in constructor and do not need to be saved.
 	int _maxTrack;
 	const char **_trackNames;
 




More information about the Scummvm-git-logs mailing list