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

mduggan mgithub at guarana.org
Wed May 19 08:19:26 UTC 2021


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

Summary:
bc4e1eeefb ULTIMA8: Scan more pixel offsets in Crusader
95670203d9 ULTIMA8: Avoid OOB access in Crusader weapon shape list
3f451c876e AUDIO: Use initializer list to ensure buffers are valid or null


Commit: bc4e1eeefb01121a20702cd0598aa8f49291b55a
    https://github.com/scummvm/scummvm/commit/bc4e1eeefb01121a20702cd0598aa8f49291b55a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-19T17:18:20+09:00

Commit Message:
ULTIMA8: Scan more pixel offsets in Crusader

The list before had some omissions so the avatar would still fall a bit.  This
should remove the last places we see pausing while walking around on elevated
platforms etc.

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


diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index ba754d3537..d8bdb98f9a 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -984,14 +984,16 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
 	//
 	// Crusader also has some floor pieces and elevators which are 1 z-pixel offset,
 	// presumably to fix render-order issues.  We need to be able to step up/down
-	// to them smoothly.
+	// to them smoothly, so check 1 px either side of the step sizes as well.  Also
+	// check +/- 2 px which can happen on walkways
 	//
 	static const int SEARCH_OFFSETS_U8[] = {0, -4, 4, -8, 8};
-	static const int SEARCH_OFFSETS_CRU[] = {0, -1, 1, -4, 4, -5, 5, -8, 8, -9, 9};
+	static const int SEARCH_OFFSETS_CRU[] = {0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -7, 7, -8, 8, -9, 9};
 
 	const int *search_offsets = GAME_IS_CRUSADER ? SEARCH_OFFSETS_CRU : SEARCH_OFFSETS_U8;
-	const unsigned int nhoriz = GAME_IS_CRUSADER ? 7 : 3;
-	const unsigned int nvert = GAME_IS_CRUSADER ? 11 : 5;
+	const unsigned int nhoriz = GAME_IS_CRUSADER ? 11 : 3;
+	const unsigned int nvert = GAME_IS_CRUSADER ?
+		ARRAYSIZE(SEARCH_OFFSETS_CRU) : ARRAYSIZE(SEARCH_OFFSETS_U8);
 	for (unsigned int i = 0; i < nhoriz; ++i) {
 		const int horiz = search_offsets[i];
 


Commit: 95670203d9ca3bcec93653c00bd374a00f4bcf8e
    https://github.com/scummvm/scummvm/commit/95670203d9ca3bcec93653c00bd374a00f4bcf8e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-19T17:18:21+09:00

Commit Message:
ULTIMA8: Avoid OOB access in Crusader weapon shape list

Updated list for No Regret, and check value which gets loaded from data file.
Identified by Coverity.

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 877c0969fa..48f38eab8e 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -2488,10 +2488,12 @@ uint32 Actor::I_createActorCru(const uint8 *args, unsigned int /*argsize*/) {
 		wpntype = wpntype2;
 	}
 
-	if (wpntype) {
-		// TODO: Nasty hard coded list.. use the ini file for this.
-		static const int WPNSHAPES[] = {0, 0x032E, 0x032F, 0x0330, 0x038C, 0x0332, 0x0333,
-			0x0334, 0x038E, 0x0388, 0x038A, 0x038D, 0x038B, 0x0386};
+	// TODO: Nasty hard coded list.. use the ini file for this.
+	static const int WPNSHAPES[] = {0, 0x032E, 0x032F, 0x0330, 0x038C, 0x0332, 0x0333,
+		0x0334, 0x038E, 0x0388, 0x038A, 0x038D, 0x038B, 0x0386,
+		// Regret-specific weapon types
+		0x05F6, 0x05F5, 0x0198};
+	if (wpntype && wpntype < ARRAYSIZE(WPNSHAPES)) {
 		// wpntype is an offset into wpn table
 		Item *weapon = ItemFactory::createItem(WPNSHAPES[wpntype], 0, 0, 0, 0, newactor->getMapNum(), 0, true);
 		if (weapon) {


Commit: 3f451c876ee06960757edd7e3aa598da04f9c517
    https://github.com/scummvm/scummvm/commit/3f451c876ee06960757edd7e3aa598da04f9c517
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-19T17:18:21+09:00

Commit Message:
AUDIO: Use initializer list to ensure buffers are valid or null

Identified by coverity - if the module load fails, _mixBufferSamples could be
left as an invalid pointer, which would cause a problem in the destructor.

Moved most things to initailizer list to avoid the problem.

Coverity still identifies a lot of uninitialized members, but they should all
get initialized when playback starts and have less chance of causing real bugs.

Changed paths:
    audio/mods/mod_xm_s3m.cpp


diff --git a/audio/mods/mod_xm_s3m.cpp b/audio/mods/mod_xm_s3m.cpp
index 807f31e153..5588018e4b 100644
--- a/audio/mods/mod_xm_s3m.cpp
+++ b/audio/mods/mod_xm_s3m.cpp
@@ -179,29 +179,20 @@ const short ModXmS3mStream::sinetable[] = {
 		255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120,  97,  74,  49,  24
 	};
 
-ModXmS3mStream::ModXmS3mStream(Common::SeekableReadStream *stream, int initialPos, int rate, int interpolation) {
-	_rampBuf = nullptr;
-	_playCount = nullptr;
-	_channels = nullptr;
-
+ModXmS3mStream::ModXmS3mStream(Common::SeekableReadStream *stream, int initialPos, int rate, int interpolation) :
+	_rampBuf(nullptr), _playCount(nullptr), _channels(nullptr),
+	_mixBuffer(nullptr), _sampleRate(rate), _interpolation(interpolation),
+	_seqPos(initialPos) _mixBufferSamples(0), _finished(false) {
 	if (!_module.load(*stream)) {
 		warning("It's not a valid Mod/S3m/Xm sound file");
 		_loadSuccess = false;
 		return;
 	}
 
-	// assign values
 	_loadSuccess = true;
-	_mixBufferSamples = 0;
-	_sampleRate = rate;
-	_interpolation = interpolation;
 	_rampBuf = new int[128];
 	_channels = new Channel[_module.numChannels];
 	_initialDataLength = _dataLeft = calculateDuration() * 4; // stereo and uint16
-	_mixBuffer = nullptr;
-	_finished = false;
-
-	_seqPos = initialPos;
 }
 
 ModXmS3mStream::~ModXmS3mStream() {




More information about the Scummvm-git-logs mailing list