[Scummvm-cvs-logs] SF.net SVN: scummvm:[50759] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Jul 9 16:11:27 CEST 2010


Revision: 50759
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50759&view=rev
Author:   m_kiewitz
Date:     2010-07-09 14:11:27 +0000 (Fri, 09 Jul 2010)

Log Message:
-----------
SCI: added currently commented-out pauseSound implementation for some sci0 games, allowing integer for that subfunction

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/sound/music.cpp
    scummvm/trunk/engines/sci/sound/music.h
    scummvm/trunk/engines/sci/sound/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-09 13:01:48 UTC (rev 50758)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-09 14:11:27 UTC (rev 50759)
@@ -260,7 +260,7 @@
     { SIG_SOUNDSCI0,       3, MAP_CALL(DoSoundDispose),            "o",                    NULL },
     { SIG_SOUNDSCI0,       4, MAP_CALL(DoSoundMute),               "(i)",                  NULL },
     { SIG_SOUNDSCI0,       5, MAP_CALL(DoSoundStop),               "o",                    NULL },
-    { SIG_SOUNDSCI0,       6, MAP_CALL(DoSoundPause),              "[o0]",                 NULL },
+    { SIG_SOUNDSCI0,       6, MAP_CALL(DoSoundPause),              "[o0i]",                NULL },
     { SIG_SOUNDSCI0,       7, MAP_CALL(DoSoundResume),             "o",                    NULL },
     { SIG_SOUNDSCI0,       8, MAP_CALL(DoSoundMasterVolume),       "(i)",                  NULL },
     { SIG_SOUNDSCI0,       9, MAP_CALL(DoSoundUpdate),             "o",                    NULL },

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-07-09 13:01:48 UTC (rev 50758)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-07-09 14:11:27 UTC (rev 50759)
@@ -166,8 +166,6 @@
 }
 
 void SciMusic::stopAll() {
-	Common::StackLock lock(_mutex);
-
 	const MusicList::iterator end = _playList.end();
 	for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
 		soundStop(*i);
@@ -199,6 +197,24 @@
 	return NULL;
 }
 
+// We return the currently active music slot for SCI0
+MusicEntry *SciMusic::getActiveSci0MusicSlot() {
+	const MusicList::iterator end = _playList.end();
+	MusicEntry *highestPrioritySlot = NULL;
+	for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
+		MusicEntry *playSlot = *i;
+		if (playSlot->pMidiParser) {
+			if (playSlot->status == kSoundPlaying)
+				return playSlot;
+			if (playSlot->status == kSoundPaused) {
+				if ((!highestPrioritySlot) || (highestPrioritySlot->priority < playSlot->priority))
+					highestPrioritySlot = playSlot;
+			}
+		}
+	}
+	return highestPrioritySlot;
+}
+
 void SciMusic::setReverb(byte reverb) {
 	Common::StackLock lock(_mutex);
 	_pMidiDrv->setReverb(reverb);

Modified: scummvm/trunk/engines/sci/sound/music.h
===================================================================
--- scummvm/trunk/engines/sci/sound/music.h	2010-07-09 13:01:48 UTC (rev 50758)
+++ scummvm/trunk/engines/sci/sound/music.h	2010-07-09 14:11:27 UTC (rev 50759)
@@ -157,6 +157,7 @@
 	}
 
 	MusicEntry *getSlot(reg_t obj);
+	MusicEntry *getActiveSci0MusicSlot();
 
 	void pushBackSlot(MusicEntry *slotEntry) {
 		Common::StackLock lock(_mutex);

Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-07-09 13:01:48 UTC (rev 50758)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-07-09 14:11:27 UTC (rev 50759)
@@ -213,8 +213,28 @@
 	uint16 value = argc > 1 ? argv[1].toUint16() : 0;
 
 	if (!obj.segment) {		// pause the whole playlist
-		// Pausing/Resuming the whole playlist was introduced in the SCI1 late
-		// sound scheme.
+		// SCI0 games (up to including qfg1) give us 0/1 for either resuming or pausing the current music
+		//  this one doesn't count, so pausing 2 times and resuming once means here that we are supposed to resume
+		if (_soundVersion <= SCI_VERSION_0_LATE) {
+			// TODO: this code doesn't work right currently
+			return make_reg(0, 0);
+			MusicEntry *musicSlot = _music->getActiveSci0MusicSlot();
+			switch (obj.offset) {
+			case 1:
+				if ((musicSlot) && (musicSlot->status == kSoundPlaying))
+					_music->soundPause(musicSlot);
+				return make_reg(0, 0);
+			case 0:
+				if ((musicSlot) && (musicSlot->status == kSoundPaused))
+					_music->soundResume(musicSlot);
+					return make_reg(0, 1);
+				return make_reg(0, 0);
+			default:
+				error("kDoSoundPause: parameter 0 is invalid for sound-sci0");
+			}
+		}
+
+		// Pausing/Resuming the whole playlist was introduced in the SCI1 late sound scheme.
 		if (_soundVersion <= SCI_VERSION_1_EARLY)
 			return acc;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list