[Scummvm-cvs-logs] scummvm master -> f34924bc3940ff1f9972ed4920feb7e5708f3099

fuzzie fuzzie at fuzzie.org
Mon Aug 20 21:22:21 CEST 2012


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

Summary:
b1af75f2c3 SWORD25: Improve sound persistence.
f34924bc39 SWORD25: Fix loading savegames on 64-bit archs.


Commit: b1af75f2c38e1997577599308f75ee0d1299b13e
    https://github.com/scummvm/scummvm/commit/b1af75f2c38e1997577599308f75ee0d1299b13e
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2012-08-20T12:14:10-07:00

Commit Message:
SWORD25: Improve sound persistence.

Keep track of volume/panning state, and don't restart sounds which already
finished playing.

Changed paths:
    engines/sword25/sfx/soundengine.cpp



diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 78b2db1..69fae3d 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -239,16 +239,20 @@ void SoundEngine::setSoundVolume(uint handle, float volume) {
 	debugC(1, kDebugSound, "SoundEngine::setSoundVolume(%d, %f)", handle, volume);
 
 	SndHandle* sndHandle = findHandle(handle);
-	if (sndHandle != NULL)
+	if (sndHandle != NULL) {
+		sndHandle->volume = volume;
 		_mixer->setChannelVolume(sndHandle->handle, (byte)(volume * 255));
+	}
 }
 
 void SoundEngine::setSoundPanning(uint handle, float pan) {
 	debugC(1, kDebugSound, "SoundEngine::setSoundPanning(%d, %f)", handle, pan);
 
 	SndHandle* sndHandle = findHandle(handle);
-	if (sndHandle != NULL)
+	if (sndHandle != NULL) {
+		sndHandle->pan = pan;
 		_mixer->setChannelBalance(sndHandle->handle, (int8)(pan * 127));
+	}
 }
 
 void SoundEngine::pauseSound(uint handle) {
@@ -324,13 +328,16 @@ bool SoundEngine::canLoadResource(const Common::String &fileName) {
 	return fname.hasSuffix(".ogg");
 }
 
-
-	bool SoundEngine::persist(OutputPersistenceBlock &writer) {
+bool SoundEngine::persist(OutputPersistenceBlock &writer) {
 	writer.write(_maxHandleId);
 
 	for (uint i = 0; i < SOUND_HANDLES; i++) {
 		writer.write(_handles[i].id);
 
+		// Don't restart sounds which already finished playing.
+		if (_handles[i].type != kFreeHandle && !_mixer->isSoundHandleActive(_handles[i].handle))
+			_handles[i].type = kFreeHandle;
+
 		writer.writeString(_handles[i].fileName);
 		writer.write((int)_handles[i].sndType);
 		writer.write(_handles[i].volume);
@@ -374,7 +381,8 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) {
 		reader.read(layer);
 
 		if (reader.isGood()) {
-			playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i);
+			if (sndType != kFreeHandle)
+				playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i);
 		} else
 			return false;
 	}


Commit: f34924bc3940ff1f9972ed4920feb7e5708f3099
    https://github.com/scummvm/scummvm/commit/f34924bc3940ff1f9972ed4920feb7e5708f3099
Author: upthorn (upthorn at gmail.com)
Date: 2012-08-20T12:15:46-07:00

Commit Message:
SWORD25: Fix loading savegames on 64-bit archs.

Changed paths:
    engines/sword25/util/pluto/pluto.cpp



diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp
index d645e5e..b7f5e30 100644
--- a/engines/sword25/util/pluto/pluto.cpp
+++ b/engines/sword25/util/pluto/pluto.cpp
@@ -895,10 +895,10 @@ static void unpersistnumber(UnpersistInfo *upi)
 static void unpersiststring(UnpersistInfo *upi)
 {
 					/* perms reftbl sptbl ref */
-	int length;
+	size_t length;
 	char* string;
 	lua_checkstack(upi->L, 1);
-	verify(LIF(Z,read)(&upi->zio, &length, sizeof(int)) == 0);
+	verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0);
 	string = pdep_newvector(upi->L, length, char);
 	verify(LIF(Z,read)(&upi->zio, string, length) == 0);
 	lua_pushlstring(upi->L, string, length);






More information about the Scummvm-git-logs mailing list