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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Fri Dec 24 12:04:25 CET 2010


Revision: 55031
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55031&view=rev
Author:   bgk
Date:     2010-12-24 11:04:25 +0000 (Fri, 24 Dec 2010)

Log Message:
-----------
MOHAWK: Fix playing sound from aliases in Myst ME.

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

Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp	2010-12-24 10:52:02 UTC (rev 55030)
+++ scummvm/trunk/engines/mohawk/sound.cpp	2010-12-24 11:04:25 UTC (rev 55031)
@@ -130,13 +130,13 @@
 
 	//TODO: The original engine does fading
 
-	Common::String name = _vm->getResourceName(ID_MSND, id);
+	Common::String name = getName(id);
 
 	// Check if sound is already playing
 	for (uint32 i = 0; i < _handles.size(); i++)
 		if (_handles[i].type == kUsedHandle
 				&& _vm->_mixer->isSoundHandleActive(_handles[i].handle)
-				&& name.equals(_vm->getResourceName(ID_MSND, _handles[i].id)))
+				&& name.equals(getName(_handles[i].id)))
 			return &_handles[i].handle;
 
 	stopSound();
@@ -562,13 +562,13 @@
 
 	//TODO: The original engine does fading
 
-	Common::String name = _vm->getResourceName(ID_MSND, id);
+	Common::String name = getName(id);
 
 	// Check if sound is already playing
 	for (uint32 i = 0; i < _handles.size(); i++)
 		if (_handles[i].type == kBackgroundHandle
 				&& _vm->_mixer->isSoundHandleActive(_handles[i].handle)
-				&& name.equals(_vm->getResourceName(ID_MSND, _handles[i].id)))
+				&& name.equals(getName(_handles[i].id)))
 			return &_handles[i].handle;
 
 	// Stop old background sound
@@ -619,4 +619,21 @@
 			_vm->_mixer->setChannelVolume(_handles[i].handle, vol >> 8);
 }
 
+Common::String Sound::getName(uint16 id) {
+	if (_vm->getFeatures() & GF_ME) {
+		// Myst ME is a bit more efficient with sound storage than Myst
+		// Myst has lots of sounds repeated. To overcome this, Myst ME
+		// has MJMP resources which provide a link to the actual MSND
+		// resource we're looking for. This saves a lot of space from
+		// repeated data.
+		if (_vm->hasResource(ID_MJMP, id)) {
+			Common::SeekableReadStream *mjmpStream = _vm->getResource(ID_MJMP, id);
+			id = mjmpStream->readUint16LE();
+			delete mjmpStream;
+		}
+	}
+
+	return _vm->getResourceName(ID_MSND, id);
+}
+
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h	2010-12-24 10:52:02 UTC (rev 55030)
+++ scummvm/trunk/engines/mohawk/sound.h	2010-12-24 11:04:25 UTC (rev 55031)
@@ -157,6 +157,7 @@
 	Common::Array<SndHandle> _handles;
 	SndHandle *getHandle();
 	Audio::AudioStream *makeAudioStream(uint16 id);
+	Common::String getName(uint16 id);
 
 	// Riven-specific
 	void playSLSTSound(uint16 index, bool fade, bool loop, uint16 volume, int16 balance);


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