From 23a0f5318c50cdf3dce19e4de0c98fb5ae1c2618 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 7 Aug 2011 11:39:54 +0200 Subject: JANITORIAL: Remove trailing empty lines. --- engines/sci/sound/drivers/cms.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp index ace96ba499..dbcbf3d431 100644 --- a/engines/sci/sound/drivers/cms.cpp +++ b/engines/sci/sound/drivers/cms.cpp @@ -813,4 +813,3 @@ MidiPlayer *MidiPlayer_CMS_create(SciVersion version) { } } // End of namespace SCI - -- cgit v1.2.3 From 996deff15b347f05f95b2a6b9d0e382d25d0db3e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 25 Aug 2011 02:52:58 +0300 Subject: SCI: Fixed bug #3392767 - "SCI: SQ4 (English/CD/Win): Engine Abort In Timepod Hangar" This bug only manifested in the Windows version of SQ4CD. Some Windows MIDI music tracks are missing from room 530, which messed up the animations in that scene, and led to a crash. Moved the code that obtains the song number from an object into a separate function. Also, fixed a bug in kDoSoundSetPriority(). --- engines/sci/sound/soundcmd.cpp | 31 ++++++++++++++++++------------- engines/sci/sound/soundcmd.h | 1 + 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 4ea290ff9e..d4cff7614c 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -49,11 +49,22 @@ reg_t SoundCommandParser::kDoSoundInit(int argc, reg_t *argv, reg_t acc) { return acc; } -void SoundCommandParser::processInitSound(reg_t obj) { - int resourceId = readSelectorValue(_segMan, obj, SELECTOR(number)); +int SoundCommandParser::getSoundResourceId(reg_t obj) { + int resourceId = obj.segment ? readSelectorValue(_segMan, obj, SELECTOR(number)) : -1; // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did. - if (g_sci && g_sci->_features->useAltWinGMSound()) - resourceId += 1000; + if (g_sci && g_sci->_features->useAltWinGMSound()) { + // Check if the alternate MIDI song actually exists... + // There are cases where it just doesn't exist (e.g. SQ4, room 530 - + // bug #3392767). In these cases, use the DOS tracks instead. + if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId + 1000))) + resourceId += 1000; + } + + return resourceId; +} + +void SoundCommandParser::processInitSound(reg_t obj) { + int resourceId = getSoundResourceId(obj); // Check if a track with the same sound object is already playing MusicEntry *oldSound = _music->getSlot(obj); @@ -123,10 +134,7 @@ void SoundCommandParser::processPlaySound(reg_t obj) { return; } - int resourceId = obj.segment ? readSelectorValue(_segMan, obj, SELECTOR(number)) : -1; - // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did. - if (g_sci && g_sci->_features->useAltWinGMSound()) - resourceId += 1000; + int resourceId = getSoundResourceId(obj); if (musicSlot->resourceId != resourceId) { // another sound loaded into struct processDisposeSound(obj); @@ -618,13 +626,10 @@ reg_t SoundCommandParser::kDoSoundSetPriority(int argc, reg_t *argv, reg_t acc) } if (value == -1) { - uint16 resourceNr = musicSlot->resourceId; - // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did. - if (g_sci && g_sci->_features->useAltWinGMSound()) - resourceNr += 1000; + uint16 resourceId = musicSlot->resourceId; // Set priority from the song data - Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, resourceNr), 0); + Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, resourceId), 0); if (song->data[0] == 0xf0) _music->soundSetPriority(musicSlot, song->data[1]); else diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index a542a8b384..7f6e2a0fe8 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -113,6 +113,7 @@ private: void processInitSound(reg_t obj); void processDisposeSound(reg_t obj); void processUpdateCues(reg_t obj); + int getSoundResourceId(reg_t obj); }; } // End of namespace Sci -- cgit v1.2.3 From 4f3b85f4efc05affb7b4a7080e349360a3352048 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 26 Aug 2011 11:29:13 +0300 Subject: SCI: Fixed bug #3311911 - "SCI: QFG3: Intro music abruptly stops" --- engines/sci/sound/midiparser_sci.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 95b165468d..f48a68dc66 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -626,7 +626,11 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { if (info.ext.type == 0x2F) {// end of track reached if (_pSnd->loop) _pSnd->loop--; - if (_pSnd->loop) { + // QFG3 abuses the hold flag. Its scripts call kDoSoundSetHold, + // but sometimes there's no hold marker in the associated songs + // (e.g. song 110, during the intro). The original interpreter + // treats this case as an infinite loop (bug #3311911). + if (_pSnd->loop || _pSnd->hold > 0) { // We need to play it again... jumpToTick(_loopTick); } else { -- cgit v1.2.3 From 2798c65d756e82db8eb4a58ca3db526215557333 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 28 Aug 2011 14:06:57 +0300 Subject: SCI: Fixed bug #3297883 - "SCI: LB1 (Amiga) - Intro stuck" --- engines/sci/sound/midiparser_sci.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index f48a68dc66..ad7ba7ca36 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -480,11 +480,18 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.basic.param2 = 0; if (info.channel() == 0xF) {// SCI special case if (info.basic.param1 != kSetSignalLoop) { - // at least in kq5/french&mac the first scene in the intro has a song that sets signal to 4 immediately - // on tick 0. Signal isn't set at that point by sierra sci and it would cause the castle daventry text to - // get immediately removed, so we currently filter it. - // Sierra SCI ignores them as well at that time - if ((_position._play_tick) || (info.delta)) { + // At least in kq5/french&mac the first scene in the intro has + // a song that sets signal to 4 immediately on tick 0. Signal + // isn't set at that point by sierra sci and it would cause the + // castle daventry text to get immediately removed, so we + // currently filter it. Sierra SCI ignores them as well at that + // time. However, this filtering should only be performed for + // SCI1 and newer games. Signalling is done differently in SCI0 + // though, so ignoring these signals in SCI0 games will result + // in glitches (e.g. the intro of LB1 Amiga gets stuck - bug + // #3297883). Refer to MusicEntry::setSignal() in sound/music.cpp. + if (_soundVersion <= SCI_VERSION_0_LATE || + _position._play_tick || info.delta) { _signalSet = true; _signalToSet = info.basic.param1; } -- cgit v1.2.3 From 5443ef943fc4758ee9b1bf8842b0cde02d4f0a59 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Sep 2011 00:35:12 +0200 Subject: SCI: Made some static data const. --- engines/sci/sound/drivers/gm_names.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/drivers/gm_names.h b/engines/sci/sound/drivers/gm_names.h index bfe5ff88c7..fbfa413a4a 100644 --- a/engines/sci/sound/drivers/gm_names.h +++ b/engines/sci/sound/drivers/gm_names.h @@ -30,7 +30,7 @@ namespace Sci { // is defined #ifndef REDUCE_MEMORY_USAGE -static const char *GmInstrumentNames[] = { +static const char *const GmInstrumentNames[] = { /*000*/ "Acoustic Grand Piano", /*001*/ "Bright Acoustic Piano", /*002*/ "Electric Grand Piano", @@ -162,7 +162,7 @@ static const char *GmInstrumentNames[] = { }; // The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI -static const char *GmPercussionNames[] = { +static const char *const GmPercussionNames[] = { /*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- cgit v1.2.3 From 077acc5575a1918850e38df06d72579583f55053 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 23 Sep 2011 17:41:30 +0300 Subject: SCI: Fixed bug #3413301 - "SCI: KQ6CD: Game stops responding at the bookworm" --- engines/sci/sound/soundcmd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index d4cff7614c..e73df69375 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -130,8 +130,14 @@ reg_t SoundCommandParser::kDoSoundPlay(int argc, reg_t *argv, reg_t acc) { void SoundCommandParser::processPlaySound(reg_t obj) { MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { - warning("kDoSound(play): Slot not found (%04x:%04x)", PRINT_REG(obj)); - return; + warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj)); + // The sound hasn't been initialized for some reason, so initialize it here. + // Happens in KQ6, room 460, when giving the creature to the bookwork (the + // bookworm's child). Fixes bug #3413301. + processInitSound(obj); + musicSlot = _music->getSlot(obj); + if (!musicSlot) + error("Failed to initialize uninitialized sound slot"); } int resourceId = getSoundResourceId(obj); -- cgit v1.2.3 From e552bc57baf616daae8fb8831b6bf10c933db106 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 24 Sep 2011 18:44:57 +0300 Subject: SCI: Always reset hold when starting a new song. Fixes bug #3413589 - "SCI: KQ6CD: Game stops responding in the catacombs" kDoSoundSetHold is always called after kDoSoundPlay. A regression from commit 4f3b85f4efc05affb7b4a7080e349360a3352048 --- engines/sci/sound/soundcmd.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index e73df69375..b723117811 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -163,6 +163,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) { musicSlot->loop = readSelectorValue(_segMan, obj, SELECTOR(loop)); musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority)); + // Reset hold when starting a new song. kDoSoundSetHold is always called after + // kDoSoundPlay to set it properly, if needed. Fixes bug #3413589. + musicSlot->hold = -1; if (_soundVersion >= SCI_VERSION_1_EARLY) musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol)); -- cgit v1.2.3 From 9fd66deb43a8ba1bd7b423cb6fe2b7177af74166 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Sep 2011 19:57:50 +0300 Subject: 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 --- engines/sci/sound/soundcmd.cpp | 55 ++++++++++++++++++++++++------------------ engines/sci/sound/soundcmd.h | 3 +++ 2 files changed, 34 insertions(+), 24 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index b723117811..a91b103214 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 7f6e2a0fe8..c1dce014d2 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); -- cgit v1.2.3 From 1117c8c3ed82315da58b695e1975db84500659b0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 6 Oct 2011 23:30:07 +0300 Subject: SCI: Also default to MIDI for Windows versions of SCI1.1 games --- engines/sci/sound/music.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 2afab3858d..9610b6f847 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -63,12 +63,13 @@ void SciMusic::init() { // SCI sound init _dwTempo = 0; - // Default to MIDI in SCI2.1+ games, as many don't have AdLib support. Common::Platform platform = g_sci->getPlatform(); - uint32 deviceFlags = MDT_PCSPK | MDT_PCJR | MDT_ADLIB | MDT_MIDI; - if (getSciVersion() >= SCI_VERSION_2_1) + // Default to MIDI in SCI2.1+ games, as many don't have AdLib support. + // Also, default to MIDI for Windows versions of SCI1.1 games, as their + // soundtrack is written for GM. + if (getSciVersion() >= SCI_VERSION_2_1 || g_sci->_features->useAltWinGMSound()) deviceFlags |= MDT_PREFER_GM; // Currently our CMS implementation only supports SCI1(.1) -- cgit v1.2.3 From b17d424257bccfa355a3a43d4308f266c12f8698 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 10 Oct 2011 01:40:36 +0300 Subject: SCI: Fixed menu music in GK1 when multi MIDI is disabled A regression from commit 9fd66de --- engines/sci/sound/soundcmd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index a91b103214..b4776b30f2 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -81,8 +81,14 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) { // 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) { + // Found a relevant audio resource, create an audio stream if there is + // no associated sound resource, or if both resources exist and the + // user wants the digital version. In SCI2 and later games, this check + // doesn't apply - there was always only one version of each sound + // effect or digital music track (e.g. the menu music in GK1 - there is + // a sound effect with the same resource number, but it's totally + // unrelated to the menu music). + if (_bMultiMidi || !newSound->soundRes || getSciVersion() >= SCI_VERSION_2) { int sampleLen; newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen); newSound->soundType = Audio::Mixer::kSpeechSoundType; -- cgit v1.2.3 From 4e1face8901ab1f997242a9c927836005be37ba5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 10 Oct 2011 12:20:52 +0300 Subject: SCI: Mixed Adlib/MIDI mode for audio resources should always be enabled in SCI32 --- engines/sci/sound/soundcmd.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index b4776b30f2..e7d294dc11 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -37,7 +37,15 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM _music = new SciMusic(_soundVersion); _music->init(); + // Check if the user wants synthesized or digital sound effects in SCI1.1 + // or later games _bMultiMidi = ConfMan.getBool("multi_midi"); + // In SCI2 and later games, this check should always be true - there was + // always only one version of each sound effect or digital music track + // (e.g. the menu music in GK1 - there is a sound effect with the same + // resource number, but it's totally unrelated to the menu music). + if (getSciVersion() >= SCI_VERSION_2) + _bMultiMidi = true; } SoundCommandParser::~SoundCommandParser() { @@ -83,12 +91,8 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) { if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) { // Found a relevant audio resource, create an audio stream if there is // no associated sound resource, or if both resources exist and the - // user wants the digital version. In SCI2 and later games, this check - // doesn't apply - there was always only one version of each sound - // effect or digital music track (e.g. the menu music in GK1 - there is - // a sound effect with the same resource number, but it's totally - // unrelated to the menu music). - if (_bMultiMidi || !newSound->soundRes || getSciVersion() >= SCI_VERSION_2) { + // user wants the digital version. + if (_bMultiMidi || !newSound->soundRes) { int sampleLen; newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen); newSound->soundType = Audio::Mixer::kSpeechSoundType; -- cgit v1.2.3 From 01666659264ece2cd33b0ecc53dd5fc8c3d7de5c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Oct 2011 12:48:18 +0300 Subject: SCI: Fixed a long-standing bug in kDoSound(init) The sound handle should not be set in kDoSound(init), but in kDoSound(play). This is verified against several SCI versions, plus game scripts check if a sound slot is playing primarily by checking its handle. Fixes the sound in Shivers and probably an assortment of other sound related bugs --- engines/sci/sound/soundcmd.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index e7d294dc11..63919859ca 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -133,8 +133,6 @@ void SoundCommandParser::processInitSound(reg_t obj) { writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundInitialized); else writeSelector(_segMan, obj, SELECTOR(nodePtr), obj); - - writeSelector(_segMan, obj, SELECTOR(handle), obj); } } -- cgit v1.2.3 From e7260d992c9f57c0a620fbfbfefb22d282163e6a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 13 Oct 2011 13:58:42 +0300 Subject: SCI: Updated a comment inside processPlaySound() --- engines/sci/sound/soundcmd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 63919859ca..699a89d122 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -146,9 +146,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) { MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj)); - // The sound hasn't been initialized for some reason, so initialize it here. - // Happens in KQ6, room 460, when giving the creature to the bookwork (the - // bookworm's child). Fixes bug #3413301. + // The sound hasn't been initialized for some reason, so initialize it + // here. Happens in KQ6, room 460, when giving the creature (child) to + // the bookworm. Fixes bugs #3413301 and #3421098. processInitSound(obj); musicSlot = _music->getSlot(obj); if (!musicSlot) -- cgit v1.2.3 From 1736345906af095c863a62ded2638ce92c2a0704 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 20 Oct 2011 19:02:15 +0300 Subject: SCI: The demo of GK1 has no alternate sound effects. This fixes the sound effect heard in the "Day 1" screen --- engines/sci/sound/soundcmd.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 699a89d122..274c532779 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -83,10 +83,11 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) { // 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 + // Hoyle 4 has garbled audio resources in place of the sound resources. + // The demo of GK1 has no alternate sound effects. + if ((g_sci->getGameId() == GID_HOYLE4) || + (g_sci->getGameId() == GID_GK1 && g_sci->isDemo())) + checkAudioResource = false; if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) { // Found a relevant audio resource, create an audio stream if there is -- cgit v1.2.3