[Scummvm-cvs-logs] scummvm master -> 9fd66deb43a8ba1bd7b423cb6fe2b7177af74166

bluegr md5 at scummvm.org
Mon Sep 26 19:10:01 CEST 2011


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:
43fb9d32b5 SCI: Code formatting
9fd66deb43 SCI: Changes to the sound resource initialization code


Commit: 43fb9d32b52d3db7530ba5afac1bfe8e11decde3
    https://github.com/scummvm/scummvm/commit/43fb9d32b52d3db7530ba5afac1bfe8e11decde3
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-26T10:02:32-07:00

Commit Message:
SCI: Code formatting

Changed paths:
    engines/sci/graphics/view.cpp



diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 6ca4903..a0d5b51 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -471,7 +471,8 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
 			curByte = *rlePtr++;
 			if (curByte & 0xC0) { // fill with color
 				runLength = curByte >> 6;
-				memset(outPtr + pixelNr,    curByte & 0x3F, MIN<uint16>(runLength, pixelCount - pixelNr));
+				curByte = curByte & 0x3F;
+				memset(outPtr + pixelNr,           curByte, MIN<uint16>(runLength, pixelCount - pixelNr));
 			} else { // skip the next pixels (transparency)
 				runLength = curByte & 0x3F;
 			}


Commit: 9fd66deb43a8ba1bd7b423cb6fe2b7177af74166
    https://github.com/scummvm/scummvm/commit/9fd66deb43a8ba1bd7b423cb6fe2b7177af74166
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-26T10:02:34-07:00

Commit Message:
SCI: Changes to the sound resource initialization code

- Unified the sound resource initialization code in
processInitSound() and reconstructPlayList()
- Now checking the "Mixed Adlib/MIDI" mode checkbox for SCI1.1 digital
audio sound effects, like it's done for SCI0 - SCI1 sound effects. If
it's unchecked, their MIDI counterparts will play instead, if
available

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



diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e43c709..c30518a 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -626,12 +626,8 @@ void SoundCommandParser::reconstructPlayList() {
 
 	const MusicList::iterator end = _music->getPlayListEnd();
 	for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
-		if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) {
-			(*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion);
-			_music->soundInitSnd(*i);
-		} else {
-			(*i)->soundRes = 0;
-		}
+		initSoundResource(*i);
+
 		if ((*i)->status == kSoundPlaying) {
 			// Sync the sound object's selectors related to playing with the stored
 			// ones in the playlist, as they may have been invalidated when loading.
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b723117..a91b103 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -37,6 +37,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
 
 	_music = new SciMusic(_soundVersion);
 	_music->init();
+	_bMultiMidi = ConfMan.getBool("multi_midi");
 }
 
 SoundCommandParser::~SoundCommandParser() {
@@ -63,6 +64,35 @@ int SoundCommandParser::getSoundResourceId(reg_t obj) {
 	return resourceId;
 }
 
+void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
+	if (newSound->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, newSound->resourceId)))
+		newSound->soundRes = new SoundResource(newSound->resourceId, _resMan, _soundVersion);
+	else
+		newSound->soundRes = 0;
+
+	// In SCI1.1 games, sound effects are started from here. If we can find
+	// a relevant audio resource, play it, otherwise switch to synthesized
+	// effects. If the resource exists, play it using map 65535 (sound
+	// effects map)
+	bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
+	if (g_sci->getGameId() == GID_HOYLE4)
+		checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
+	// if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
+	// on soundblaster. FIXME: check, why this is
+
+	if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) {
+		// Found a relevant audio resource, create an audio stream
+		if (_bMultiMidi || !newSound->soundRes) {
+			int sampleLen;
+			newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
+			newSound->soundType = Audio::Mixer::kSpeechSoundType;
+		}
+	}
+
+	if (!newSound->pStreamAud && newSound->soundRes)
+		_music->soundInitSnd(newSound);
+}
+
 void SoundCommandParser::processInitSound(reg_t obj) {
 	int resourceId = getSoundResourceId(obj);
 
@@ -73,11 +103,6 @@ void SoundCommandParser::processInitSound(reg_t obj) {
 
 	MusicEntry *newSound = new MusicEntry();
 	newSound->resourceId = resourceId;
-	if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId)))
-		newSound->soundRes = new SoundResource(resourceId, _resMan, _soundVersion);
-	else
-		newSound->soundRes = 0;
-
 	newSound->soundObj = obj;
 	newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
 	newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 0xFF;
@@ -88,25 +113,7 @@ void SoundCommandParser::processInitSound(reg_t obj) {
 	debugC(kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj),
 			resourceId,	newSound->loop, newSound->priority, newSound->volume);
 
-	// In SCI1.1 games, sound effects are started from here. If we can find
-	// a relevant audio resource, play it, otherwise switch to synthesized
-	// effects. If the resource exists, play it using map 65535 (sound
-	// effects map)
-	bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
-	if (g_sci->getGameId() == GID_HOYLE4)
-		checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
-	// if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
-	// on soundblaster. FIXME: check, why this is
-
-	if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceId))) {
-		// Found a relevant audio resource, play it
-		int sampleLen;
-		newSound->pStreamAud = _audio->getAudioStream(resourceId, 65535, &sampleLen);
-		newSound->soundType = Audio::Mixer::kSpeechSoundType;
-	} else {
-		if (newSound->soundRes)
-			_music->soundInitSnd(newSound);
-	}
+	initSoundResource(newSound);
 
 	_music->pushBackSlot(newSound);
 
diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h
index 7f6e2a0..c1dce01 100644
--- a/engines/sci/sound/soundcmd.h
+++ b/engines/sci/sound/soundcmd.h
@@ -32,6 +32,7 @@ namespace Sci {
 class Console;
 class SciMusic;
 class SoundCommandParser;
+class MusicEntry;
 //typedef void (SoundCommandParser::*SoundCommand)(reg_t obj, int16 value);
 
 //struct MusicEntryCommand {
@@ -64,6 +65,7 @@ public:
 
 	void processPlaySound(reg_t obj);
 	void processStopSound(reg_t obj, bool sampleFinishedPlaying);
+	void initSoundResource(MusicEntry *newSound);
 
 	MusicType getMusicType() const;
 
@@ -109,6 +111,7 @@ private:
 	SciMusic *_music;
 	AudioPlayer *_audio;
 	SciVersion _soundVersion;
+	bool _bMultiMidi;
 
 	void processInitSound(reg_t obj);
 	void processDisposeSound(reg_t obj);






More information about the Scummvm-git-logs mailing list