diff options
| author | Martin Kiewitz | 2009-12-28 22:35:53 +0000 | 
|---|---|---|
| committer | Martin Kiewitz | 2009-12-28 22:35:53 +0000 | 
| commit | f8abf06276ee0e6b0daf544f519ebe5c82fa577b (patch) | |
| tree | 4c7b6611f6dae11f969cd9e83ca592e5e589ecaf | |
| parent | 34e21c3767118851c1fe5729a95b56e0ca575110 (diff) | |
| download | scummvm-rg350-f8abf06276ee0e6b0daf544f519ebe5c82fa577b.tar.gz scummvm-rg350-f8abf06276ee0e6b0daf544f519ebe5c82fa577b.tar.bz2 scummvm-rg350-f8abf06276ee0e6b0daf544f519ebe5c82fa577b.zip | |
SCI/newmusic: Accept object 0:0 in cmdPauseHandle, pause the whole playlist then (fixes castle of dr. brain during intro)
svn-id: r46690
| -rw-r--r-- | engines/sci/sfx/music.cpp | 11 | ||||
| -rw-r--r-- | engines/sci/sfx/music.h | 1 | ||||
| -rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 47 | 
3 files changed, 39 insertions, 20 deletions
| diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 735a25a5a5..5e45f08386 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -501,6 +501,17 @@ void SciMusic::reconstructPlayList(int savegame_version) {  	}  } +MusicList::iterator SciMusic::enumPlayList(MusicList::iterator slotLoop) { +	if (!slotLoop) { +		if (_playList.begin() == _playList.end()) +			return NULL; +		return _playList.begin(); +	} +	slotLoop++; +	if (slotLoop == _playList.end()) +		return NULL; +	return slotLoop; +}  MusicEntry::MusicEntry() {  	soundObj = NULL_REG; diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index c7315a2d06..c2909e1908 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -157,6 +157,7 @@ public:  	void printPlayList(Console *con);  	void reconstructPlayList(int savegame_version); +	MusicList::iterator enumPlayList(MusicList::iterator slotLoop);  	void enterCriticalSection() { _inCriticalSection = true; }  	void leaveCriticalSection() { _inCriticalSection = false; } diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index b85067b17f..98f07dae3e 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -499,38 +499,45 @@ void SoundCommandParser::cmdStopHandle(reg_t obj, int16 value) {  }  void SoundCommandParser::cmdPauseHandle(reg_t obj, int16 value) { +#ifdef USE_OLD_MUSIC_FUNCTIONS  	if (!obj.segment)  		return; -#ifdef USE_OLD_MUSIC_FUNCTIONS  	if (_soundVersion <= SCI_VERSION_0_LATE)  		changeHandleStatus(obj, SOUND_STATUS_SUSPENDED);  	else  		changeHandleStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING);  #else -	MusicEntry *musicSlot = _music->getSlot(obj); - -	if (musicSlot->status == kSoundStopped) { -		// WORKAROUND for the Sierra logo screen in Castle of Dr. Brain, where the -		// game tries to pause/unpause the wrong sound in the playlist -		if (!strcmp(_segMan->getObjectName(obj), "cMusic2")) -			musicSlot = _music->getSlot(_segMan->findObjectByName("cMusic")); -	} +	MusicEntry *musicSlot = NULL; +	MusicList::iterator slotLoop = NULL; -	if (!musicSlot) { -		warning("cmdPauseHandle: Slot not found"); -		return; +	if (!obj.segment) { +		slotLoop = _music->enumPlayList(NULL); +		musicSlot = *slotLoop; +	} else { +		musicSlot = _music->getSlot(obj); +		if (!musicSlot) { +			warning("cmdPauseHandle: Slot not found"); +			return; +		}  	} -	if (_soundVersion <= SCI_VERSION_0_LATE) { -		PUT_SEL32V(_segMan, obj, state, kSoundPaused); -		_music->soundPause(musicSlot); -	} else { -		if (value) +	do { +		if (_soundVersion <= SCI_VERSION_0_LATE) { +			PUT_SEL32V(_segMan, obj, state, kSoundPaused);  			_music->soundPause(musicSlot); -		else -			_music->soundPlay(musicSlot); -	} +		} else { +			if (value) +				_music->soundPause(musicSlot); +			else +				_music->soundPlay(musicSlot); +		} +		if (slotLoop) { +			slotLoop = _music->enumPlayList(slotLoop); +			if (slotLoop) +				musicSlot = *slotLoop; +		} +	} while (slotLoop);  #endif  } | 
