From d0cb5f51fddcd74461914fb28ef4fbd685833eae Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 15 Feb 2015 10:28:06 +0100 Subject: SCI: Only allow a single 'playBed' song in SCI1early --- engines/sci/sound/music.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 37bf6a7b1b..7156e3c099 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -410,8 +410,22 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { void SciMusic::soundPlay(MusicEntry *pSnd) { _mutex.lock(); - // TODO: if pSnd->playBed, and version <= SCI1_EARLY, then kill - // existing sounds with playBed enabled. + if (_soundVersion <= SCI_VERSION_1_EARLY && pSnd->playBed) { + // If pSnd->playBed, and version <= SCI1_EARLY, then kill + // existing sounds with playBed enabled. + + uint playListCount = _playList.size(); + for (uint i = 0; i < playListCount; i++) { + if (_playList[i] != pSnd && _playList[i]->playBed) { + debugC(2, kDebugLevelSound, "Automatically stopping old playBed song from soundPlay"); + MusicEntry *old = _playList[i]; + _mutex.unlock(); + soundStop(old); + _mutex.lock(); + break; + } + } + } uint playListCount = _playList.size(); uint playListNo = playListCount; -- cgit v1.2.3