MOHAWK: Fix background music restarting when changing cards in original Myst

This commit is contained in:
Bastien Bouclet 2011-05-14 19:53:41 +02:00
parent c7f3a4f578
commit efac5c42d7

View File

@ -616,9 +616,16 @@ Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
Common::String name = _vm->getResourceName(ID_MSND, convertMystID(id));
// Only the first eight characters need to be the same to have a match
Common::String prefix;
if (name.size() >= 8)
prefix = Common::String(name.c_str(), name.c_str() + 8);
else
prefix = name;
// Check if sound is already playing
if (_mystBackgroundSound.type == kUsedHandle && _vm->_mixer->isSoundHandleActive(_mystBackgroundSound.handle)
&& name.equals(_vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id))))
&& _vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)).hasPrefix(prefix))
return &_mystBackgroundSound.handle;
// Stop old background sound