[Scummvm-git-logs] scummvm master -> 16eb05cee837f31b66df236c1209ae68ae72225a

moralrecordings code at moral.net.au
Sun Apr 25 15:26:10 UTC 2021


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

Summary:
028fb93cf8 DIRECTOR: Fix memory leaks in DirectorSound
b4df4f4036 DIRECTOR: LINGO: Fix memory leak in Datum
89bfa05874 DIRECTOR: Fix video playback in 256-colour mode
527a093228 DIRECTOR: Fix the _videoPlayback flag
83c400600d DIRECTOR: Fix the SoundCastMember looping flag
73d9aa2a83 DIRECTOR: Add P.A.W.S. to detection tables
e7375f7495 DIRECTOR: Update Chop Suey engine version in detection tables
b09b54fa1b DIRECTOR: Fix memory leak in _castsInfo
ca0c5c800d DIRECTOR: Fix memory leaks in SoundCastMember
7197d470d3 Revert "DIRECTOR: Add puppet check on kTheCastNum"
16eb05cee8 DIRECTOR: LINGO: Allow b_puppetSound to support 2 args


Commit: 028fb93cf8308074a1c969f2aad26d30a3bff2a6
    https://github.com/scummvm/scummvm/commit/028fb93cf8308074a1c969f2aad26d30a3bff2a6
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix memory leaks in DirectorSound

Changed paths:
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 6c51d5f97c..c2d3910a0f 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -49,17 +49,16 @@ DirectorSound::DirectorSound(DirectorEngine *vm) : _vm(vm) {
 		_channels.push_back(SoundChannel());
 	}
 
-	_scriptSound = new Audio::SoundHandle();
 	_mixer = g_system->getMixer();
 
 	_speaker = new Audio::PCSpeaker();
-	_pcSpeakerHandle = new Audio::SoundHandle();
 	_mixer->playStream(Audio::Mixer::kSFXSoundType,
-		_pcSpeakerHandle, _speaker, -1, 50, 0, DisposeAfterUse::NO, true);
+		&_pcSpeakerHandle, _speaker, -1, 50, 0, DisposeAfterUse::NO, true);
 }
 
 DirectorSound::~DirectorSound() {
-	delete _scriptSound;
+	this->stopSound();
+	delete _speaker;
 }
 
 SoundChannel *DirectorSound::getChannel(uint8 soundChannel) {
@@ -83,8 +82,8 @@ void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to)
 	Audio::SeekableAudioStream *seekStream = dynamic_cast<Audio::SeekableAudioStream *>(&stream);
 	Audio::SubSeekableAudioStream *subSeekStream = new Audio::SubSeekableAudioStream(seekStream, Audio::Timestamp(from, seekStream->getRate()), Audio::Timestamp(to, seekStream->getRate()));
 
