diff options
author | Willem Jan Palenstijn | 2014-10-07 19:48:18 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-02-14 16:06:55 +0100 |
commit | 58ef44eb8d9d3eb78eb013441a8d6d12940ee5e3 (patch) | |
tree | 03e2e70bfdf6fda9afadb85eaa01a777c99225f6 /engines/sci | |
parent | 26d55b09a8b198b0a9b9349d684eec6376d98c8c (diff) | |
download | scummvm-rg350-58ef44eb8d9d3eb78eb013441a8d6d12940ee5e3.tar.gz scummvm-rg350-58ef44eb8d9d3eb78eb013441a8d6d12940ee5e3.tar.bz2 scummvm-rg350-58ef44eb8d9d3eb78eb013441a8d6d12940ee5e3.zip |
SCI: Register and save playBed option to PlaySound
The playBed option is not handled yet, only stored. This increases
the savegame format version.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/console.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 3 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sound/music.h | 1 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 16 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.h | 2 |
8 files changed, 27 insertions, 15 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index e233c4cba4..a3abf606d0 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2172,6 +2172,7 @@ bool Console::cmdStartSound(int argc, const char **argv) { return true; } + // TODO: Maybe also add a playBed option. g_sci->_soundCmd->startNewSound(number); return cmdExit(0, 0); } @@ -2198,9 +2199,10 @@ bool Console::cmdToggleSound(int argc, const char **argv) { Common::String newState = argv[2]; newState.toLowercase(); - if (newState == "play") - g_sci->_soundCmd->processPlaySound(id); - else if (newState == "stop") + if (newState == "play") { + // Maybe also have a 'playbed' option. (Second argument to processPlaySound.) + g_sci->_soundCmd->processPlaySound(id, false); + } else if (newState == "stop") g_sci->_soundCmd->processStopSound(id, false); else debugPrintf("New state can either be 'play' or 'stop'"); diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 0c2fd4e3ea..2cbd79366d 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -105,10 +105,6 @@ static const SciKernelMapSubEntry kDoSound_subops[] = { { SIG_SOUNDSCI1EARLY, 5, MAP_CALL(DoSoundInit), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 6, MAP_CALL(DoSoundDispose), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 7, MAP_CALL(DoSoundPlay), "oi", NULL }, - // ^^ TODO: In SCI1-SCI1.1 DoSound (play) is called by 2 methods of the Sound object: play and - // playBed. The methods are the same, apart from the second integer parameter: it's 0 in - // play and 1 in playBed, to distinguish the caller. It's passed on, we should find out what - // it actually does internally { SIG_SOUNDSCI1EARLY, 8, MAP_CALL(DoSoundStop), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 9, MAP_CALL(DoSoundPause), "[o0]i", NULL }, { SIG_SOUNDSCI1EARLY, 10, MAP_CALL(DoSoundFade), "oiiii", kDoSoundFade_workarounds }, diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 0b55425406..692fa77a80 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -617,6 +617,10 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsSint32LE(fadeTicker); s.syncAsSint32LE(fadeTickerStep); s.syncAsByte(status); + if (s.getVersion() >= 32) + s.syncAsByte(playBed); + else if (s.isLoading()) + playBed = false; // pMidiParser and pStreamAud will be initialized when the // sound list is reconstructed in gamestate_restore() @@ -650,7 +654,7 @@ void SoundCommandParser::reconstructPlayList() { if (_soundVersion >= SCI_VERSION_1_EARLY) writeSelectorValue(_segMan, (*i)->soundObj, SELECTOR(vol), (*i)->volume); - processPlaySound((*i)->soundObj); + processPlaySound((*i)->soundObj, (*i)->playBed); } } } diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h index 8f2835654b..be6d05cdc5 100644 --- a/engines/sci/engine/savegame.h +++ b/engines/sci/engine/savegame.h @@ -37,6 +37,7 @@ struct EngineState; * * Version - new/changed feature * ============================= + * 32 - new playBed flag in MusicEntry * 31 - priority for sound effects/music is now a signed int16, instead of a byte * 30 - synonyms * 29 - system strings @@ -56,7 +57,7 @@ struct EngineState; */ enum { - CURRENT_SAVEGAME_VERSION = 31, + CURRENT_SAVEGAME_VERSION = 32, MINIMUM_SAVEGAME_VERSION = 14 }; diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 05605c0c45..4606d66ace 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -334,6 +334,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { pSnd->pLoopStream = 0; pSnd->soundType = Audio::Mixer::kSFXSoundType; pSnd->hCurrentAud = Audio::SoundHandle(); + pSnd->playBed = false; } else { // play MIDI track Common::StackLock lock(_mutex); @@ -380,6 +381,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { int16 prevHold = pSnd->hold; pSnd->loop = 0; pSnd->hold = -1; + pSnd->playBed = false; pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion); pSnd->reverb = pSnd->pMidiParser->getSongReverb(); diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 4e44074630..0fbd5a0c0e 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -85,6 +85,7 @@ public: int16 volume; int16 hold; int8 reverb; + bool playBed; int16 pauseCounter; uint sampleLoopCounter; diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 73e0a23a6a..47ab9bdc71 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -142,11 +142,14 @@ void SoundCommandParser::processInitSound(reg_t obj) { reg_t SoundCommandParser::kDoSoundPlay(int argc, reg_t *argv, reg_t acc) { debugC(kDebugLevelSound, "kDoSound(play): %04x:%04x", PRINT_REG(argv[0])); - processPlaySound(argv[0]); + bool playBed = false; + if (argc >= 2 && !argv[1].isNull()) + playBed = true; + processPlaySound(argv[0], playBed); return acc; } -void SoundCommandParser::processPlaySound(reg_t obj) { +void SoundCommandParser::processPlaySound(reg_t obj, bool playBed) { MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj)); @@ -185,11 +188,12 @@ void SoundCommandParser::processPlaySound(reg_t obj) { // Reset hold when starting a new song. kDoSoundSetHold is always called after // kDoSoundPlay to set it properly, if needed. Fixes bug #3413589. musicSlot->hold = -1; + musicSlot->playBed = playBed; if (_soundVersion >= SCI_VERSION_1_EARLY) musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol)); - debugC(kDebugLevelSound, "kDoSound(play): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj), - resourceId, musicSlot->loop, musicSlot->priority, musicSlot->volume); + debugC(kDebugLevelSound, "kDoSound(play): %04x:%04x number %d, loop %d, prio %d, vol %d, bed %d", PRINT_REG(obj), + resourceId, musicSlot->loop, musicSlot->priority, musicSlot->volume, playBed ? 1 : 0); _music->soundPlay(musicSlot); @@ -777,6 +781,8 @@ void SoundCommandParser::stopAllSounds() { } void SoundCommandParser::startNewSound(int number) { + // NB: This is only used by the debugging console. + Common::StackLock lock(_music->_mutex); // Overwrite the first sound in the playlist @@ -785,7 +791,7 @@ void SoundCommandParser::startNewSound(int number) { processDisposeSound(soundObj); writeSelectorValue(_segMan, soundObj, SELECTOR(number), number); processInitSound(soundObj); - processPlaySound(soundObj); + processPlaySound(soundObj, false); } void SoundCommandParser::setMasterVolume(int vol) { diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index 4effda68e4..5bb7cf2cb1 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -63,7 +63,7 @@ public: void printPlayList(Console *con); void printSongInfo(reg_t obj, Console *con); - void processPlaySound(reg_t obj); + void processPlaySound(reg_t obj, bool playBed); void processStopSound(reg_t obj, bool sampleFinishedPlaying); void initSoundResource(MusicEntry *newSound); |