diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/game.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 2 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 6 |
5 files changed, 18 insertions, 7 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 10d914ac59..bc7307e940 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -33,12 +33,13 @@ #include "sci/engine/state.h" #include "sci/engine/kernel.h" #include "sci/engine/kernel_types.h" -#include "sci/gui/gui.h" #include "sci/engine/message.h" +#include "sci/gui/gui.h" #ifdef INCLUDE_OLDGFX #include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxVisual #include "sci/gfx/menubar.h" #endif +#include "sci/sfx/music.h" namespace Sci { @@ -291,17 +292,17 @@ static void _free_graphics_input(EngineState *s) { } #endif -int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion) { #ifdef USE_OLD_MUSIC_FUNCTIONS +int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion) { if (getSciVersion() > SCI_VERSION_0_LATE) sound_flags |= SFX_STATE_FLAG_MULTIPLAY; s->sfx_init_flags = sound_flags; s->_sound.sfx_init(s->resMan, sound_flags, soundVersion); -#endif return 0; } +#endif // Architectural stuff: Init/Unintialize engine int script_init_engine(EngineState *s) { @@ -433,13 +434,16 @@ int game_init(EngineState *s) { int game_exit(EngineState *s) { s->_executionStack.clear(); -#ifdef USE_OLD_MUSIC_FUNCTIONS if (!s->successor) { +#ifdef USE_OLD_MUSIC_FUNCTIONS s->_sound.sfx_exit(); // Reinit because some other code depends on having a valid state game_init_sound(s, SFX_STATE_FLAG_NOSOUND, s->detectDoSoundType()); - } +#else + s->_audio->stopAllAudio(); + s->_soundCmd->_music->stopAll(); #endif + } // Note: It's a bad idea to delete the segment manager here // when loading a game. diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index a0b6421731..9f43957eaf 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -148,6 +148,7 @@ static void syncSong(Common::Serializer &s, MusicEntry *song) { // pMidiParser and pStreamAud will be initialized when the // sound list is reconstructed in gamestate_restore() if (s.isLoading()) { + song->soundRes = 0; song->pMidiParser = 0; song->pStreamAud = 0; } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 696aeb1a57..25acfc5ae6 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -486,6 +486,7 @@ int game_init(EngineState *s); int game_init_graphics(EngineState *s); #endif +#ifdef USE_OLD_MUSIC_FUNCTIONS /** * Initializes the sound part of an SCI game * This function may only be called if game_init() did not initialize @@ -496,6 +497,7 @@ int game_init_graphics(EngineState *s); * @return 0 on success, 1 if an error occured */ int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion); +#endif /** * Runs an SCI game diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 78ff311d7c..2f31f97501 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -200,10 +200,12 @@ Common::Error SciEngine::run() { } #endif +#ifdef USE_OLD_MUSIC_FUNCTIONS if (game_init_sound(_gamestate, 0, soundVersion)) { warning("Game initialization failed: Error in sound subsystem. Aborting..."); return Common::kUnknownError; } +#endif _gamestate->_gui->init(_gamestate->usesOldGfxFunctions()); diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 06860ebc5e..b9159b1f83 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -130,11 +130,12 @@ bool SciMusic::restoreState(Common::InSaveFile *pFile){ void SciMusic::stopAll() { _mutex.lock(); _pMixer->stopAll(); - //audioStop(); - for(uint i = 0; i < _playList.size(); i++){ + + for (uint i = 0; i < _playList.size(); i++){ soundStop(_playList[i]); soundKill(_playList[i]); } + _mutex.unlock(); } //---------------------------------------- @@ -469,6 +470,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { for (i = 0; i < sz; i++) { if (_playList[i] == pSnd) { delete _playList[i]->soundRes; + _playList[i]->soundRes = 0; _playList.remove_at(i); break; } |