[Scummvm-git-logs] scummvm master -> 8e7989dbc8f67616f7aae507550d9b8b494a2cea

athrxx noreply at scummvm.org
Fri Sep 23 00:38:32 UTC 2022


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:
8da4751b2c KYRA: cleanup
b44471c6b8 KYRA: add sanity asserts
8e7989dbc8 KYRA: (LoK/Mac) - minor sfx priority fix


Commit: 8da4751b2c326a94a1cc03ce2ea9032827ea32f6
    https://github.com/scummvm/scummvm/commit/8da4751b2c326a94a1cc03ce2ea9032827ea32f6
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-23T02:27:36+02:00

Commit Message:
KYRA: cleanup

Changed paths:
    engines/kyra/sound/drivers/halestorm.cpp


diff --git a/engines/kyra/sound/drivers/halestorm.cpp b/engines/kyra/sound/drivers/halestorm.cpp
index 8f15083b399..28150403cac 100644
--- a/engines/kyra/sound/drivers/halestorm.cpp
+++ b/engines/kyra/sound/drivers/halestorm.cpp
@@ -85,18 +85,22 @@ static int DEBUG_BUFFERS_COUNT = 0;
 class ShStBuffer {
 public:
 	ShStBuffer(const ShStBuffer &buff) : ptr(buff.ptr), len(buff.len), lifes(buff.lifes) { if (lifes) (*lifes)++; }
+	ShStBuffer(ShStBuffer &&buff) noexcept : ptr(buff.ptr), len(buff.len), lifes(buff.lifes) { buff.lifes = nullptr; }
 	ShStBuffer(const void *p, uint32 cb, bool allocate = false) : ptr((const uint8*)p), len(cb), lifes(nullptr) { if (allocate) memcpy(crtbuf(), p, cb); }
 	ShStBuffer() : ShStBuffer(nullptr, 0) {}
 	ShStBuffer(Common::SeekableReadStream *s) : len(s ? s->size() : 0), lifes(nullptr) { s->read(crtbuf(), len); }
 	~ShStBuffer() { dcrlif(); }
-	void operator=(Common::SeekableReadStream *s) { operator=(ShStBuffer(s)); }
-	void operator=(const ShStBuffer &buff) {
-		dcrlif();
-		ptr = buff.ptr;
-		len = buff.len;
-		lifes = buff.lifes;
+	ShStBuffer &operator=(Common::SeekableReadStream *s) { return operator=(ShStBuffer(s)); }
+	ShStBuffer &operator=(ShStBuffer &&buff) noexcept {
+		trans(buff);
+		buff.lifes = nullptr;
+		return *this;
+	}
+	ShStBuffer &operator=(const ShStBuffer &buff) {
+		trans(buff);
 		if (lifes)
 			(*lifes)++;
+		return *this;
 	}
 	const uint8 *ptr;
 	uint32 len;
@@ -117,6 +121,12 @@ private:
 		DEBUG_BUFFERS_COUNT++;
 		return tptr;
 	}
+	void trans(const ShStBuffer &buff) {
+		dcrlif();
+		ptr = buff.ptr;
+		len = buff.len;
+		lifes = buff.lifes;
+	}
 	int *lifes;
 };
 


Commit: b44471c6b8433a4ffb5d0696d001b84f12eec854
    https://github.com/scummvm/scummvm/commit/b44471c6b8433a4ffb5d0696d001b84f12eec854
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-23T02:27:42+02:00

Commit Message:
KYRA: add sanity asserts

Changed paths:
    engines/kyra/engine/lol.cpp
    engines/kyra/script/script_lol.cpp


diff --git a/engines/kyra/engine/lol.cpp b/engines/kyra/engine/lol.cpp
index f9bd690638c..03314335e61 100644
--- a/engines/kyra/engine/lol.cpp
+++ b/engines/kyra/engine/lol.cpp
@@ -1934,6 +1934,7 @@ int LoLEngine::playCharacterScriptChat(int charId, int mode, int restorePortrait
 
 void LoLEngine::setupDialogueButtons(int numStr, const char *s1, const char *s2, const char *s3) {
 	screen()->setScreenDim(5);
+	assert(numStr);
 
 	if (numStr == 1 && speechEnabled()) {
 		_dialogueNumButtons = 0;
diff --git a/engines/kyra/script/script_lol.cpp b/engines/kyra/script/script_lol.cpp
index ca0ec061eb6..3b7a1561c44 100644
--- a/engines/kyra/script/script_lol.cpp
+++ b/engines/kyra/script/script_lol.cpp
@@ -1688,7 +1688,7 @@ int LoLEngine::olol_countSpecificMonsters(EMCState *script) {
 int LoLEngine::olol_updateBlockAnimations2(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_updateBlockAnimations2(%p) (%d, %d, %d, %d, ...)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
 	int numFrames = stackPos(3);
-	assert(numFrames <= 97);
+	assert(numFrames > 0 && numFrames <= 97);
 	int curFrame = stackPos(2) % numFrames;
 	setWallType(stackPos(0), stackPos(1), stackPos(4 + curFrame));
 	return 0;


Commit: 8e7989dbc8f67616f7aae507550d9b8b494a2cea
    https://github.com/scummvm/scummvm/commit/8e7989dbc8f67616f7aae507550d9b8b494a2cea
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-23T02:28:05+02:00

Commit Message:
KYRA: (LoK/Mac) - minor sfx priority fix

Changed paths:
    engines/kyra/sound/drivers/halestorm.cpp


diff --git a/engines/kyra/sound/drivers/halestorm.cpp b/engines/kyra/sound/drivers/halestorm.cpp
index 28150403cac..fe0a08046e0 100644
--- a/engines/kyra/sound/drivers/halestorm.cpp
+++ b/engines/kyra/sound/drivers/halestorm.cpp
@@ -1124,12 +1124,14 @@ int HSLowLevelDriver::cmd_playSoundEffect(va_list &arg) {
 	if (!vc || !vc->dataPtr || !_song._numChanSfx)
 		return 0;
 
-	HSSoundChannel *chan = &_chan[_song._numChanMusic];
+	HSSoundChannel *chan = nullptr;
 	int16 lowest = 32767;
 	for (int i = _song._numChanMusic; i < _song._numChanMusic + _song._numChanSfx; ++i) {
 		HSSoundChannel *c = &_chan[i];
-		if (c->status < 0)
+		if (c->status < 0) {
+			chan = c;
 			break;
+		}
 		if (c->status < lowest) {
 			chan = c;
 			lowest = c->status;




More information about the Scummvm-git-logs mailing list