[Scummvm-cvs-logs] SF.net SVN: scummvm:[55460] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Sun Jan 23 08:02:49 CET 2011


Revision: 55460
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55460&view=rev
Author:   mthreepwood
Date:     2011-01-23 07:02:49 +0000 (Sun, 23 Jan 2011)

Log Message:
-----------
MOHAWK: Implement Riven's stopSound() and fadeAmbientSounds() opcodes

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/riven_scripts.cpp
    scummvm/trunk/engines/mohawk/sound.cpp
    scummvm/trunk/engines/mohawk/sound.h

Modified: scummvm/trunk/engines/mohawk/riven_scripts.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_scripts.cpp	2011-01-23 06:54:35 UTC (rev 55459)
+++ scummvm/trunk/engines/mohawk/riven_scripts.cpp	2011-01-23 07:02:49 UTC (rev 55460)
@@ -394,15 +394,22 @@
 
 // Command 12: stop sounds (flags)
 void RivenScript::stopSound(uint16 op, uint16 argc, uint16 *argv) {
+	// WORKAROUND: The Play Riven/Visit Riven/Start New Game buttons
+	// in the main menu call this function to stop ambient sounds
+	// after the change stack call to Temple Island. However, this
+	// would cause all ambient sounds not to play. An alternative
+	// fix would be to stop all scripts on a stack change, but this
+	// does fine for now.
+	if (_vm->getCurStack() == tspit && (_vm->getCurCardRMAP() == 0x6e9a || _vm->getCurCardRMAP() == 0xfeeb))
+		return;
+
 	// The argument is a bitflag for the setting.
 	// bit 0 is normal sound stopping (unused)
 	// bit 1 is ambient sound stopping
 	// Having no flags set means clear all
+	if (argv[0] & 2 || argv[0] == 0)
+		_vm->_sound->stopAllSLST();
 
-	// TODO: Enable this once empty SLST entries are properly handled
-	//if (argv[0] & 2 || argv[0] == 0)
-	//	_vm->_sound->stopAllSLST();
-
 	if (argv[0] & 1)
 		warning("Unhandled stopSound() flag");
 }
@@ -521,7 +528,8 @@
 
 // Command 37: fade ambient sounds
 void RivenScript::fadeAmbientSounds(uint16 op, uint16 argc, uint16 *argv) {
-	warning("STUB: fadeAmbientSounds()");
+	// Similar to stopSound(), but does fading
+	_vm->_sound->stopAllSLST(true);
 }
 
 // Command 38: Play a movie with extra parameters (movie id, delay high, delay low, record type, record id)

Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp	2011-01-23 06:54:35 UTC (rev 55459)
+++ scummvm/trunk/engines/mohawk/sound.cpp	2011-01-23 07:02:49 UTC (rev 55460)
@@ -291,8 +291,9 @@
 	}
 }
 
-void Sound::stopAllSLST() {
+void Sound::stopAllSLST(bool fade) {
 	for (uint16 i = 0; i < _currentSLSTSounds.size(); i++) {
+		// TODO: Fade out, if requested
 		_vm->_mixer->stopHandle(*_currentSLSTSounds[i].handle);
 		delete _currentSLSTSounds[i].handle;
 	}
@@ -326,7 +327,7 @@
 }
 
 void Sound::stopSLSTSound(uint16 index, bool fade) {
-	// TODO: Fade out, mixer needs to be extended to get volume on a handle
+	// TODO: Fade out, if requested
 	_vm->_mixer->stopHandle(*_currentSLSTSounds[index].handle);
 	delete _currentSLSTSounds[index].handle;
 	_currentSLSTSounds.remove_at(index);

Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h	2011-01-23 06:54:35 UTC (rev 55459)
+++ scummvm/trunk/engines/mohawk/sound.h	2011-01-23 07:02:49 UTC (rev 55460)
@@ -148,7 +148,7 @@
 	void playSLST(SLSTRecord slstRecord);
 	void pauseSLST();
 	void resumeSLST();
-	void stopAllSLST();
+	void stopAllSLST(bool fade = false);
 	static byte convertRivenVolume(uint16 volume);
 
 private:


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