[Scummvm-git-logs] scummvm master -> 0709bac3ab8fd3428ef4ec7e84d5f8179191f681

sev- noreply at scummvm.org
Sat Jul 23 21:49:38 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:
d9cf093c95 DIRECTOR: Fix film loops with more than 8 cast members
7c9badd57c DIRECTOR: Add debug level for sound events
0709bac3ab DIRECTOR: Incorporate frame delay for transitions


Commit: d9cf093c9534baa6dad7034714e509bffd2c7453
    https://github.com/scummvm/scummvm/commit/d9cf093c9534baa6dad7034714e509bffd2c7453
Author: Scott Percival (code at moral.net.au)
Date: 2022-07-23T23:49:35+02:00

Commit Message:
DIRECTOR: Fix film loops with more than 8 cast members

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 2b594dce917..926ccf801c7 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -986,8 +986,16 @@ Common::Array<Channel> *FilmLoopCastMember::getSubChannels(Common::Rect &bbox, C
 		chan._height = height;
 
 		_subchannels.push_back(chan);
-		_subchannels[_subchannels.size() - 1].replaceWidget();
+
+	}
+	// Initialise the widgets on all of the subchannels.
+	// This has to be done once the list has been constructed, otherwise
+	// the list grow operation will erase the widgets as they aren't
+	// part of the Channel assignment constructor.
+	for (auto &iter : _subchannels) {
+		iter.replaceWidget();
 	}
+
 	return &_subchannels;
 }
 


Commit: 7c9badd57cd4f39abee0aa274ec012c544dd3efc
    https://github.com/scummvm/scummvm/commit/7c9badd57cd4f39abee0aa274ec012c544dd3efc
Author: Scott Percival (code at moral.net.au)
Date: 2022-07-23T23:49:35+02:00

Commit Message:
DIRECTOR: Add debug level for sound events

Changed paths:
    engines/director/detection.cpp
    engines/director/director.h
    engines/director/lingo/lingo-the.cpp
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index d57ed5feb14..8eac0465b35 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -65,6 +65,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{Director::kDebugPreprocess, "preprocess", "Lingo preprocessing"},
 	{Director::kDebugScreenshot, "screenshot", "screenshot each frame"},
 	{Director::kDebugSlow, "slow", "Slow playback"},
+	{Director::kDebugSound, "sound", "Sound playback"},
 	{Director::kDebugText, "text", "Text rendering"},
 	DEBUG_CHANNEL_END
 };
diff --git a/engines/director/director.h b/engines/director/director.h
index d576a014a49..769d4499d1f 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -85,7 +85,8 @@ enum {
 	kDebugDesktop		= 1 << 15,
 	kDebug32bpp			= 1 << 16,
 	kDebugEndVideo		= 1 << 17,
-	kDebugLingoStrict	= 1 << 18
+	kDebugLingoStrict	= 1 << 18,
+	kDebugSound			= 1 << 19,
 };
 
 struct MovieReference {
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 2f2d48c7275..e951b5e114b 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1195,7 +1195,7 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
 		break;
 	case kTheSoundLevel:
 		// setting all of the channel for now
-		_vm->getCurrentWindow()->getSoundManager()->setSouldLevel(-1, d.asInt());
+		_vm->getCurrentWindow()->getSoundManager()->setSoundLevel(-1, d.asInt());
 		break;
 	case kTheSprite:
 		setTheSprite(id, field, d);
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 645a4540b59..cb4ea80dbc2 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -174,6 +174,7 @@ void DirectorSound::playCastMember(CastMemberID memberID, uint8 soundChannel, bo
 					warning("DirectorSound::playCastMember: audio data failed to load from cast");
 					return;
 				}
+				debugC(5, kDebugSound, "DirectorSound::playCastMember(): playing cast ID %s, channel %d, looping %d, stopOnZero %d", memberID.asString().c_str(), soundChannel, looping, stopOnZero);
 				playStream(*as, soundChannel);
 				setLastPlayedSound(soundChannel, memberID, stopOnZero);
 			}
