diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gui/gui_picture.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 13 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 11 |
3 files changed, 21 insertions, 5 deletions
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp index d3effcd917..d8fa63954d 100644 --- a/engines/sci/gui/gui_picture.cpp +++ b/engines/sci/gui/gui_picture.cpp @@ -498,7 +498,7 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) { _priority = pic_priority; // Dithering EGA pictures if (isEGA) { - _screen->dither(); + _screen->dither(_addToFlag); } return; default: diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index 26a81ef833..0e0a1ed170 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -216,7 +216,7 @@ void SciGuiScreen::setPalette(GuiPalette*pal) { } // Currently not really done, its supposed to be possible to only dither _visualScreen -void SciGuiScreen::dither() { +void SciGuiScreen::dither(bool addToFlag) { int y, x; byte color; byte *screenPtr = _visualScreen; @@ -236,12 +236,16 @@ void SciGuiScreen::dither() { } } } else { + if (!addToFlag) + memset(&_unditherMemorial, 0, sizeof(_unditherMemorial)); // Do dithering on visual screen and put decoded but undithered byte onto display-screen for (y = 0; y < _height; y++) { for (x = 0; x < _width; x++) { color = *screenPtr; if (color & 0xF0) { color ^= color << 4; + // remember dither combination for cel-undithering + _unditherMemorial[color]++; // if decoded color wants do dither with black on left side, we turn it around // otherwise the normal ega color would get used for display if (color & 0xF0) { @@ -262,6 +266,13 @@ void SciGuiScreen::unditherSetState(bool flag) { _unditherState = flag; } +int16 *SciGuiScreen::unditherGetMemorial() { + if (_unditherState) + return (int16 *)&_unditherMemorial; + else + return NULL; +} + void SciGuiScreen::debugShowMap(int mapNo) { switch (mapNo) { case 0: diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h index c9af0a6ff8..60b49ae351 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -39,6 +39,8 @@ namespace Sci { #define SCI_SCREEN_MASK_ALL SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_CONTROL #define SCI_SCREEN_MASK_DITHERED 128 +#define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256 + class SciGuiScreen { public: SciGuiScreen(int16 width = 320, int16 height = 200, int16 scaleFactor = 1); @@ -59,8 +61,9 @@ public: void setPalette(GuiPalette*pal); - void dither(); + void dither(bool addToFlag); void unditherSetState(bool flag); + int16 *unditherGetMemorial(); void debugShowMap(int mapNo); @@ -73,8 +76,6 @@ public: int _picNotValid; // possible values 0, 1 and 2 - bool _unditherState; - private: void restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *screen); void saveBitsScreen(Common::Rect rect, byte *screen, byte *&memoryPtr); @@ -82,6 +83,9 @@ private: uint16 _baseTable[SCI_SCREEN_MAXHEIGHT]; uint16 _baseDisplayTable[SCI_SCREEN_MAXHEIGHT]; + bool _unditherState; + int16 _unditherMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE]; + public: // HACK. TODO: make private // these screens have the real resolution of the game engine (320x200 for SCI0/SCI1/SCI11 games, 640x480 for SCI2 games) // SCI0 games will be dithered in here at any time @@ -92,6 +96,7 @@ public: // HACK. TODO: make private // this screen is the one that is actually displayed to the user. It may be 640x480 for japanese SCI1 games // SCI0 games may be undithered in here. Only read from this buffer for Save/ShowBits usage. byte *_displayScreen; +private: // this is a pointer to the currently active screen (changing it only required for debug purposes) byte *_activeScreen; |