diff options
author | Martin Kiewitz | 2009-10-07 21:47:34 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-07 21:47:34 +0000 |
commit | a61076a645e8c185b54d290f223b70fea2fccb3b (patch) | |
tree | 0a8d1b129af19ac5fa91a60a5046fc551801e951 /engines/sci | |
parent | 1562add63191c482acf99da61d6d8d1e2bf8903d (diff) | |
download | scummvm-rg350-a61076a645e8c185b54d290f223b70fea2fccb3b.tar.gz scummvm-rg350-a61076a645e8c185b54d290f223b70fea2fccb3b.tar.bz2 scummvm-rg350-a61076a645e8c185b54d290f223b70fea2fccb3b.zip |
SCI: debug command undither implemented
svn-id: r44761
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/console.cpp | 14 | ||||
-rw-r--r-- | engines/sci/console.h | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 5 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 19 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 3 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 1 |
8 files changed, 41 insertions, 7 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 718953f8ac..b74e338d1b 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -108,6 +108,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { DCmd_Register("draw_rect", WRAP_METHOD(Console, cmdDrawRect)); DCmd_Register("draw_cel", WRAP_METHOD(Console, cmdDrawCel)); DCmd_Register("view_info", WRAP_METHOD(Console, cmdViewInfo)); + DCmd_Register("undither", WRAP_METHOD(Console, cmdUndither)); // GUI DCmd_Register("current_port", WRAP_METHOD(Console, cmdCurrentPort)); DCmd_Register("print_port", WRAP_METHOD(Console, cmdPrintPort)); @@ -280,6 +281,7 @@ bool Console::cmdHelp(int argc, const char **argv) { DebugPrintf(" draw_rect - Draws a rectangle to the screen with one of the EGA colors\n"); DebugPrintf(" draw_cel - Draws a single view cel to the center of the screen\n"); DebugPrintf(" view_info - Displays information for the specified view\n"); + DebugPrintf(" undither - Enable/disable undithering\n"); DebugPrintf("\n"); DebugPrintf("GUI:\n"); DebugPrintf(" current_port - Shows the ID of the currently active port\n"); @@ -1059,6 +1061,18 @@ bool Console::cmdViewInfo(int argc, const char **argv) { return true; } +bool Console::cmdUndither(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Enable/disable undithering.\n"); + DebugPrintf("Usage: %s <0/1>\n", argv[0]); + return true; + } + + bool flag = atoi(argv[1]) ? true : false; + + return _vm->_gamestate->_gui->debugUndither(flag); +} + bool Console::cmdUpdateZone(int argc, const char **argv) { if (argc != 4) { DebugPrintf("Propagates a rectangular area from the back buffer to the front buffer\n"); diff --git a/engines/sci/console.h b/engines/sci/console.h index f330a05a77..a632f341b8 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -93,6 +93,7 @@ private: bool cmdDrawRect(int argc, const char **argv); bool cmdDrawCel(int argc, const char **argv); bool cmdViewInfo(int argc, const char **argv); + bool cmdUndither(int argc, const char **argv); // GUI bool cmdCurrentPort(int argc, const char **argv); bool cmdPrintPort(int argc, const char **argv); diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 331666edff..743172fe4e 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -496,6 +496,11 @@ void SciGui::moveCursor(Common::Point pos) { // FIXME! } +bool SciGui::debugUndither(bool flag) { + _screen->unditherSetState(flag); + return false; +} + bool SciGui::debugShowMap(int mapNo) { _screen->debugShowMap(mapNo); return false; diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 33a945a634..2ebf4e85d4 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -90,6 +90,7 @@ public: virtual void setCursorPos(Common::Point pos); virtual void moveCursor(Common::Point pos); + virtual bool debugUndither(bool flag); virtual bool debugShowMap(int mapNo); private: diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index d7933c0535..e2da6fd072 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -60,6 +60,7 @@ SciGuiScreen::SciGuiScreen(int16 width, int16 height, int16 scaleFactor) : } _picNotValid = false; + _unditherState = false; } SciGuiScreen::~SciGuiScreen() { @@ -223,7 +224,7 @@ void SciGuiScreen::setPalette(GuiPalette*pal) { // Currently not really done, its supposed to be possible to only dither _visualScreen void SciGuiScreen::dither() { int y, x; - byte color; + byte color, ditheredColor; byte *screenPtr = _visualScreen; byte *displayPtr = _displayScreen; @@ -232,18 +233,22 @@ void SciGuiScreen::dither() { color = *screenPtr; if (color & 0xF0) { color ^= color << 4; -// remove remark to enable undithering -// *displayPtr = color; - // do the actual dithering - color = ((x^y) & 1) ? color >> 4 : color & 0x0F; - *screenPtr = color; - *displayPtr = color; // put remark here to enable unditherung + ditheredColor = ((x^y) & 1) ? color >> 4 : color & 0x0F; + *screenPtr = ditheredColor; + if (_unditherState) + *displayPtr = color; + else + *displayPtr = ditheredColor; } screenPtr++; displayPtr++; } } } +void SciGuiScreen::unditherSetState(bool flag) { + _unditherState = flag; +} + 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 0ce0f0f13c..0a631e980a 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -62,6 +62,7 @@ public: void setPalette(GuiPalette*pal); void dither(); + void unditherSetState(bool flag); void debugShowMap(int mapNo); @@ -74,6 +75,8 @@ 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); diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 1d831273f4..4d86fe3fe6 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -2047,6 +2047,10 @@ void SciGui32::moveCursor(Common::Point pos) { gfxop_get_event(s->gfx_state, SCI_EVT_PEEK); } +bool SciGui32::debugUndither(bool flag) { + return true; +} + bool SciGui32::debugShowMap(int mapNo) { gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen); diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index b944f44723..4714295c1f 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -83,6 +83,7 @@ public: void setCursorPos(Common::Point pos); void moveCursor(Common::Point pos); + bool debugUndither(bool flag); bool debugShowMap(int mapNo); private: |