From efac5c42d7d6ec91440e7c03e8205ce474e5437d Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 14 May 2011 19:53:41 +0200 Subject: MOHAWK: Fix background music restarting when changing cards in original Myst --- engines/mohawk/sound.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 2428f1bdb0..6144c89e21 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -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 -- cgit v1.2.3