[Scummvm-cvs-logs] scummvm master -> 4443793b97761ab1dc1fb312a4092211356b008e

m-kiewitz m_kiewitz at users.sourceforge.net
Sat Sep 21 14:27:36 CEST 2013


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

Summary:
4443793b97 SCI: sfx/music priority int16 fixes bug #3615038


Commit: 4443793b97761ab1dc1fb312a4092211356b008e
    https://github.com/scummvm/scummvm/commit/4443793b97761ab1dc1fb312a4092211356b008e
Author: m-kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2013-09-21T05:27:16-07:00

Commit Message:
SCI: sfx/music priority int16 fixes bug #3615038

it seems that sound system up till SCI0_LATE uses int16, afterwards it seems they changed to byte
main music object (conMusic) in Laura Bow 1 uses -1 as priority. This was truncated to 255 till now, which resulted in many sound effects not getting played, because those used priority 0

Changed paths:
    engines/sci/engine/savegame.cpp
    engines/sci/engine/savegame.h
    engines/sci/sound/music.h
    engines/sci/sound/soundcmd.cpp



diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index c8076ec..fa9363a 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -600,7 +600,10 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
 	s.syncAsSint16LE(dataInc);
 	s.syncAsSint16LE(ticker);
 	s.syncAsSint16LE(signal, VER(17));
-	s.syncAsByte(priority);
+	if (s.getVersion() >= 31) // ffs. sound/music.h -> priority
+		s.syncAsSint16LE(priority);
+	else
+		s.syncAsByte(priority);
 	s.syncAsSint16LE(loop, VER(17));
 	s.syncAsByte(volume);
 	s.syncAsByte(hold, VER(17));
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index 1d899b0..f1f02f8 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -37,6 +37,7 @@ struct EngineState;
  *
  * Version - new/changed feature
  * =============================
+ *      31 - priority for sound effects/music is now a signed int16, instead of a byte
  *      30 - synonyms
  *      29 - system strings
  *      28 - heap
@@ -55,7 +56,7 @@ struct EngineState;
  */
 
 enum {
-	CURRENT_SAVEGAME_VERSION = 30,
+	CURRENT_SAVEGAME_VERSION = 31,
 	MINIMUM_SAVEGAME_VERSION = 14
 };
 
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 5924a0f..b582e7f 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -70,7 +70,7 @@ public:
 	uint16 dataInc;
 	uint16 ticker;
 	uint16 signal;
-	byte priority;
+	int16 priority; // must be int16, at least in Laura Bow 1, main music (object conMusic) uses priority -1
 	uint16 loop;
 	int16 volume;
 	int16 hold;
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b0102a0..90ad51b 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -116,7 +116,10 @@ void SoundCommandParser::processInitSound(reg_t obj) {
 	newSound->resourceId = resourceId;
 	newSound->soundObj = obj;
 	newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
-	newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(priority)) & 0xFF;
+	if (_soundVersion <= SCI_VERSION_0_LATE)
+		newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(priority));
+	else
+		newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(priority)) & 0xFF;
 	if (_soundVersion >= SCI_VERSION_1_EARLY)
 		newSound->volume = CLIP<int>(readSelectorValue(_segMan, obj, SELECTOR(vol)), 0, MUSIC_VOLUME_MAX);
 	newSound->reverb = -1;	// initialize to SCI invalid, it'll be set correctly in soundInitSnd() below
@@ -428,7 +431,7 @@ reg_t SoundCommandParser::kDoSoundUpdate(int argc, reg_t *argv, reg_t acc) {
 	int16 objVol = CLIP<int>(readSelectorValue(_segMan, obj, SELECTOR(vol)), 0, 255);
 	if (objVol != musicSlot->volume)
 		_music->soundSetVolume(musicSlot, objVol);
-	uint32 objPrio = readSelectorValue(_segMan, obj, SELECTOR(priority));
+	int32 objPrio = readSelectorValue(_segMan, obj, SELECTOR(priority));
 	if (objPrio != musicSlot->priority)
 		_music->soundSetPriority(musicSlot, objPrio);
 	return acc;






More information about the Scummvm-git-logs mailing list