-	_mixer->stopHandle(*_scriptSound);
-	_mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, subSeekStream);
+	_mixer->stopHandle(_scriptSound);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_scriptSound, subSeekStream);
 }
 
 void DirectorSound::playStream(Audio::AudioStream &stream, uint8 soundChannel) {
@@ -214,14 +213,14 @@ void DirectorSound::stopSound(uint8 soundChannel) {
 
 void DirectorSound::stopSound() {
 	for (uint i = 0; i < _channels.size(); i++) {
-		cancelFade(i);
+		cancelFade(i + 1);
 
 		_mixer->stopHandle(_channels[i].handle);
 		_channels[i].lastPlayingCast = 0;
 	}
 
-	_mixer->stopHandle(*_scriptSound);
-	_mixer->stopHandle(*_pcSpeakerHandle);
+	_mixer->stopHandle(_scriptSound);
+	_mixer->stopHandle(_pcSpeakerHandle);
 }
 
 void DirectorSound::systemBeep() {
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 6d7e3a03c6..f289518727 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -60,10 +60,10 @@ class DirectorSound {
 private:
 	DirectorEngine *_vm;
 	Common::Array<SoundChannel> _channels;
-	Audio::SoundHandle *_scriptSound;
+	Audio::SoundHandle _scriptSound;
 	Audio::Mixer *_mixer;
 	Audio::PCSpeaker *_speaker;
-	Audio::SoundHandle *_pcSpeakerHandle;
+	Audio::SoundHandle _pcSpeakerHandle;
 
 public:
 	DirectorSound(DirectorEngine *vm);


Commit: b4df4f4036ee2cc512f6403f2e567ff44d47758c
    https://github.com/scummvm/scummvm/commit/b4df4f4036ee2cc512f6403f2e567ff44d47758c
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: LINGO: Fix memory leak in Datum

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


diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 2bf058ca31..aff04cad8f 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -388,10 +388,9 @@ void LC::c_symbolpush() {
 }
 
 void LC::c_namepush() {
-	Datum d;
 	int i = g_lingo->readInt();
+	Datum d(Common::String(g_lingo->_currentArchive->getName(i)));
 	d.type = SYMBOL;
-	d.u.s = new Common::String(g_lingo->_currentArchive->getName(i));
 	g_lingo->push(d);
 }
 
@@ -468,8 +467,8 @@ void LC::c_varpush() {
 		}
 	}
 
+	d = Datum(Common::String(name));
 	d.type = VAR;
-	d.u.s = new Common::String(name);
 	g_lingo->push(d);
 }
 
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 10b39a6601..6733746cc2 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -819,6 +819,7 @@ void Datum::reset() {
 		switch (type) {
 		case VAR:
 		case STRING:
+		case SYMBOL:
 			delete u.s;
 			break;
 		case ARRAY:


Commit: 89bfa0587431d61e8370ff0b55af4a17d3440c7a
    https://github.com/scummvm/scummvm/commit/89bfa0587431d61e8370ff0b55af4a17d3440c7a
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix video playback in 256-colour mode

Changed paths:
    engines/director/castmember.cpp
    engines/director/castmember.h


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index c65d07df66..303bc7d369 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -296,22 +296,37 @@ DigitalVideoCastMember::DigitalVideoCastMember(Cast *cast, uint16 castId, Common
 }
 
 DigitalVideoCastMember::~DigitalVideoCastMember() {
-	delete _video;
-
-	if (g_director->_pixelformat.bytesPerPixel != 1)
+	if (_lastFrame) {
+		_lastFrame->free();
 		delete _lastFrame;
+	}
+
+	if (_video)
+		delete _video;
 }
 
 bool DigitalVideoCastMember::loadVideo(Common::String path) {
 	// TODO: detect file type (AVI, QuickTime, FLIC) based on magic number,
 	// insert the right video decoder
 
+	if (_video)
+		delete _video;
+
 	_filename = path;
 	_video = new Video::QuickTimeDecoder();
 
 	debugC(2, kDebugLoading | kDebugImages, "Loading video %s", path.c_str());
+	bool result = _video->loadFile(path);
+
+	if (result && g_director->_pixelformat.bytesPerPixel == 1) {
+		// Director supports playing back RGB and paletted video in 256 colour mode.
+		// In both cases they are dithered to match the Director palette.
+		byte palette[256 * 3];
+		g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+		_video->setDitheringPalette(palette);
+	}
 
-	return _video->loadFile(path);
+	return result;
 }
 
 bool DigitalVideoCastMember::isModified() {
@@ -363,7 +378,7 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
 	}
 
 	// Do not render stopped videos
-	if (_channel->_movieRate == 0.0 && !_getFirstFrame) {
+	if (_channel->_movieRate == 0.0 && !_getFirstFrame && _lastFrame) {
 		widget->getSurface()->blitFrom(*_lastFrame);
 
 		return widget;
@@ -375,21 +390,15 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
 	_channel->_movieTime = getMovieCurrentTime();
 
 	if (frame) {
-		if (g_director->_pixelformat.bytesPerPixel == 1) {
-			if (frame->format.bytesPerPixel != 1) {
-				warning("STUB: video >8bpp");
-			} else {
-				_lastFrame = frame;
-				widget->getSurface()->blitFrom(*frame);
-			}
-		} else {
+		if (_lastFrame) {
+			_lastFrame->free();
 			delete _lastFrame;
-			_lastFrame = frame->convertTo(g_director->_pixelformat, g_director->getPalette());
-			widget->getSurface()->blitFrom(*_lastFrame);
 		}
-	} else {
-		widget->getSurface()->blitFrom(*_lastFrame);
+
+		_lastFrame = frame->convertTo(g_director->_pixelformat, g_director->getPalette());
 	}
+	if (_lastFrame)
+		widget->getSurface()->blitFrom(*_lastFrame);
 
 	if (_getFirstFrame) {
 		_video->stop();
diff --git a/engines/director/castmember.h b/engines/director/castmember.h
index cebcc9931a..3246739bfd 100644
--- a/engines/director/castmember.h
+++ b/engines/director/castmember.h
@@ -71,6 +71,7 @@ public:
 	virtual void setEditable(bool editable) {}
 	virtual bool isModified() { return _modified; }
 	virtual Graphics::MacWidget *createWidget(Common::Rect &bbox, Channel *channel) { return nullptr; }
+	virtual void updateWidget(Graphics::MacWidget *widget, Channel *channel) {}
 	virtual void updateFromWidget(Graphics::MacWidget *widget) {}
 	virtual Common::Rect getInitialRect() { return _initialRect; }
 
@@ -173,7 +174,7 @@ public:
 	int _duration;
 
 	Video::VideoDecoder *_video;
-	const Graphics::Surface *_lastFrame;
+	Graphics::Surface *_lastFrame;
 
 	Channel *_channel;
 };


Commit: 527a09322897d56a99ac2962d8bc2b9300daa1da
    https://github.com/scummvm/scummvm/commit/527a09322897d56a99ac2962d8bc2b9300daa1da
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix the _videoPlayback flag

The _videoPlayback flag needs to be enabled as soon as a video starts
playing, instead of the frame after.

Fixes the morphing cloud animations in Chop Suey.

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6d0727e9d5..bb1021049c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -508,6 +508,10 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
 				_window->addDirtyRect(channel->getBbox());
 
 			channel->setClean(nextSprite, i);
+			// Check again to see if a video has just been started by setClean.
+			if (channel->isActiveVideo())
+				_movie->_videoPlayback = true;
+
 			_window->addDirtyRect(channel->getBbox());
 			debugC(2, kDebugImages, "Score::renderSprites(): CH: %-3d castId: %03d(%s) [ink: %d, puppet: %d, moveable: %d, visible: %d] [bbox: %d,%d,%d,%d] [type: %d fg: %d bg: %d] [script: %d]", i, currentSprite->_castId, numToCastNum(currentSprite->_castId), currentSprite->_ink, currentSprite->_puppet, currentSprite->_moveable, channel->_visible, PRINT_RECT(channel->getBbox()), currentSprite->_spriteType, currentSprite->_foreColor, currentSprite->_backColor, currentSprite->_scriptId);
 		} else {


Commit: 83c400600de18f9d68ca738776c3c71d1748b518
    https://github.com/scummvm/scummvm/commit/83c400600de18f9d68ca738776c3c71d1748b518
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix the SoundCastMember looping flag

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index b2ddde7b7a..f42ec0d59d 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1195,6 +1195,11 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
 		}
 	}
 
+	// For SoundCastMember, read the flags in the CastInfo
+	if ((_vm->getVersion() < 500) && (member->_type == kCastSound)) {
+		((SoundCastMember *)member)->_looping = castInfo.flags & 16 ? 0 : 1;
+	}
+
 	ci->scriptId = castInfo.scriptId;
 	if (ci->scriptId != 0)
 		_castsScriptIds[ci->scriptId] = id;


Commit: 73d9aa2a834cd60bb7c5a6a62444b7dbed6211fb
    https://github.com/scummvm/scummvm/commit/73d9aa2a834cd60bb7c5a6a62444b7dbed6211fb
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Add P.A.W.S. to detection tables

Changed paths:
    engines/director/detection.cpp
    engines/director/detection_tables.h


diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index d3cdf5b512..9d029c2e64 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -120,6 +120,7 @@ static const PlainGameDescriptor directorGames[] = {
 	{ "nile",				"Nile: Passage to Egypt"},
 	{ "noir",				"Noir: A Shadowy Thriller"},
 	{ "operafatal",			"Opera Fatal"},
+	{ "paws",				"P.A.W.S.: Personal Automated Wagging System"},
 	{ "phantasplanet",		"Phantasmagoria Amusement Planet"},
 	{ "pitfall",			"Pitfall: The Mayan Adventure" },
 	{ "planetarizona",		"Escape from Planet Arizona" },
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 88f870e16d..5397758ac8 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -659,6 +659,9 @@ static const DirectorGameDescription gameDescriptions[] = {
 		400
 	},
 
+	WINGAME("paws", "", "STARTDOG.EXE", "5c9a56c88b4bb8732377f93f62a885a4", 818961, 404),
+	WINGAME("paws", "Making Of", "MAKEPAWS.EXE", "559f4c728a348c18b96cddaf102e3413", 874293, 404),
+
 	MACGAME_l("phantasplanet", "", "phantasmagoria_PPC", "602e61f10c158183218405dd30a09b3f", 60352, Common::JA_JPN, 400),
 	WINGAME_l("phantasplanet", "", "PHANTAS.EXE", "c2dd62dd0f9488ae8102970553eff170", 690449, Common::JA_JPN, 400),
 


Commit: e7375f74953999844dac4e3bae75e87dd40bd1fe
    https://github.com/scummvm/scummvm/commit/e7375f74953999844dac4e3bae75e87dd40bd1fe
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Update Chop Suey engine version in detection tables

Changed paths:
    engines/director/detection_tables.h


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 5397758ac8..daa8a47a8b 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -333,7 +333,7 @@ static const DirectorGameDescription gameDescriptions[] = {
 
 	WINDEMO("c64pack", "Demo", "C64DEMO.EXE", "0458e44d9ad4ae0d3a583ac4141d21ae", 1007517, 400), // full game is not Director
 
-	WINGAME("chopsuey", "", "CHOPSUEY.EXE", "785e26240153a028549e8a66c2e904bf", 772382, 400),
+	WINGAME("chopsuey", "", "CHOPSUEY.EXE", "785e26240153a028549e8a66c2e904bf", 772382, 404),
 
 	MACGAME_l("chuteng", "", "ChuTeng", "ea646eccc9a53f44ce082459d4809a06", 484351, Common::JA_JPN, 400), // executable file name is in Japanese characters
 	WINGAME_l("chuteng", "", "CHUTENG.EXE", "aaef7b33829ff7b0243412c89869e011", 746971, Common::JA_JPN, 400),


Commit: b09b54fa1bb637a75662219516dfb5959d7accce
    https://github.com/scummvm/scummvm/commit/b09b54fa1bb637a75662219516dfb5959d7accce
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix memory leak in _castsInfo

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index f42ec0d59d..fda019778f 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -97,6 +97,9 @@ Cast::~Cast() {
 		for (Common::HashMap<int, CastMember *>::iterator it = _loadedCast->begin(); it != _loadedCast->end(); ++it)
 			delete it->_value;
 
+	for (Common::HashMap<uint16, CastMemberInfo *>::iterator it = _castsInfo.begin(); it != _castsInfo.end(); ++it)
+		delete it->_value;
+
 	delete _loadedStxts;
 	delete _loadedCast;
 	delete _lingoArchive;


Commit: ca0c5c800d6b8bcb8801e17b0a00617360ab95b4
    https://github.com/scummvm/scummvm/commit/ca0c5c800d6b8bcb8801e17b0a00617360ab95b4
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: Fix memory leaks in SoundCastMember

Changed paths:
    engines/director/castmember.cpp
    engines/director/castmember.h
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 303bc7d369..de41890cf8 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -29,6 +29,7 @@
 #include "director/cursor.h"
 #include "director/channel.h"
 #include "director/movie.h"
+#include "director/sound.h"
 #include "director/window.h"
 #include "director/stxt.h"
 
@@ -490,6 +491,11 @@ SoundCastMember::SoundCastMember(Cast *cast, uint16 castId, Common::SeekableRead
 	_looping = 0;
 }
 
+SoundCastMember::~SoundCastMember() {
+	if (_audio)
+		delete _audio;
+}
+
 
 /////////////////////////////////////
 // Text
diff --git a/engines/director/castmember.h b/engines/director/castmember.h
index 3246739bfd..91a1d196b0 100644
--- a/engines/director/castmember.h
+++ b/engines/director/castmember.h
@@ -182,6 +182,7 @@ public:
 class SoundCastMember : public CastMember {
 public:
 	SoundCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
+	~SoundCastMember();
 
 	bool _looping;
 	AudioDecoder *_audio;
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index c2d3910a0f..51d93b848a 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -228,13 +228,14 @@ void DirectorSound::systemBeep() {
 }
 
 Audio::AudioStream *AudioDecoder::getLoopingAudioStream() {
-	Audio::RewindableAudioStream *target = getAudioStream(DisposeAfterUse::NO);
+	Audio::RewindableAudioStream *target = getAudioStream(DisposeAfterUse::YES);
 	if (!target)
 		return nullptr;
 	return new Audio::LoopingAudioStream(target, 0);
 }
 
-SNDDecoder::SNDDecoder() {
+SNDDecoder::SNDDecoder()
+		: AudioDecoder() {
 	_data = nullptr;
 	_channels = 0;
 	_size = 0;
@@ -382,6 +383,11 @@ Audio::RewindableAudioStream *SNDDecoder::getAudioStream(DisposeAfterUse::Flag d
 	return Audio::makeRawStream(buffer, _size, _rate, _flags, disposeAfterUse);
 }
 
+AudioFileDecoder::AudioFileDecoder(Common::String &path)
+		: AudioDecoder() {
+	_path = path;
+}
+
 Audio::RewindableAudioStream *AudioFileDecoder::getAudioStream(DisposeAfterUse::Flag disposeAfterUse) {
 	if (_path.empty())
 		return nullptr;
diff --git a/engines/director/sound.h b/engines/director/sound.h
index f289518727..85eab9d949 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -91,9 +91,10 @@ private:
 
 class AudioDecoder {
 public:
+	AudioDecoder() {};
 	virtual ~AudioDecoder() {};
 public:
-	virtual Audio::RewindableAudioStream *getAudioStream(DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) = 0;
+	virtual Audio::RewindableAudioStream *getAudioStream(DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) { return nullptr; }
 	virtual Audio::AudioStream *getLoopingAudioStream();
 };
 
@@ -115,9 +116,9 @@ private:
 	byte _flags;
 };
 
-class AudioFileDecoder: public AudioDecoder {
+class AudioFileDecoder : public AudioDecoder {
 public:
-	AudioFileDecoder(Common::String &path): _path(path) {};
+	AudioFileDecoder(Common::String &path);
 	~AudioFileDecoder() {};
 
 	void setPath(Common::String &path);


Commit: 7197d470d339338addd50178f67e22f28c83957c
    https://github.com/scummvm/scummvm/commit/7197d470d339338addd50178f67e22f28c83957c
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
Revert "DIRECTOR: Add puppet check on kTheCastNum"

This reverts commit d650738f9fbad1dee3970177d0574ff632656dbb.

This change caused several scenes to render incorrectly (e.g. the
witches cauldron on the Chop Suey map screen).

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


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index b3555870f6..7a63676237 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1279,13 +1279,6 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		{
 			int castId = d.asCastId();
 			if (castId != sprite->_castId) {
-				// WORKAROUND: Chop Suey cursor is not marked puppet, so it will flash
-				// unnecessarily on frame change unless it is puppet.
-				if (!sprite->_puppet) {
-					warning("setTheSprite(): kTheCastNum: Sprite %d not a puppet", id);
-					sprite->_puppet = true;
-				}
-
 				g_director->getCurrentWindow()->addDirtyRect(channel->getBbox());
 				channel->setCast(castId);
 				channel->_dirty = true;


Commit: 16eb05cee837f31b66df236c1209ae68ae72225a
    https://github.com/scummvm/scummvm/commit/16eb05cee837f31b66df236c1209ae68ae72225a
Author: Scott Percival (code at moral.net.au)
Date: 2021-04-25T23:22:51+08:00

Commit Message:
DIRECTOR: LINGO: Allow b_puppetSound to support 2 args

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 1936659c0d..f5122f878d 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1848,19 +1848,28 @@ void LB::b_puppetPalette(int nargs) {
 }
 
 void LB::b_puppetSound(int nargs) {
-	ARGNUMCHECK(1);
 
+	if (nargs < 1 || nargs >= 3) {
+		warning("b_puppetSound(): needs 1 or 2 args");
+		return;
+	}
+	
 	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;
 	}
 
 	int castId = castMember.asCastId();
-	sound->playCastMember(castId, 1);
+	sound->playCastMember(castId, channel);
 }
 
 void LB::b_puppetSprite(int nargs) {




More information about the Scummvm-git-logs mailing list