aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2013-04-18 11:19:26 +0200
committerEinar Johan Trøan Sømåen2013-04-18 11:19:26 +0200
commit7ee757366b9aee0e6a59669d263e29b5fe20278e (patch)
tree2aa8b48dc13063b0a3cdd2fa443405ed907a2e64
parenta8f4f20f38bd577ae9b63a15dec7416523de2b16 (diff)
downloadscummvm-rg350-7ee757366b9aee0e6a59669d263e29b5fe20278e.tar.gz
scummvm-rg350-7ee757366b9aee0e6a59669d263e29b5fe20278e.tar.bz2
scummvm-rg350-7ee757366b9aee0e6a59669d263e29b5fe20278e.zip
WINTERMUTE: Avoid including BaseGame in BaseViewport.
-rw-r--r--engines/wintermute/base/base_engine.cpp8
-rw-r--r--engines/wintermute/base/base_engine.h2
-rw-r--r--engines/wintermute/base/base_viewport.cpp9
-rw-r--r--engines/wintermute/base/base_viewport.h2
4 files changed, 17 insertions, 4 deletions
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp
index 3525b246f6..f8dc5dff8a 100644
--- a/engines/wintermute/base/base_engine.cpp
+++ b/engines/wintermute/base/base_engine.cpp
@@ -98,4 +98,12 @@ BaseSoundMgr *BaseEngine::getSoundMgr() {
}
}
+BaseRenderer *BaseEngine::getRenderer() {
+ if (instance()._gameRef) {
+ return _gameRef->_renderer;
+ } else {
+ return nullptr;
+ }
+}
+
} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h
index 63a8d23276..aa23cdd3e5 100644
--- a/engines/wintermute/base/base_engine.h
+++ b/engines/wintermute/base/base_engine.h
@@ -40,6 +40,7 @@ class BaseFileManager;
class BaseRegistry;
class BaseGame;
class BaseSoundMgr;
+class BaseRenderer;
class SystemClassRegistry;
class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
void init(Common::Language lang);
@@ -62,6 +63,7 @@ public:
BaseGame *getGameRef() { return _gameRef; }
BaseFileManager *getFileManager() { return _fileManager; }
BaseSoundMgr *getSoundMgr();
+ BaseRenderer *getRenderer();
static void LOG(bool res, const char *fmt, ...);
const char *getGameId() { return _gameId.c_str(); }
};
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
index b6c4eb5e3e..4f62a4f6f9 100644
--- a/engines/wintermute/base/base_viewport.cpp
+++ b/engines/wintermute/base/base_viewport.cpp
@@ -26,9 +26,10 @@
* Copyright (c) 2011 Jan Nedoma
*/
-#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/base_viewport.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
+#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
namespace Wintermute {
@@ -68,8 +69,8 @@ bool BaseViewport::setRect(int left, int top, int right, int bottom, bool noChec
if (!noCheck) {
left = MAX(left, 0);
top = MAX(top, 0);
- right = MIN(right, _gameRef->_renderer->getWidth());
- bottom = MIN(bottom, _gameRef->_renderer->getHeight());
+ right = MIN(right, BaseEngine::instance().getRenderer()->getWidth());
+ bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight());
}
BasePlatform::setRect(&_rect, left, top, right, bottom);
diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h
index c69682da62..636c9c5642 100644
--- a/engines/wintermute/base/base_viewport.h
+++ b/engines/wintermute/base/base_viewport.h
@@ -31,6 +31,8 @@
#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/math/rect32.h"
+#include "engines/wintermute/persistent.h"
namespace Wintermute {
class BaseObject;