SCI: debug command undither implemented

svn-id: r44761
This commit is contained in:
Martin Kiewitz 2009-10-07 21:47:34 +00:00
parent 1562add631
commit a61076a645
8 changed files with 41 additions and 7 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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);

View File

@ -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);

View File

@ -83,6 +83,7 @@ public:
void setCursorPos(Common::Point pos);
void moveCursor(Common::Point pos);
bool debugUndither(bool flag);
bool debugShowMap(int mapNo);
private: