SCI: added currently commented-out pauseSound implementation for some sci0 games, allowing integer for that subfunction

svn-id: r50759
This commit is contained in:
Martin Kiewitz 2010-07-09 14:11:27 +00:00
parent b8933d7e8f
commit aadf2e9765
4 changed files with 42 additions and 5 deletions

View File

@ -260,7 +260,7 @@ static const SciKernelMapSubEntry kDoSound_subops[] = {
{ SIG_SOUNDSCI0, 3, MAP_CALL(DoSoundDispose), "o", NULL },
{ SIG_SOUNDSCI0, 4, MAP_CALL(DoSoundMute), "(i)", NULL },
{ SIG_SOUNDSCI0, 5, MAP_CALL(DoSoundStop), "o", NULL },
{ SIG_SOUNDSCI0, 6, MAP_CALL(DoSoundPause), "[o0]", NULL },
{ SIG_SOUNDSCI0, 6, MAP_CALL(DoSoundPause), "[o0i]", NULL },
{ SIG_SOUNDSCI0, 7, MAP_CALL(DoSoundResume), "o", NULL },
{ SIG_SOUNDSCI0, 8, MAP_CALL(DoSoundMasterVolume), "(i)", NULL },
{ SIG_SOUNDSCI0, 9, MAP_CALL(DoSoundUpdate), "o", NULL },

View File

@ -166,8 +166,6 @@ void SciMusic::pauseAll(bool pause) {
}
void SciMusic::stopAll() {
Common::StackLock lock(_mutex);
const MusicList::iterator end = _playList.end();
for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
soundStop(*i);
@ -199,6 +197,24 @@ MusicEntry *SciMusic::getSlot(reg_t obj) {
return NULL;
}
// We return the currently active music slot for SCI0
MusicEntry *SciMusic::getActiveSci0MusicSlot() {
const MusicList::iterator end = _playList.end();
MusicEntry *highestPrioritySlot = NULL;
for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
MusicEntry *playSlot = *i;
if (playSlot->pMidiParser) {
if (playSlot->status == kSoundPlaying)
return playSlot;
if (playSlot->status == kSoundPaused) {
if ((!highestPrioritySlot) || (highestPrioritySlot->priority < playSlot->priority))
highestPrioritySlot = playSlot;
}
}
}
return highestPrioritySlot;
}
void SciMusic::setReverb(byte reverb) {
Common::StackLock lock(_mutex);
_pMidiDrv->setReverb(reverb);

View File

@ -157,6 +157,7 @@ public:
}
MusicEntry *getSlot(reg_t obj);
MusicEntry *getActiveSci0MusicSlot();
void pushBackSlot(MusicEntry *slotEntry) {
Common::StackLock lock(_mutex);

View File

@ -213,8 +213,28 @@ reg_t SoundCommandParser::kDoSoundPause(int argc, reg_t *argv, reg_t acc) {
uint16 value = argc > 1 ? argv[1].toUint16() : 0;
if (!obj.segment) { // pause the whole playlist
// Pausing/Resuming the whole playlist was introduced in the SCI1 late
// sound scheme.
// SCI0 games (up to including qfg1) give us 0/1 for either resuming or pausing the current music
// this one doesn't count, so pausing 2 times and resuming once means here that we are supposed to resume
if (_soundVersion <= SCI_VERSION_0_LATE) {
// TODO: this code doesn't work right currently
return make_reg(0, 0);
MusicEntry *musicSlot = _music->getActiveSci0MusicSlot();
switch (obj.offset) {
case 1:
if ((musicSlot) && (musicSlot->status == kSoundPlaying))
_music->soundPause(musicSlot);
return make_reg(0, 0);
case 0:
if ((musicSlot) && (musicSlot->status == kSoundPaused))
_music->soundResume(musicSlot);
return make_reg(0, 1);
return make_reg(0, 0);
default:
error("kDoSoundPause: parameter 0 is invalid for sound-sci0");
}
}
// Pausing/Resuming the whole playlist was introduced in the SCI1 late sound scheme.
if (_soundVersion <= SCI_VERSION_1_EARLY)
return acc;