Skip to content

Commit

Permalink
SHERLOCK: Handle multiple sound containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and wjp committed May 13, 2015
1 parent c124462 commit 187b583
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion engines/sherlock/sound.cpp
Expand Up @@ -45,6 +45,8 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer): _vm(vm), _mixer(mixer) {
_speechOn = true;

_vm->_res->addToCache("MUSIC.LIB");
_vm->_res->addToCache("TITLE.SND");
_vm->_res->addToCache("EPILOGUE.SND");
_vm->_res->addToCache("SND.SND");
}

Expand Down Expand Up @@ -92,7 +94,18 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
Common::String filename = name;
if (!filename.contains('.'))
filename += ".SND";
Common::SeekableReadStream *stream = _vm->_res->load(filename, "TITLE.SND");

Common::SeekableReadStream *stream = nullptr;

if (_vm->_res->exists(filename))
stream = _vm->_res->load(filename, "TITLE.SND");
else if (_vm->_res->exists(filename))
stream = _vm->_res->load(filename, "EPILOGUE.SND");
else if (_vm->_res->exists(filename))
stream = _vm->_res->load(filename, "SND.SND");

if (!stream)
error("Unable to find sound file %s", filename.c_str());

stream->skip(2);
int size = stream->readUint32BE();
Expand Down

0 comments on commit 187b583

Please sign in to comment.