@@ -377,6 +378,7 @@ void DirectorSound::playExternalSound(uint16 menu, uint16 submenu, uint8 soundCh
 		loadSampleSounds(menu);
 
 	if (1 <= submenu && submenu <= menuSounds.size()) {
+		debugC(5, kDebugSound, "DirectorSound::playExternalSound(): playing menu ID %d, submenu ID %d, channel %d", menu, submenu, soundChannel);
 		playStream(*(menuSounds[submenu - 1]->getAudioStream()), soundChannel);
 		setLastPlayedSound(soundChannel, soundId);
 	} else {
@@ -425,6 +427,7 @@ void DirectorSound::stopSound(uint8 soundChannel) {
 	if (!isChannelValid(soundChannel))
 		return;
 
+	debugC(5, kDebugSound, "DirectorSound::stopSound(): stopping channel %d", soundChannel);
 	cancelFade(soundChannel);
 	_mixer->stopHandle(_channels[soundChannel - 1].handle);
 	setLastPlayedSound(soundChannel, SoundID());
@@ -432,6 +435,7 @@ void DirectorSound::stopSound(uint8 soundChannel) {
 }
 
 void DirectorSound::stopSound() {
+	debugC(5, kDebugSound, "DirectorSound::stopSound(): stopping all channels");
 	for (uint i = 0; i < _channels.size(); i++) {
 		cancelFade(i + 1);
 
@@ -444,6 +448,7 @@ void DirectorSound::stopSound() {
 }
 
 void DirectorSound::systemBeep() {
+	debugC(5, kDebugSound, "DirectorSound::systemBeep(): beep!");
 	_speaker->play(Audio::PCSpeaker::kWaveFormSquare, 500, 150);
 }
 
@@ -474,6 +479,8 @@ void DirectorSound::playPuppetSound(uint8 soundChannel) {
 	if (!_channels[soundChannel - 1].newPuppet)
 		return;
 
+	debugC(5, kDebugSound, "DirectorSound::playPuppetSound(): playing on channel %d", soundChannel);
+
 	_channels[soundChannel - 1].newPuppet = false;
 	playSound(_channels[soundChannel - 1].puppet, soundChannel, true);
 }
@@ -567,7 +574,7 @@ void DirectorSound::setSoundLevelInternal(uint8 soundChannel, uint8 soundLevel)
 }
 
 // -1 represent all the sound channel
-void DirectorSound::setSouldLevel(int channel, uint8 soundLevel) {
+void DirectorSound::setSoundLevel(int channel, uint8 soundLevel) {
 	if (soundLevel >= 8) {
 		warning("DirectorSound::setSoundLevel: soundLevel %d out of bounds", soundLevel);
 		return;
@@ -576,8 +583,10 @@ void DirectorSound::setSouldLevel(int channel, uint8 soundLevel) {
 	if (channel != -1) {
 		if (!isChannelValid(channel))
 			return;
+		debugC(5, kDebugSound, "DirectorSound::setSoundLevel: setting channel %d to level %d", channel, soundLevel);
 		setSoundLevelInternal(channel, soundLevel);
 	} else {
+		debugC(5, kDebugSound, "DirectorSound::setSoundLevel: setting all channels to level %d", soundLevel);
 		for (uint i = 0; i < _channels.size(); i++)
 			setSoundLevelInternal(i + 1, soundLevel);
 	}
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 7659dfc9b41..a16b4adff01 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -179,7 +179,7 @@ public:
 	void playExternalSound(uint16 menu, uint16 submenu, uint8 soundChannel);
 	void playFPlaySound(const Common::Array<Common::String> &fplayList);
 	void playFPlaySound();
-	void setSouldLevel(int channel, uint8 soundLevel);
+	void setSoundLevel(int channel, uint8 soundLevel);
 	uint8 getSoundLevel(uint8 soundChannel);
 	void setSoundEnabled(bool enabled);
 	void systemBeep();


Commit: 0709bac3ab8fd3428ef4ec7e84d5f8179191f681
    https://github.com/scummvm/scummvm/commit/0709bac3ab8fd3428ef4ec7e84d5f8179191f681
Author: Scott Percival (code at moral.net.au)
Date: 2022-07-23T23:49:35+02:00

Commit Message:
DIRECTOR: Incorporate frame delay for transitions

Subtract the time already taken to blit the frame from the delay value.
Improves playback timing on most transitions.

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 59051749c1e..234cdbe0bbb 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -244,6 +244,7 @@ void Window::playTransition(uint16 transDuration, uint8 transArea, uint8 transCh
 	uint h = clipRect.height();
 
 	for (uint16 i = 1; i < t.steps + 1; i++) {
+		uint32 startTime = g_system->getMillis();
 		bool stop = false;
 		rto = clipRect;
 		rfrom = clipRect;
@@ -513,7 +514,6 @@ void Window::playTransition(uint16 transDuration, uint8 transArea, uint8 transCh
 
 		_composeSurface->blitFrom(*blitFrom, rfrom, Common::Point(rto.left, rto.top));
 
-		g_system->delayMillis(t.stepDuration);
 		if (_vm->processEvents(true)) {
 			exitTransition(&nextFrame, clipRect);
 			break;
@@ -528,6 +528,10 @@ void Window::playTransition(uint16 transDuration, uint8 transArea, uint8 transCh
 				stepTransition();
 		}
 
+		uint32 endTime = g_system->getMillis();
+		int diff = (int)t.stepDuration - (int)(endTime - startTime);
+		g_system->delayMillis(MAX(0, diff));
+
 		g_lingo->executePerFrameHook(t.frame, i);
 	}
 
@@ -663,6 +667,7 @@ void Window::dissolveTrans(TransParams &t, Common::Rect &clipRect, Graphics::Man
 	Common::Rect r(MAX(1, t.xStepSize), t.yStepSize);
 
 	for (int i = 0; i < t.steps; i++) {
+		uint32 startTime = g_system->getMillis();
 		uint32 pixPerStep = pixPerStepInit;
 		do {
 			uint32 x = (rnd - 1) >> vShift;
@@ -718,7 +723,9 @@ void Window::dissolveTrans(TransParams &t, Common::Rect &clipRect, Graphics::Man
 			break;
 		}
 
-		g_system->delayMillis(t.stepDuration);
+		uint32 endTime = g_system->getMillis();
+		int diff = (int)t.stepDuration - (int)(endTime - startTime);
+		g_system->delayMillis(MAX(0, diff));
 	}
 }
 
@@ -794,6 +801,7 @@ void Window::dissolvePatternsTrans(TransParams &t, Common::Rect &clipRect, Graph
 	t.stepDuration = t.duration / t.steps;
 
 	for (int i = 0; i < t.steps; i++) {
+		uint32 startTime = g_system->getMillis();
 		for (int y = clipRect.top; y < clipRect.bottom; y++) {
 			byte pat = dissolvePatterns[i][y % 8];
 			byte *dst = (byte *)_composeSurface->getBasePtr(clipRect.left, y);
@@ -821,7 +829,9 @@ void Window::dissolvePatternsTrans(TransParams &t, Common::Rect &clipRect, Graph
 			break;
 		}
 
-		g_system->delayMillis(t.stepDuration);
+		uint32 endTime = g_system->getMillis();
+		int diff = (int)t.stepDuration - (int)(endTime - startTime);
+		g_system->delayMillis(MAX(0, diff));
 	}
 }
 
@@ -834,6 +844,7 @@ void Window::transMultiPass(TransParams &t, Common::Rect &clipRect, Graphics::Ma
 	Common::Array<Common::Rect> rects;
 
 	for (uint16 i = 1; i < t.steps; i++) {
+		uint32 startTime = g_system->getMillis();
 		bool stop = false;
 		rto = clipRect;
 
@@ -989,7 +1000,9 @@ void Window::transMultiPass(TransParams &t, Common::Rect &clipRect, Graphics::Ma
 
 		g_lingo->executePerFrameHook(t.frame, i);
 
-		g_system->delayMillis(t.stepDuration);
+		uint32 endTime = g_system->getMillis();
+		int diff = (int)t.stepDuration - (int)(endTime - startTime);
+		g_system->delayMillis(MAX(0, diff));
 
 		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);
@@ -1009,7 +1022,7 @@ void Window::transZoom(TransParams &t, Common::Rect &clipRect, Graphics::Managed
 	Graphics::MacPlotData pd(_composeSurface, nullptr, &g_director->_wm->getPatterns(), Graphics::kPatternCheckers, 0, 0, 1, 0);
 
 	for (uint16 i = 1; i < t.steps; i++) {
-
+		uint32 startTime = g_system->getMillis();
 		for (int s = 2; s >= 0; s--) {
 			if (i - s < 0 || i - s > t.steps - 2)
 				continue;
@@ -1036,7 +1049,9 @@ void Window::transZoom(TransParams &t, Common::Rect &clipRect, Graphics::Managed
 
 		g_lingo->executePerFrameHook(t.frame, i);
 
-		g_system->delayMillis(t.stepDuration);
+		uint32 endTime = g_system->getMillis();
+		int diff = (int)t.stepDuration - (int)(endTime - startTime);
+		g_system->delayMillis(MAX(0, diff));
 
 		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);




More information about the Scummvm-git-logs mailing list