diff options
author | Einar Johan Trøan Sømåen | 2012-07-30 19:41:44 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-30 19:41:44 +0200 |
commit | 43611724441e880b7283ae195d40f5e63aa6affd (patch) | |
tree | c2eae21a19c8472321d1454a61e4f19a34054a80 /engines/wintermute/base | |
parent | 85ce9340bcb425a6c5e8dbcacff5a7fa2fb4c817 (diff) | |
download | scummvm-rg350-43611724441e880b7283ae195d40f5e63aa6affd.tar.gz scummvm-rg350-43611724441e880b7283ae195d40f5e63aa6affd.tar.bz2 scummvm-rg350-43611724441e880b7283ae195d40f5e63aa6affd.zip |
WINTERMUTE: Redraw ONLY the indicator when saving/loading.
Diffstat (limited to 'engines/wintermute/base')
5 files changed, 27 insertions, 10 deletions
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 006f15fa2c..7f527392dc 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -365,12 +365,6 @@ bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) { BaseScriptable::persist(persistMgr);
- if (persistMgr->getIsSaving()) {
- getRect(); // To make sure it gets updated if it was never loaded.
- } else {
- _wantsDefaultRect = false;
- }
-
persistMgr->transfer(TMEMBER(_2DOnly));
persistMgr->transfer(TMEMBER(_3DOnly));
persistMgr->transfer(TMEMBER(_alpha));
@@ -379,6 +373,7 @@ bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_hotspotX));
persistMgr->transfer(TMEMBER(_hotspotY));
persistMgr->transfer(TMEMBER(_rect));
+ persistMgr->transfer(TMEMBER(_wantsDefaultRect));
persistMgr->transfer(TMEMBER(_surfaceFilename));
persistMgr->transfer(TMEMBER(_cKDefault));
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index cd065f3436..5d81c44c25 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -52,6 +52,7 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) { _indicatorY = -1;
_indicatorWidth = -1;
_indicatorHeight = 8;
+ _indicatorWidthDrawn = 0;
_loadImageName = "";
_saveImageName = "";
@@ -103,7 +104,10 @@ void BaseRenderer::setIndicator(int width, int height, int x, int y, uint32 colo }
void BaseRenderer::setIndicatorVal(int value) {
+ bool redisplay = (_indicatorProgress != value);
_indicatorProgress = value;
+ if (redisplay)
+ displayIndicator();
}
void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) {
@@ -153,6 +157,7 @@ void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) { void BaseRenderer::endSaveLoad() {
_loadInProgress = false;
_indicatorDisplay = false;
+ _indicatorWidthDrawn = 0;
delete _saveLoadImage;
_saveLoadImage = NULL;
@@ -338,7 +343,7 @@ void BaseRenderer::addRectToList(BaseActiveRect *rect) { //////////////////////////////////////////////////////////////////////////
bool BaseRenderer::displayIndicator() {
- if (!_indicatorDisplay) {
+ if (!_indicatorDisplay || !_indicatorProgress) {
return STATUS_OK;
}
if (_saveLoadImage) {
@@ -355,11 +360,16 @@ bool BaseRenderer::displayIndicator() { return STATUS_OK;
}
setupLines();
+ int curWidth = (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f));
for (int i = 0; i < _indicatorHeight; i++) {
- drawLine(_indicatorX, _indicatorY + i, _indicatorX + (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f)), _indicatorY + i, _indicatorColor);
+ drawLine(_indicatorX, _indicatorY + i, _indicatorX + curWidth, _indicatorY + i, _indicatorColor);
}
setup2D();
+ _indicatorWidthDrawn = curWidth;
+ if (_indicatorWidthDrawn) {
+ indicatorFlip();
+ }
return STATUS_OK;
}
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index a36a3ca9c0..49b5e187eb 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -110,6 +110,11 @@ public: * @return true if successfull, false on error.
*/
virtual bool flip() = 0;
+ /**
+ * Special flip for the indicator drawn during save/load
+ * essentially, just copies the region defined by the _indicator-variables.
+ */
+ virtual bool indicatorFlip() = 0;
virtual void initLoop();
virtual bool setup2D(bool force = false);
virtual bool setupLines();
@@ -179,7 +184,7 @@ public: void setSaveImage(const char *filename, int x, int y);
bool displayIndicator();
-private:
+protected:
Common::String _loadImageName;
Common::String _saveImageName;
int _saveImageX;
@@ -188,6 +193,7 @@ private: int _loadImageY;
BaseSurface *_saveLoadImage;
+ int _indicatorWidthDrawn;
uint32 _indicatorColor;
int _indicatorX;
int _indicatorY;
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index fa0663dc65..bc952b0b36 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -185,7 +185,12 @@ void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) { _colorMod = BS_ARGB(alpha, r, g, b);
}
-//////////////////////////////////////////////////////////////////////////
+bool BaseRenderOSystem::indicatorFlip() {
+ g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight);
+ g_system->updateScreen();
+ return STATUS_OK;
+}
+
bool BaseRenderOSystem::flip() {
if (!_disableDirtyRects) {
drawTickets();
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 2b6b5943c2..08fd6cf9ab 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -66,6 +66,7 @@ public: bool initRenderer(int width, int height, bool windowed);
bool flip();
+ virtual bool indicatorFlip();
bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
Graphics::PixelFormat getPixelFormat() const;
void fade(uint16 alpha);
|