diff options
author | lolbot-iichan | 2019-05-29 02:57:46 +0300 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 18:05:39 +0200 |
commit | 3f61c4b5f0707ccf68f9b88982a5c68afd6e27c4 (patch) | |
tree | ac06a257faa76eef937e93d3609ea9474131a1fa | |
parent | 259a7e89e649108ba4286e181b9041c6c6ffca9b (diff) | |
download | scummvm-rg350-3f61c4b5f0707ccf68f9b88982a5c68afd6e27c4.tar.gz scummvm-rg350-3f61c4b5f0707ccf68f9b88982a5c68afd6e27c4.tar.bz2 scummvm-rg350-3f61c4b5f0707ccf68f9b88982a5c68afd6e27c4.zip |
WINTERMUTE: Add FoxTail saveload indicator hack
Wintermute games usually display save/load progress bar as a rectangle drawn above an image.
FoxTail's progress bar is drawn below semitransparent image instead.
TODO: I have no idea how to make this work with "dirty_rect=true" mode.
4 files changed, 39 insertions, 4 deletions
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index 0f33fc2c43..b60a4d4b38 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -32,6 +32,7 @@ #include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/base_sub_frame.h" #include "engines/wintermute/base/base_region.h" +#include "engines/wintermute/base/base_engine.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/base_persistence_manager.h" @@ -372,6 +373,26 @@ bool BaseRenderer::displayIndicator() { if (!_indicatorDisplay || !_indicatorProgress) { return STATUS_OK; } + +#ifdef ENABLE_FOXTAIL + if (BaseEngine::instance().isFoxTail()) { + _hasDrawnSaveLoadImage = false; + fill(0, 0, 0); + displaySaveloadLines(); + displaySaveloadImage(); + forcedFlip(); + return STATUS_OK; + } +#endif + + displaySaveloadImage(); + displaySaveloadLines(); + indicatorFlip(); + return STATUS_OK; +} + +////////////////////////////////////////////////////////////////////////// +bool BaseRenderer::displaySaveloadImage() { if (_saveLoadImage && !_hasDrawnSaveLoadImage) { Rect32 rc; rc.setRect(0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); @@ -384,6 +405,11 @@ bool BaseRenderer::displayIndicator() { _hasDrawnSaveLoadImage = true; } + return STATUS_OK; +} + +////////////////////////////////////////////////////////////////////////// +bool BaseRenderer::displaySaveloadLines() { if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) { return STATUS_OK; } @@ -395,9 +421,6 @@ bool BaseRenderer::displayIndicator() { 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 6b1a4f97f4..981171b78b 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -116,6 +116,7 @@ public: * essentially, just copies the region defined by the _indicator-variables. */ virtual bool indicatorFlip() = 0; + virtual bool forcedFlip() = 0; virtual void initLoop(); virtual bool setup2D(bool force = false); virtual bool setupLines(); @@ -223,6 +224,8 @@ protected: Rect32 _monitorRect; private: Common::Array<BaseActiveRect *> _rectList; + bool displaySaveloadImage(); + bool displaySaveloadLines(); }; BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 7692bc6c48..cfa43adb17 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -146,7 +146,15 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { } bool BaseRenderOSystem::indicatorFlip() { - g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight); + if (_indicatorWidthDrawn > 0 && _indicatorHeight > 0) { + g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight); + g_system->updateScreen(); + } + return STATUS_OK; +} + +bool BaseRenderOSystem::forcedFlip() { + g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); g_system->updateScreen(); return STATUS_OK; } diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 47099046e9..11987e55e5 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -69,6 +69,7 @@ public: bool initRenderer(int width, int height, bool windowed) override; bool flip() override; virtual bool indicatorFlip(); + virtual bool forcedFlip(); bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr) override; Graphics::PixelFormat getPixelFormat() const override; void fade(uint16 alpha) override; |