diff options
author | Walter van Niftrik | 2016-03-03 14:05:19 +0100 |
---|---|---|
committer | Walter van Niftrik | 2016-03-09 10:03:13 +0100 |
commit | b30fb417acb29dee415a784f15f63772a010b4d3 (patch) | |
tree | fc02221ac9e252f9c4db596d2b03e092ff8f89dc | |
parent | 912a31fa652c389b14e3d77998736813e3b621d0 (diff) | |
download | scummvm-rg350-b30fb417acb29dee415a784f15f63772a010b4d3.tar.gz scummvm-rg350-b30fb417acb29dee415a784f15f63772a010b4d3.tar.bz2 scummvm-rg350-b30fb417acb29dee415a784f15f63772a010b4d3.zip |
ADL: Disable scanlines when saving thumbnail
-rw-r--r-- | engines/adl/adl.cpp | 2 | ||||
-rw-r--r-- | engines/adl/display.cpp | 51 | ||||
-rw-r--r-- | engines/adl/display.h | 6 |
3 files changed, 46 insertions, 13 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 15a6c32018..083fde9690 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -552,7 +552,7 @@ Common::Error AdlEngine::saveGameState(int slot, const Common::String &desc) { uint32 playTime = getTotalPlayTime(); outFile->writeUint32BE(playTime); - Graphics::saveThumbnail(*outFile); + _display->saveThumbnail(*outFile); outFile->writeByte(_state.room); outFile->writeByte(_state.moves); diff --git a/engines/adl/display.cpp b/engines/adl/display.cpp index ade05ab06d..6a7cc6900b 100644 --- a/engines/adl/display.cpp +++ b/engines/adl/display.cpp @@ -33,6 +33,7 @@ #include "engines/engine.h" #include "engines/util.h" #include "graphics/palette.h" +#include "graphics/thumbnail.h" namespace Adl { @@ -81,7 +82,12 @@ Display::Display() : _monochrome = !ConfMan.getBool("color"); _scanlines = ConfMan.getBool("scanlines"); - setPalette(_scanlines, _monochrome); + if (_monochrome) + setMonoPalette(); + else + setColorPalette(); + + enableScanlines(_scanlines); _frameBuf = new byte[kFrameBufSize]; _frameBufSurface = new Graphics::Surface; @@ -108,7 +114,34 @@ Display::~Display() { delete _font; } -void Display::setPalette(bool scanlines, bool monochrome) { +bool Display::saveThumbnail(Common::WriteStream &out) { + if (_scanlines) { + enableScanlines(false); + g_system->updateScreen(); + } + + bool retval = Graphics::saveThumbnail(out); + + if (_scanlines) { + enableScanlines(true); + g_system->updateScreen(); + } + + return retval; +} + +void Display::enableScanlines(bool enable) { + byte pal[6 * 3] = { }; + + if (enable) + g_system->getPaletteManager()->setPalette(pal, 6, 6); + else { + g_system->getPaletteManager()->grabPalette(pal, 0, 6); + g_system->getPaletteManager()->setPalette(pal, 6, 6); + } +} + +void Display::setColorPalette() { const byte colorPal[6 * 3] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, @@ -118,20 +151,16 @@ void Display::setPalette(bool scanlines, bool monochrome) { 0xf2, 0x5e, 0x00 }; + g_system->getPaletteManager()->setPalette(colorPal, 0, 6); +} + +void Display::setMonoPalette() { const byte monoPal[2 * 3] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01 }; - if (monochrome) { - g_system->getPaletteManager()->setPalette(monoPal, 0, 2); - if (!scanlines) - g_system->getPaletteManager()->setPalette(monoPal, 6, 2); - } else { - g_system->getPaletteManager()->setPalette(colorPal, 0, 6); - if (!scanlines) - g_system->getPaletteManager()->setPalette(colorPal, 6, 6); - } + g_system->getPaletteManager()->setPalette(monoPal, 0, 2); } void Display::loadFrameBuffer(Common::ReadStream &stream) { diff --git a/engines/adl/display.h b/engines/adl/display.h index 21cc599b89..12e3ab90b9 100644 --- a/engines/adl/display.h +++ b/engines/adl/display.h @@ -28,6 +28,7 @@ namespace Common { class ReadStream; +class WriteStream; class String; class Point; } @@ -50,7 +51,9 @@ public: Display(); ~Display(); - void setPalette(bool monochrome, bool scanlines); + void enableScanlines(bool enable); + void setMonoPalette(); + void setColorPalette(); void loadFrameBuffer(Common::ReadStream &stream); void decodeFrameBuffer(); void updateScreen(); @@ -69,6 +72,7 @@ public: void setCharAtCursor(byte c); void showCursor(bool enable); void updateTextSurface(); + bool saveThumbnail(Common::WriteStream &out); private: enum { |