[Scummvm-git-logs] scummvm master -> 31cbd8f55e4f5e0d971a06c20924e88133b62e5e

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Sun Jul 25 08:44:03 UTC 2021


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:
76509c8fc8 DIRECTOR: add range check for sampled sounds.
31cbd8f55e DIRECTOR: amend the implementation of invertChannel


Commit: 76509c8fc86936f3e0a1f2df57dda3e5f979d502
    https://github.com/scummvm/scummvm/commit/76509c8fc86936f3e0a1f2df57dda3e5f979d502
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-25T16:43:40+08:00

Commit Message:
DIRECTOR: add range check for sampled sounds.

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/score.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 2d1e8ac6b2..fe9d8cc260 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1820,6 +1820,9 @@ void LB::b_puppetSound(int nargs) {
 		uint submenu = g_lingo->pop().asInt();
 		uint menu = g_lingo->pop().asInt();
 
+		if (menu <= 9 || menu >= 16)
+			warning("LB::puppetSound: menu number is not available");
+
 		if (score->_sampleSounds.empty())
 			score->loadSampleSounds(menu);
 
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7eefe08525..5d73339b64 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -717,7 +717,7 @@ void Score::playSoundChannel(uint16 frameId) {
 		return;
 
 	// 0x0f represent sample sound
-	if (frame->_soundType1 && frame->_soundType1 <= 0x0f) {
+	if (frame->_soundType1 >= 10 && frame->_soundType1 <= 15) {
 		if (_sampleSounds.empty())
 			loadSampleSounds(frame->_soundType1);
 
@@ -728,7 +728,7 @@ void Score::playSoundChannel(uint16 frameId) {
 		sound->playCastMember(frame->_sound1, 1, false);
 	}
 
-	if (frame->_soundType2 && frame->_soundType2 <= 0x0f) {
+	if (frame->_soundType2 >= 10 && frame->_soundType2 <= 15) {
 		if (_sampleSounds.empty())
 			loadSampleSounds(frame->_soundType2);
 


Commit: 31cbd8f55e4f5e0d971a06c20924e88133b62e5e
    https://github.com/scummvm/scummvm/commit/31cbd8f55e4f5e0d971a06c20924e88133b62e5e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-25T16:43:40+08:00

Commit Message:
DIRECTOR: amend the implementation of invertChannel

Changed paths:
    engines/director/window.cpp


diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 84c0ffd5e9..a2268b9e26 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -78,10 +78,14 @@ void Window::invertChannel(Channel *channel, const Common::Rect &destRect) {
 	Common::Rect srcRect = channel->getBbox();
 	srcRect.clip(destRect);
 
+	// let compiler to optimize it
+	int xoff = srcRect.left - channel->getBbox().left;
+	int yoff = srcRect.top - channel->getBbox().top;
+
 	if (_wm->_pixelformat.bytesPerPixel == 1) {
 		for (int i = 0; i < srcRect.height(); i++) {
 			byte *src = (byte *)_composeSurface->getBasePtr(srcRect.left, srcRect.top + i);
-			const byte *msk = mask ? (const byte *)mask->getBasePtr(0, i) : nullptr;
+			const byte *msk = mask ? (const byte *)mask->getBasePtr(xoff, yoff + i) : nullptr;
 
 			for (int j = 0; j < srcRect.width(); j++, src++)
 				if (!mask || (msk && !(*msk++)))
@@ -92,7 +96,7 @@ void Window::invertChannel(Channel *channel, const Common::Rect &destRect) {
 
 		for (int i = 0; i < srcRect.height(); i++) {
 			uint32 *src = (uint32 *)_composeSurface->getBasePtr(srcRect.left, srcRect.top + i);
-			const uint32 *msk = mask ? (const uint32 *)mask->getBasePtr(0, i) : nullptr;
+			const uint32 *msk = mask ? (const uint32 *)mask->getBasePtr(xoff, yoff + i) : nullptr;
 
 			for (int j = 0; j < srcRect.width(); j++, src++)
 				if (!mask || (msk && !(*msk++)))




More information about the Scummvm-git-logs mailing list