diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 006f15fa2ce..7f527392dcf 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 cd065f34364..5d81c44c25b 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 a36a3ca9c07..49b5e187eb7 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 fa0663dc65a..bc952b0b362 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 2b6b5943c26..08fd6cf9ab0 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); diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index e991fb3f07b..d9303ea729c 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -201,8 +201,6 @@ bool SystemClassRegistry::saveTable(BaseGame *gameRef, BasePersistenceManager *p if (!quickSave) { gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)_classes.size() / (float)counter))); - gameRef->displayContent(false); - gameRef->_renderer->flip(); } (it->_value)->saveTable(gameRef, persistMgr); @@ -235,8 +233,6 @@ bool SystemClassRegistry::loadTable(BaseGame *gameRef, BasePersistenceManager *p for (uint32 i = 0; i < numClasses; i++) { gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)numClasses / (float)i))); - gameRef->displayContentSimple(); - gameRef->_renderer->flip(); Common::String className = persistMgr->getStringObj(); NameMap::iterator mapIt = _nameMap.find(className); @@ -271,8 +267,6 @@ bool SystemClassRegistry::saveInstances(BaseGame *gameRef, BasePersistenceManage if (!quickSave) { if (counter % 20 == 0) { gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)_classes.size() / (float)counter))); - gameRef->displayContent(false); - gameRef->_renderer->flip(); } } gameRef->miniUpdate(); @@ -291,8 +285,6 @@ bool SystemClassRegistry::loadInstances(BaseGame *gameRef, BasePersistenceManage for (int i = 0; i < numInstances; i++) { if (i % 20 == 0) { gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)numInstances / (float)i))); - gameRef->displayContentSimple(); - gameRef->_renderer->flip(); } checkHeader("", persistMgr);