Skip to content

Commit

Permalink
SCUMM: Prevent expiration of music while it's playing
Browse files Browse the repository at this point in the history
This brings isSoundInUse() and isSoundRunning() closer to each other,
while still maintaining the documented differences. It seems to fix a
problem I had where the "follow the shopkeeper" music in the Mac version
of Monkey Island 1 expired when reaching the island overhead map,
causing the music to be be replaced with the regular overhead map theme.
  • Loading branch information
Torbjörn Andersson committed Nov 1, 2024
1 parent 3b956ed commit 1688f50
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions engines/scumm/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,17 +1013,19 @@ bool Sound::isSoundInUse(int sound) const {
if (sound == _currentCDSound)
return pollCD() != 0;

if (_mixer->isSoundIDActive(sound))
return true;

if (isSoundInQueue(sound))
return true;

if (!_vm->_res->isResourceLoaded(rtSound, sound))
if (sound > _vm->_numSounds || !_vm->_res->isResourceLoaded(rtSound, sound))
return false;

if (_vm->_imuse)
return _vm->_imuse->get_sound_active(sound);

if (_mixer->isSoundIDActive(sound))
return 1;
else if (_vm->_musicEngine)
return _vm->_musicEngine->getSoundStatus(sound);

return false;
}
Expand Down

0 comments on commit 1688f50

Please sign in to comment.