aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-26 00:50:09 +0000
committerFilippos Karapetis2009-12-26 00:50:09 +0000
commit12b6d4ab032cad05e54b9a40bd8c36736597bb71 (patch)
treef8185acac1341d6713b23b3872b555781bf1479a /engines/sci/engine
parenta88e4df7a0d01e572d7c942da67d53799fb4a6b5 (diff)
downloadscummvm-rg350-12b6d4ab032cad05e54b9a40bd8c36736597bb71.tar.gz
scummvm-rg350-12b6d4ab032cad05e54b9a40bd8c36736597bb71.tar.bz2
scummvm-rg350-12b6d4ab032cad05e54b9a40bd8c36736597bb71.zip
Some more work on the new music code
svn-id: r46569
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp14
-rw-r--r--engines/sci/engine/savegame.cpp1
-rw-r--r--engines/sci/engine/vm.h2
3 files changed, 12 insertions, 5 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