Skip to content

Commit

Permalink
KYRA: (EOB) - fix save file thumbnail generation in CGA/EGA mode
Browse files Browse the repository at this point in the history
  • Loading branch information
athrxx committed Feb 24, 2012
1 parent 3b57446 commit 30fa5e1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
9 changes: 8 additions & 1 deletion engines/kyra/gui_eob.cpp
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/screen.h
Expand Up @@ -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);

Expand Down
15 changes: 15 additions & 0 deletions engines/kyra/screen_eob.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions engines/kyra/screen_eob.h
Expand Up @@ -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, ...);
Expand Down

0 comments on commit 30fa5e1

Please sign in to comment.