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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Oct 9 22:54:05 CEST 2009


Revision: 44846
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44846&view=rev
Author:   m_kiewitz
Date:     2009-10-09 20:54:02 +0000 (Fri, 09 Oct 2009)

Log Message:
-----------
SCI/newgui: changing SciGuiScreen::dither() for cel-undithering logic

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

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-09 20:21:21 UTC (rev 44845)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-09 20:54:02 UTC (rev 44846)
@@ -498,7 +498,7 @@
 			_priority = pic_priority;
 			// Dithering EGA pictures
 			if (isEGA) {
-				_screen->dither();
+				_screen->dither(_addToFlag);
 			}
 			return;
 		default:

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-09 20:21:21 UTC (rev 44845)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-09 20:54:02 UTC (rev 44846)
@@ -216,7 +216,7 @@
 }
 
 // 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 @@
 			}
 		}
 	} 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 @@
 	_unditherState = flag;
 }
 
+int16 *SciGuiScreen::unditherGetMemorial() {
+	if (_unditherState)
+		return (int16 *)&_unditherMemorial;
+	else
+		return NULL;
+}
+
 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-09 20:21:21 UTC (rev 44845)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-09 20:54:02 UTC (rev 44846)
@@ -39,6 +39,8 @@
 #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 @@
 
 	void setPalette(GuiPalette*pal);
 
-	void dither();
+	void dither(bool addToFlag);
 	void unditherSetState(bool flag);
+	int16 *unditherGetMemorial();
 
 	void debugShowMap(int mapNo);
 
@@ -73,8 +76,6 @@
 
 	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 @@
 	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 @@
 	// 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;


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