aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kernel.cpp2
-rw-r--r--engines/sci/sound/music.cpp20
-rw-r--r--engines/sci/sound/music.h1
-rw-r--r--engines/sci/sound/soundcmd.cpp24
4 files changed, 42 insertions, 5 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 4af3b4d547..99c2ba1d5d 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -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 },
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 874f0a381e..cf084f81eb 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -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);
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 486848b48f..943a5bd2a8 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -157,6 +157,7 @@ public:
}
MusicEntry *getSlot(reg_t obj);
+ MusicEntry *getActiveSci0MusicSlot();
void pushBackSlot(MusicEntry *slotEntry) {
Common::StackLock lock(_mutex);
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b1ad11651f..b23aed4745 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -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;