diff options
author | Einar Johan Trøan Sømåen | 2013-04-18 11:13:32 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2013-04-18 11:13:32 +0200 |
commit | a8f4f20f38bd577ae9b63a15dec7416523de2b16 (patch) | |
tree | e8e62334367f87a2dc0823581d152b69a9e37181 /engines | |
parent | 4783d643f6f6546c073dfba96f73b35c931b54ea (diff) | |
download | scummvm-rg350-a8f4f20f38bd577ae9b63a15dec7416523de2b16.tar.gz scummvm-rg350-a8f4f20f38bd577ae9b63a15dec7416523de2b16.tar.bz2 scummvm-rg350-a8f4f20f38bd577ae9b63a15dec7416523de2b16.zip |
WINTERMUTE: Avoid including BaseGame in BaseFrame.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/base/base_engine.cpp | 8 | ||||
-rw-r--r-- | engines/wintermute/base/base_engine.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/base_frame.cpp | 13 |
3 files changed, 17 insertions, 6 deletions
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index a13ca4d919..3525b246f6 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -90,4 +90,12 @@ uint32 BaseEngine::randInt(int from, int to) { return _rnd->getRandomNumberRng(from, to); } +BaseSoundMgr *BaseEngine::getSoundMgr() { + if (instance()._gameRef) { + return _gameRef->_soundMgr; + } else { + return nullptr; + } +} + } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h index f04c594699..63a8d23276 100644 --- a/engines/wintermute/base/base_engine.h +++ b/engines/wintermute/base/base_engine.h @@ -39,6 +39,7 @@ namespace Wintermute { class BaseFileManager; class BaseRegistry; class BaseGame; +class BaseSoundMgr; class SystemClassRegistry; class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> { void init(Common::Language lang); @@ -60,6 +61,7 @@ public: SystemClassRegistry *getClassRegistry() { return _classReg; } BaseGame *getGameRef() { return _gameRef; } BaseFileManager *getFileManager() { return _fileManager; } + BaseSoundMgr *getSoundMgr(); static void LOG(bool res, const char *fmt, ...); const char *getGameId() { return _gameId.c_str(); } }; diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index 8a190c729b..382e8acbe0 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -27,8 +27,9 @@ */ #include "engines/wintermute/base/base_parser.h" +#include "engines/wintermute/base/base_engine.h" #include "engines/wintermute/base/base_frame.h" -#include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/base_object.h" #include "engines/wintermute/base/base_dynamic_buffer.h" #include "engines/wintermute/base/sound/base_sound_manager.h" #include "engines/wintermute/base/sound/base_sound.h" @@ -264,8 +265,8 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { } _sound = new BaseSound(_gameRef); if (!_sound || DID_FAIL(_sound->setSound(params, Audio::Mixer::kSFXSoundType, false))) { - if (_gameRef->_soundMgr->_soundAvailable) { - _gameRef->LOG(0, "Error loading sound '%s'.", params); + if (BaseEngine::instance().getSoundMgr()->_soundAvailable) { + BaseEngine::LOG(0, "Error loading sound '%s'.", params); } delete _sound; _sound = nullptr; @@ -294,12 +295,12 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { } } if (cmd == PARSERR_TOKENNOTFOUND) { - _gameRef->LOG(0, "Syntax error in FRAME definition"); + BaseEngine::LOG(0, "Syntax error in FRAME definition"); return STATUS_FAILED; } if (cmd == PARSERR_GENERIC) { - _gameRef->LOG(0, "Error loading FRAME definition"); + BaseEngine::LOG(0, "Error loading FRAME definition"); return STATUS_FAILED; } @@ -314,7 +315,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { if (!sub->_surface) { delete sub; - _gameRef->LOG(0, "Error loading SUBFRAME"); + BaseEngine::LOG(0, "Error loading SUBFRAME"); return STATUS_FAILED; } |