From 30fa5e166379b9e0764b437c6925c22d908d7122 Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 24 Feb 2012 15:48:06 +0100 Subject: [PATCH] KYRA: (EOB) - fix save file thumbnail generation in CGA/EGA mode --- engines/kyra/gui_eob.cpp | 9 ++++++++- engines/kyra/screen.h | 2 +- engines/kyra/screen_eob.cpp | 15 +++++++++++++++ engines/kyra/screen_eob.h | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index ec9b67488588..e8e69d5b1f03 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -2648,7 +2648,14 @@ bool GUI_EoB::transferFileMenu(Common::String &targetName, Common::String &selec void GUI_EoB::createScreenThumbnail(Graphics::Surface &dst) { uint8 *screenPal = new uint8[768]; _screen->getRealPalette(0, screenPal); - ::createThumbnail(&dst, _screen->getCPagePtr(7), Screen::SCREEN_W, Screen::SCREEN_H, screenPal); + uint16 width = Screen::SCREEN_W; + uint16 height = Screen::SCREEN_H; + if (_vm->_useHiResDithering) { + width <<= 1; + height <<= 1; + } + + ::createThumbnail(&dst, _screen->getCPagePtr(7), width, height, screenPal); delete[] screenPal; } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 4f7f6d49ed13..a0cf5742c61b 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -452,7 +452,7 @@ class Screen { void enableInterfacePalette(bool e); void setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b); - void getRealPalette(int num, uint8 *dst); + virtual void getRealPalette(int num, uint8 *dst); Palette &getPalette(int num); void copyPalette(const int dst, const int src); diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp index dc53e8aca52f..9fae729bc4c2 100644 --- a/engines/kyra/screen_eob.cpp +++ b/engines/kyra/screen_eob.cpp @@ -422,6 +422,21 @@ void Screen_EoB::setScreenPalette(const Palette &pal) { } } +void Screen_EoB::getRealPalette(int num, uint8 *dst) { + if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) { + const uint8 *pal = _screenPalette->getData(); + for (int i = 0; i < 16; ++i) { + dst[0] = (pal[0] << 2) | (pal[0] & 3); + dst[1] = (pal[1] << 2) | (pal[1] & 3); + dst[2] = (pal[2] << 2) | (pal[2] & 3); + dst += 3; + pal += 3; + } + } else { + Screen::getRealPalette(num, dst); + } +} + uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit, const uint8 *cgaMapping) { uint8 *shp = 0; uint16 shapesize = 0; diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h index 92de5c8b384f..fc40cfe9037b 100644 --- a/engines/kyra/screen_eob.h +++ b/engines/kyra/screen_eob.h @@ -59,6 +59,7 @@ class Screen_EoB : public Screen { void setPagePixel(int pageNum, int x, int y, uint8 color); void setScreenPalette(const Palette &pal); + void getRealPalette(int num, uint8 *dst); uint8 *encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit = false, const uint8 *cgaMapping = 0); void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd = -1, int flags = 0, ...);