diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/globals.cpp | 15 | ||||
-rw-r--r-- | engines/tsage/globals.h | 5 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 2 |
3 files changed, 17 insertions, 5 deletions
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index e54f1073b0..34b26ec311 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -94,8 +94,8 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _sceneObjects_queue.push_front(_sceneObjects); _prevSceneOffset = Common::Point(-1, -1); - _sceneListeners.push_back(&_soundHandler); - _sceneListeners.push_back(&_sequenceManager._soundHandler); + _sounds.push_back(&_soundHandler); + _sounds.push_back(&_sequenceManager._soundHandler); _scrollFollower = NULL; _inventory = NULL; @@ -148,7 +148,7 @@ void Globals::synchronize(Serializer &s) { } s.syncAsSint16LE(_dialogCenter.x); s.syncAsSint16LE(_dialogCenter.y); - _sceneListeners.synchronize(s); + _sounds.synchronize(s); for (int i = 0; i < 256; ++i) s.syncAsByte(_flags[i]); @@ -158,4 +158,13 @@ void Globals::synchronize(Serializer &s) { s.syncAsSint32LE(_stripNum); } +void Globals::dispatchSound(ASound *obj) { + obj->dispatch(); +} + +void Globals::dispatchSounds() { + Common::for_each(_sounds.begin(), _sounds.end(), Globals::dispatchSound); +} + + } // end of namespace tSage diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 3635fcc3fa..7cfec718e2 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -34,6 +34,8 @@ namespace tSage { class Globals : public SavedObject { +private: + static void dispatchSound(ASound *obj); public: GfxSurface _screenSurface; GfxManager _gfxManagerInstance; @@ -56,7 +58,7 @@ public: SoundManager _soundManager; Common::Point _dialogCenter; WalkRegions _walkRegions; - SynchronizedList<EventHandler *> _sceneListeners; + SynchronizedList<ASound *> _sounds; bool _flags[256]; Player _player; ASound _soundHandler; @@ -91,6 +93,7 @@ public: GfxManager &gfxManager() { return **_gfxManagers.begin(); } virtual Common::String getClassName() { return "Globals"; } virtual void synchronize(Serializer &s); + void dispatchSounds(); }; extern Globals *_globals; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 4625661b62..a820a20167 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -55,7 +55,7 @@ void SceneManager::checkScene() { _nextSceneNumber = -1; } - Common::for_each(_globals->_sceneListeners.begin(), _globals->_sceneListeners.end(), SceneHandler::dispatchObject); + _globals->dispatchSounds(); } void SceneManager::sceneChange() { |