[Scummvm-cvs-logs] SF.net SVN: scummvm:[44761] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Oct 7 23:47:34 CEST 2009


Revision: 44761
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44761&view=rev
Author:   m_kiewitz
Date:     2009-10-07 21:47:34 +0000 (Wed, 07 Oct 2009)

Log Message:
-----------
SCI: debug command undither implemented

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui.h
    scummvm/trunk/engines/sci/gui/gui_screen.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.h
    scummvm/trunk/engines/sci/gui32/gui32.cpp
    scummvm/trunk/engines/sci/gui32/gui32.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/console.cpp	2009-10-07 21:47:34 UTC (rev 44761)
@@ -108,6 +108,7 @@
 	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 @@
 	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 @@
 	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");

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/console.h	2009-10-07 21:47:34 UTC (rev 44761)
@@ -93,6 +93,7 @@
 	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);

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-07 21:47:34 UTC (rev 44761)
@@ -496,6 +496,11 @@
 	// FIXME!
 }
 
+bool SciGui::debugUndither(bool flag) {
+	_screen->unditherSetState(flag);
+	return false;
+}
+
 bool SciGui::debugShowMap(int mapNo) {
 	_screen->debugShowMap(mapNo);
 	return false;

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui/gui.h	2009-10-07 21:47:34 UTC (rev 44761)
@@ -90,6 +90,7 @@
 	virtual void setCursorPos(Common::Point pos);
 	virtual void moveCursor(Common::Point pos);
 
+	virtual bool debugUndither(bool flag);
 	virtual bool debugShowMap(int mapNo);
 
 private:

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-07 21:47:34 UTC (rev 44761)
@@ -60,6 +60,7 @@
 	}
 
 	_picNotValid = false;
+	_unditherState = false;
 }
 
 SciGuiScreen::~SciGuiScreen() {
@@ -223,7 +224,7 @@
 // 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 @@
 			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:

Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-07 21:47:34 UTC (rev 44761)
@@ -62,6 +62,7 @@
 	void setPalette(GuiPalette*pal);
 
 	void dither();
+	void unditherSetState(bool flag);
 
 	void debugShowMap(int mapNo);
 
@@ -74,6 +75,8 @@
 
 	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);

Modified: scummvm/trunk/engines/sci/gui32/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-07 21:47:34 UTC (rev 44761)
@@ -2047,6 +2047,10 @@
 	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);
 

Modified: scummvm/trunk/engines/sci/gui32/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-07 21:29:47 UTC (rev 44760)
+++ scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-07 21:47:34 UTC (rev 44761)
@@ -83,6 +83,7 @@
 	void setCursorPos(Common::Point pos);
 	void moveCursor(Common::Point pos);
 
+	bool debugUndither(bool flag);
 	bool debugShowMap(int mapNo);
 
 private:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list