diff options
Diffstat (limited to 'engines/sci/sound/soundcmd.cpp')
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 790164cf41..863fe6c33a 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -28,7 +28,9 @@ #include "sci/sound/music.h" #include "sci/sound/soundcmd.h" +#include "sci/engine/features.h" #include "sci/engine/kernel.h" +#include "sci/engine/object.h" #include "sci/engine/selector.h" namespace Sci { @@ -52,6 +54,9 @@ reg_t SoundCommandParser::kDoSoundInit(int argc, reg_t *argv, reg_t acc) { void SoundCommandParser::processInitSound(reg_t obj) { int resourceId = readSelectorValue(_segMan, obj, SELECTOR(number)); + // 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; // Check if a track with the same sound object is already playing MusicEntry *oldSound = _music->getSlot(obj); @@ -70,6 +75,7 @@ void SoundCommandParser::processInitSound(reg_t obj) { newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 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 debugC(2, kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj), resourceId, newSound->loop, newSound->priority, newSound->volume); @@ -121,6 +127,9 @@ void SoundCommandParser::processPlaySound(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 (musicSlot->resourceId != resourceId) { // another sound loaded into struct processDisposeSound(obj); @@ -490,10 +499,17 @@ reg_t SoundCommandParser::kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc) { return acc; } -reg_t SoundCommandParser::kDoSoundReverb(int argc, reg_t *argv, reg_t acc) { - debugC(2, kDebugLevelSound, "doSoundReverb: %d", argv[0].toUint16() & 0xF); - _music->setReverb(argv[0].toUint16() & 0xF); - return acc; +reg_t SoundCommandParser::kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc) { + byte prevReverb = _music->getCurrentReverb(); + byte reverb = argv[0].toUint16() & 0xF; + + if (argc == 1) { + debugC(2, kDebugLevelSound, "doSoundGlobalReverb: %d", argv[0].toUint16() & 0xF); + if (reverb <= 10) + _music->setGlobalReverb(reverb); + } + + return make_reg(0, prevReverb); } reg_t SoundCommandParser::kDoSoundSetHold(int argc, reg_t *argv, reg_t acc) { @@ -579,8 +595,13 @@ 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; + // Set priority from the song data - Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, musicSlot->resourceId), 0); + Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, resourceNr), 0); if (song->data[0] == 0xf0) _music->soundSetPriority(musicSlot, song->data[1]); else |