aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-19 16:19:53 +0000
committerFilippos Karapetis2009-12-19 16:19:53 +0000
commit0c1b646c7feb649ad8c0f77a5129d5ad1b3d84b1 (patch)
treecd6259241b5be6ee9e3bcc785a673e8a5c2a35bb /engines/sci/engine
parentb32748d81050f66b343b4e028207c2472de49d01 (diff)
downloadscummvm-rg350-0c1b646c7feb649ad8c0f77a5129d5ad1b3d84b1.tar.gz
scummvm-rg350-0c1b646c7feb649ad8c0f77a5129d5ad1b3d84b1.tar.bz2
scummvm-rg350-0c1b646c7feb649ad8c0f77a5129d5ad1b3d84b1.zip
- Started wrapping the current sound code around appropriate defines
- Introduced a new resource type, SoundResource, used in the new music code svn-id: r46421
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp6
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/ksound.cpp1
-rw-r--r--engines/sci/engine/state.h4
-rw-r--r--engines/sci/engine/vm.cpp2
5 files changed, 14 insertions, 1 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 848e6c5bf7..0d474a9339 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -292,11 +292,13 @@ static void _free_graphics_input(EngineState *s) {
#endif
int game_init_sound(EngineState *s, int sound_flags) {
+#ifdef USE_OLD_MUSIC_FUNCTIONS
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);
+#endif
return 0;
}
@@ -417,8 +419,10 @@ int game_init(EngineState *s) {
s->_menubar = new Menubar(); // Create menu bar
#endif
+#ifdef USE_OLD_MUSIC_FUNCTIONS
if (s->sfx_init_flags & SFX_STATE_FLAG_NOSOUND)
game_init_sound(s, 0);
+#endif
// Load game language into printLang property of game object
s->getLanguage();
@@ -429,11 +433,13 @@ int game_init(EngineState *s) {
int game_exit(EngineState *s) {
s->_executionStack.clear();
+#ifdef USE_OLD_MUSIC_FUNCTIONS
if (!s->successor) {
s->_sound.sfx_exit();
// Reinit because some other code depends on having a valid state
game_init_sound(s, SFX_STATE_FLAG_NOSOUND);
}
+#endif
// Note: It's a bad idea to delete the segment manager here
// when loading a game.
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 61b8d6b886..4f7db7cf34 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -956,7 +956,9 @@ reg_t kAnimate(EngineState *s, int argc, reg_t *argv) {
bool cycle = (argc > 1) ? ((argv[1].toUint16()) ? true : false) : false;
// Take care of incoming events (kAnimate is called semi-regularly)
+#ifdef USE_OLD_MUSIC_FUNCTIONS
process_sound_events(s);
+#endif
s->_gui->animate(castListReference, cycle, argc, argv);
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index b471460896..cde332b048 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -25,7 +25,6 @@
#include "sci/sci.h"
#include "sci/engine/state.h"
-#include "sci/sfx/iterator.h"
#include "sci/sfx/soundcmd.h"
#include "sci/engine/kernel.h"
#include "sci/engine/vm.h" // for Object
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 600717e558..ce304e98d8 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -43,7 +43,9 @@ namespace Common {
#include "sci/engine/seg_manager.h"
#include "sci/gfx/gfx_system.h"
#include "sci/sfx/audio.h"
+#ifdef USE_OLD_MUSIC_FUNCTIONS
#include "sci/sfx/core.h"
+#endif
#include "sci/sfx/soundcmd.h"
namespace Sci {
@@ -149,7 +151,9 @@ public:
GfxState *gfx_state; /**< Graphics state and driver */
AudioPlayer *_audio;
+#ifdef USE_OLD_MUSIC_FUNCTIONS
SfxState _sound; /**< sound subsystem */
+#endif
SoundCommandParser *_soundCmd;
int sfx_init_flags; /**< flags the sfx subsystem was initialised with */
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 98569d774e..4011cbcb54 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1797,7 +1797,9 @@ static EngineState *_game_run(EngineState *&s, int restoring) {
game_exit(s);
script_init_engine(s);
game_init(s);
+#ifdef USE_OLD_MUSIC_FUNCTIONS
s->_sound.sfx_reset_player();
+#endif
_init_stack_base_with_selector(s, s->_kernel->_selectorCache.play);
send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base);