From a8f4f20f38bd577ae9b63a15dec7416523de2b16 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 18 Apr 2013 11:13:32 +0200 Subject: WINTERMUTE: Avoid including BaseGame in BaseFrame. --- engines/wintermute/base/base_engine.cpp | 8 ++++++++ engines/wintermute/base/base_engine.h | 2 ++ engines/wintermute/base/base_frame.cpp | 13 +++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'engines') 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 { 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; } -- cgit v1.2.3