diff options
author | Einar Johan Trøan Sømåen | 2012-07-09 09:45:56 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-09 09:45:56 +0200 |
commit | 2959065e49390ab1da0b00a277a464d991ff10ad (patch) | |
tree | d31bd54f32931409b615faa6911366d33b9d2a47 | |
parent | 3809d9a9ea8a18512235420b720fad424d0f9986 (diff) | |
download | scummvm-rg350-2959065e49390ab1da0b00a277a464d991ff10ad.tar.gz scummvm-rg350-2959065e49390ab1da0b00a277a464d991ff10ad.tar.bz2 scummvm-rg350-2959065e49390ab1da0b00a277a464d991ff10ad.zip |
WINTERMUTE: Reduce the includes and visibility in BGame a bit.
-rw-r--r-- | engines/wintermute/Base/BFontTT.cpp | 18 | ||||
-rw-r--r-- | engines/wintermute/Base/BGame.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/Base/BGame.h | 30 | ||||
-rw-r--r-- | engines/wintermute/Base/BImage.cpp | 1 | ||||
-rw-r--r-- | engines/wintermute/Base/BRenderSDL.cpp | 8 | ||||
-rw-r--r-- | engines/wintermute/Base/BRenderSDL.h | 1 | ||||
-rw-r--r-- | engines/wintermute/Base/BRenderer.h | 6 |
7 files changed, 45 insertions, 29 deletions
diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp index 998aead064..50cb8984d1 100644 --- a/engines/wintermute/Base/BFontTT.cpp +++ b/engines/wintermute/Base/BFontTT.cpp @@ -32,8 +32,8 @@ #include "engines/wintermute/utils/PathUtil.h"
#include "engines/wintermute/utils/StringUtil.h"
#include "engines/wintermute/math/MathUtil.h"
-#include "engines/wintermute/Base/BRenderSDL.h"
-#include "engines/wintermute/Base/BSurfaceSDL.h"
+#include "engines/wintermute/Base/BRenderer.h"
+#include "engines/wintermute/Base/BSurface.h"
#include "engines/wintermute/Base/BParser.h"
#include "engines/wintermute/Base/BGame.h"
#include "engines/wintermute/Base/BFileManager.h"
@@ -165,7 +165,7 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i textStr = Common::String(textStr.c_str(), (uint32)maxLength);
//text = text.substr(0, MaxLength); // TODO: Remove
- CBRenderSDL *_renderer = (CBRenderSDL *)Game->_renderer;
+ CBRenderer *renderer = Game->_renderer;
// find cached surface, if exists
int minPriority = INT_MAX;
@@ -221,14 +221,14 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i CBPlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight());
for (int i = 0; i < _layers.getSize(); i++) {
uint32 color = _layers[i]->_color;
- uint32 origForceAlpha = _renderer->_forceAlphaColor;
- if (_renderer->_forceAlphaColor != 0) {
- color = BYTETORGBA(RGBCOLGetR(color), RGBCOLGetG(color), RGBCOLGetB(color), RGBCOLGetA(_renderer->_forceAlphaColor));
- _renderer->_forceAlphaColor = 0;
+ uint32 origForceAlpha = renderer->_forceAlphaColor;
+ if (renderer->_forceAlphaColor != 0) {
+ color = BYTETORGBA(RGBCOLGetR(color), RGBCOLGetG(color), RGBCOLGetB(color), RGBCOLGetA(renderer->_forceAlphaColor));
+ renderer->_forceAlphaColor = 0;
}
surface->displayTransOffset(x, y - textOffset, rc, color, BLEND_NORMAL, false, false, _layers[i]->_offsetX, _layers[i]->_offsetY);
- _renderer->_forceAlphaColor = origForceAlpha;
+ renderer->_forceAlphaColor = origForceAlpha;
}
}
@@ -270,7 +270,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex heightOffset += (int)_lineHeight;
}
- CBSurfaceSDL *retSurface = new CBSurfaceSDL(Game);
+ CBSurface *retSurface = Game->_renderer->createSurface();
Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8 , 0));
retSurface->putSurface(*convertedSurface, true);
convertedSurface->free();
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp index d1ade0e3fd..7ad692ad7f 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -37,12 +37,12 @@ #include "engines/wintermute/Base/BParser.h"
#include "engines/wintermute/Base/BQuickMsg.h"
#include "engines/wintermute/Base/BRegistry.h"
-#include "engines/wintermute/Base/BRenderSDL.h"
+#include "engines/wintermute/Base/BRenderer.h"
#include "engines/wintermute/Base/BSound.h"
#include "engines/wintermute/Base/BSoundMgr.h"
#include "engines/wintermute/Base/BSprite.h"
#include "engines/wintermute/Base/BSubFrame.h"
-#include "engines/wintermute/Base/BSurfaceSDL.h"
+#include "engines/wintermute/Base/BSurface.h"
#include "engines/wintermute/Base/BTransitionMgr.h"
#include "engines/wintermute/Base/BViewport.h"
#include "engines/wintermute/Base/BStringTable.h"
@@ -499,7 +499,7 @@ ERRORCODE CBGame::initialize1() { //////////////////////////////////////////////////////////////////////
ERRORCODE CBGame::initialize2() { // we know whether we are going to be accelerated
- _renderer = new CBRenderSDL(this);
+ _renderer = makeSDLRenderer(this);
if (_renderer == NULL) return STATUS_FAILED;
return STATUS_OK;
@@ -3209,7 +3209,7 @@ ERRORCODE CBGame::SaveGame(int slot, const char *desc, bool quickSave) { delete _saveLoadImage;
_saveLoadImage = NULL;
if (_saveImageName) {
- _saveLoadImage = new CBSurfaceSDL(this);
+ _saveLoadImage = _renderer->createSurface();
if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
delete _saveLoadImage;
@@ -3259,7 +3259,7 @@ ERRORCODE CBGame::loadGame(const char *filename) { delete _saveLoadImage;
_saveLoadImage = NULL;
if (_loadImageName) {
- _saveLoadImage = new CBSurfaceSDL(this);
+ _saveLoadImage = _renderer->createSurface();
if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
delete _saveLoadImage;
diff --git a/engines/wintermute/Base/BGame.h b/engines/wintermute/Base/BGame.h index 867700db9b..6650767600 100644 --- a/engines/wintermute/Base/BGame.h +++ b/engines/wintermute/Base/BGame.h @@ -117,10 +117,10 @@ public: char *_localSaveDir;
bool _saveDirChecked;
-
+ int _indicatorProgress;
+protected:
bool _indicatorDisplay;
uint32 _indicatorColor;
- int _indicatorProgress;
int _indicatorX;
int _indicatorY;
int _indicatorWidth;
@@ -135,15 +135,15 @@ public: int _saveImageY;
int _loadImageX;
int _loadImageY;
- CBSurface *_saveLoadImage;
+ CBSurface *_saveLoadImage;
ERRORCODE displayIndicator();
+ bool _reportTextureFormat;
+public:
int _thumbnailWidth;
int _thumbnailHeight;
- bool _reportTextureFormat;
-
void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL);
ENGINE_LOG_CALLBACK _engineLogCallback;
void *_engineLogCallbackData;
@@ -198,13 +198,16 @@ public: CBArray<CBViewport *, CBViewport *> _viewportStack;
int _viewportSP;
- bool _mouseLeftDown;
- bool _mouseRightDown;
- bool _mouseMidlleDown;
- CBStringTable *_stringTable;
+ CBStringTable *_stringTable;
int _settingsResWidth;
int _settingsResHeight;
+ char *_settingsGameFile;
+ bool _suppressScriptErrors;
+ bool _mouseLeftDown;
+protected:
+ bool _mouseRightDown;
+ bool _mouseMidlleDown;
bool _settingsRequireAcceleration;
bool _settingsAllowWindowed;
bool _settingsAllowAdvanced;
@@ -213,13 +216,10 @@ public: bool _settingsRequireSound;
bool _settingsAllowDesktopRes;
int _settingsTLMode;
- char *_settingsGameFile;
CBFader *_fader;
- bool _suppressScriptErrors;
-
virtual ERRORCODE invalidateDeviceObjects();
virtual ERRORCODE restoreDeviceObjects();
-
+public:
virtual ERRORCODE ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
@@ -256,7 +256,9 @@ public: virtual bool handleKeypress(Common::Event *event, bool printable = false);
virtual void handleKeyRelease(Common::Event *event);
+protected:
int _freezeLevel;
+public:
ERRORCODE unfreeze();
ERRORCODE freeze(bool includingMusic = true);
ERRORCODE focusWindow(CUIWindow *window);
@@ -265,11 +267,13 @@ public: bool _loadInProgress;
CUIWindow *_focusedWindow;
bool _editorForceScripts;
+protected:
static void afterLoadRegion(void *region, void *data);
static void afterLoadSubFrame(void *subframe, void *data);
static void afterLoadSound(void *sound, void *data);
static void afterLoadFont(void *font, void *data);
static void afterLoadScript(void *script, void *data);
+public:
static void invalidateValues(void *value, void *data);
ERRORCODE loadSettings(const char *filename);
diff --git a/engines/wintermute/Base/BImage.cpp b/engines/wintermute/Base/BImage.cpp index c28577087b..9dd9dbf300 100644 --- a/engines/wintermute/Base/BImage.cpp +++ b/engines/wintermute/Base/BImage.cpp @@ -28,7 +28,6 @@ #include "engines/wintermute/dcgf.h"
#include "engines/wintermute/Base/BImage.h"
-#include "engines/wintermute/Base/BSurfaceSDL.h"
#include "engines/wintermute/Base/BGame.h"
#include "engines/wintermute/Base/BFileManager.h"
#include "engines/wintermute/graphics/transparentSurface.h"
diff --git a/engines/wintermute/Base/BRenderSDL.cpp b/engines/wintermute/Base/BRenderSDL.cpp index 936549a6c4..26ae8c5787 100644 --- a/engines/wintermute/Base/BRenderSDL.cpp +++ b/engines/wintermute/Base/BRenderSDL.cpp @@ -83,6 +83,10 @@ bool RenderTicket::operator==(RenderTicket &t) { return true;
}
+CBRenderer *makeSDLRenderer(CBGame *inGame) {
+ return new CBRenderSDL(inGame);
+}
+
// TODO: Redo everything here.
//////////////////////////////////////////////////////////////////////////
@@ -662,4 +666,8 @@ void CBRenderSDL::dumpData(const char *filename) { #endif
}
+CBSurface *CBRenderSDL::createSurface() {
+ return new CBSurfaceSDL(Game);
+}
+
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BRenderSDL.h b/engines/wintermute/Base/BRenderSDL.h index 6c88feb059..aa5b390ede 100644 --- a/engines/wintermute/Base/BRenderSDL.h +++ b/engines/wintermute/Base/BRenderSDL.h @@ -99,6 +99,7 @@ public: }
void drawSurface(CBSurfaceSDL *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY);
+ CBSurface *createSurface();
private:
void addDirtyRect(const Common::Rect &rect);
void drawTickets();
diff --git a/engines/wintermute/Base/BRenderer.h b/engines/wintermute/Base/BRenderer.h index c32a4d6bc1..43a2e14ea2 100644 --- a/engines/wintermute/Base/BRenderer.h +++ b/engines/wintermute/Base/BRenderer.h @@ -39,7 +39,7 @@ namespace WinterMute { class CBImage;
class CBActiveRect;
class CBObject;
-
+class CBSurface;
class CBRenderer: public CBBase {
public:
int _realWidth;
@@ -89,6 +89,8 @@ public: return 1.0f;
}
+ virtual CBSurface *createSurface() = 0;
+
ERRORCODE clipCursor();
ERRORCODE unclipCursor();
@@ -119,6 +121,8 @@ public: CBArray<CBActiveRect *, CBActiveRect *> _rectList;
};
+CBRenderer *makeSDLRenderer(CBGame *inGame); // Implemented in BRenderSDL.cpp
+
} // end of namespace WinterMute
#endif
|