[Scummvm-git-logs] scummvm master -> 99642ec18e21f36c0f7ace948ca71feb85830e4c

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Sun Jul 25 06:39:40 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:
dfd3c9c5cd DIRECTOR: fix playing sample sounds in score.
05e80c571c DIRECTOR: fix puppetSound for playing external sounds.
99642ec18e DIRECTOR: fix the behaviour of puppet sound.


Commit: dfd3c9c5cde56de2106f800b82eb397f5c75f8a5
    https://github.com/scummvm/scummvm/commit/dfd3c9c5cde56de2106f800b82eb397f5c75f8a5
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-25T14:26:25+08:00

Commit Message:
DIRECTOR: fix playing sample sounds in score.

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 650aef57ed..92be1c8503 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -713,9 +713,9 @@ void Score::playSoundChannel(uint16 frameId) {
 	DirectorSound *sound = _vm->getSoundManager();
 
 	// 0x0f represent sample sound
-	if (frame->_soundType1 == 0x0f) {
+	if (frame->_soundType1 && frame->_soundType1 <= 0x0f) {
 		if (_sampleSounds.empty())
-			loadSampleSounds(0x0f);
+			loadSampleSounds(frame->_soundType1);
 
 		if ((uint)frame->_sound1.member <= _sampleSounds.size()) {
 			sound->playExternalSound(_sampleSounds[frame->_sound1.member - 1], 1, frame->_sound1.member);
@@ -724,12 +724,13 @@ void Score::playSoundChannel(uint16 frameId) {
 		sound->playCastMember(frame->_sound1, 1, false);
 	}
 
-	if (frame->_soundType2 == 0x0f) {
+	if (frame->_soundType2 && frame->_soundType2 <= 0x0f) {
 		if (_sampleSounds.empty())
-			loadSampleSounds(0x0f);
+			loadSampleSounds(frame->_soundType2);
 
-		if ((uint)frame->_sound2.member <= _sampleSounds.size())
+		if ((uint)frame->_sound2.member <= _sampleSounds.size()) {
 			sound->playExternalSound(_sampleSounds[frame->_sound2.member - 1], 2, frame->_sound2.member);
+		}
 	} else {
 		sound->playCastMember(frame->_sound2, 2, false);
 	}


Commit: 05e80c571c429f5d9a4222deac9d80102ebdbf86
    https://github.com/scummvm/scummvm/commit/05e80c571c429f5d9a4222deac9d80102ebdbf86
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-25T14:26:25+08:00

Commit Message:
DIRECTOR: fix puppetSound for playing external sounds.

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 10febc8b52..70626e1ec8 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1795,21 +1795,28 @@ void LB::b_puppetSound(int nargs) {
 	}
 
 	DirectorSound *sound = g_director->getSoundManager();
-	Datum castMember = g_lingo->pop();
 	Score *score = g_director->getCurrentMovie()->getScore();
 
-	int channel = 1;
-	if (nargs == 2) {
-		channel = g_lingo->pop().asInt();
-	}
-
 	if (!score) {
 		warning("b_puppetSound(): no score");
 		return;
 	}
 
-	CastMemberID castId = castMember.asMemberID();
-	sound->playCastMember(castId, channel);
+	if (nargs == 1) {
+		Datum castMember = g_lingo->pop();
+
+		sound->playCastMember(castMember.asMemberID(), 1);
+	} else if (nargs == 2) {
+		uint submenu = g_lingo->pop().asInt();
+		uint menu = g_lingo->pop().asInt();
+
+		if (score->_sampleSounds.empty())
+			score->loadSampleSounds(menu);
+
+		if (submenu <= score->_sampleSounds.size()) {
+			sound->playExternalSound(score->_sampleSounds[submenu - 1], 1, submenu);
+		}
+	}
 }
 
 void LB::b_immediateSprite(int nargs) {


Commit: 99642ec18e21f36c0f7ace948ca71feb85830e4c
    https://github.com/scummvm/scummvm/commit/99642ec18e21f36c0f7ace948ca71feb85830e4c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-25T14:39:25+08:00

Commit Message:
DIRECTOR: fix the behaviour of puppet sound.

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 70626e1ec8..051627300c 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1802,11 +1802,16 @@ void LB::b_puppetSound(int nargs) {
 		return;
 	}
 
+	sound->_puppet = true;
 	if (nargs == 1) {
 		Datum castMember = g_lingo->pop();
 
+		// in D2 manual p206, puppetSound 0 will turn off the puppet status of sound
+		if (castMember.asInt() == 0)
+			sound->_puppet = false;
+
 		sound->playCastMember(castMember.asMemberID(), 1);
-	} else if (nargs == 2) {
+	} else {
 		uint submenu = g_lingo->pop().asInt();
 		uint menu = g_lingo->pop().asInt();
 
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 92be1c8503..7eefe08525 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -712,6 +712,10 @@ void Score::playSoundChannel(uint16 frameId) {
 	debugC(5, kDebugLoading, "playSoundChannel(): Sound1 %s Sound2 %s", frame->_sound1.asString().c_str(), frame->_sound2.asString().c_str());
 	DirectorSound *sound = _vm->getSoundManager();
 
+	// puppet sound will be controlled with lingo
+	if (sound->_puppet)
+		return;
+
 	// 0x0f represent sample sound
 	if (frame->_soundType1 && frame->_soundType1 <= 0x0f) {
 		if (_sampleSounds.empty())
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 1727b85220..3af480612c 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -56,6 +56,7 @@ DirectorSound::DirectorSound(DirectorEngine *vm) : _vm(vm) {
 		&_pcSpeakerHandle, _speaker, -1, 50, 0, DisposeAfterUse::NO, true);
 
 	_enable = true;
+	_puppet = false;
 }
 
 DirectorSound::~DirectorSound() {
diff --git a/engines/director/sound.h b/engines/director/sound.h
index d766fb1e34..37d5519d51 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -63,6 +63,10 @@ struct SoundChannel {
 
 class DirectorSound {
 
+public:
+	// whether the sound is puppet. i.e. it's controlled by lingo
+	bool _puppet;
+
 private:
 	DirectorEngine *_vm;
 	Common::Array<SoundChannel> _channels;




More information about the Scummvm-git-logs mailing list