diff options
| author | md5 | 2011-03-10 18:05:59 +0200 | 
|---|---|---|
| committer | md5 | 2011-03-10 18:05:59 +0200 | 
| commit | 91d2d04f90d020ab9a4eee9b16c0f95dcd6737bd (patch) | |
| tree | a6ca849d4ba395fe4094ab8850ef9d0cf3410e88 | |
| parent | ff9653ddea2d5eb959085edb916e13908fd41aa8 (diff) | |
| download | scummvm-rg350-91d2d04f90d020ab9a4eee9b16c0f95dcd6737bd.tar.gz scummvm-rg350-91d2d04f90d020ab9a4eee9b16c0f95dcd6737bd.tar.bz2 scummvm-rg350-91d2d04f90d020ab9a4eee9b16c0f95dcd6737bd.zip  | |
SCI: Some renaming related to the undithering code
Renamed some variables, functions and comments related to the
undithering code, to make them a bit easier to understand
| -rw-r--r-- | engines/sci/graphics/picture.cpp | 2 | ||||
| -rw-r--r-- | engines/sci/graphics/screen.cpp | 13 | ||||
| -rw-r--r-- | engines/sci/graphics/screen.h | 10 | ||||
| -rw-r--r-- | engines/sci/graphics/view.cpp | 22 | 
4 files changed, 24 insertions, 23 deletions
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index e60a62e423..38742b2510 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -759,7 +759,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {  				case GID_SQ3:  					switch (_resourceId) {  					case 154: // SQ3: intro, ship gets sucked in -						_screen->ditherForceMemorial(0xD0); +						_screen->ditherForceDitheredColor(0xD0);  						break;  					default:  						break; diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 757fdc53c7..48f0cc241b 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -583,7 +583,7 @@ void GfxScreen::dither(bool addToFlag) {  		}  	} else {  		if (!addToFlag) -			memset(&_unditherMemorial, 0, sizeof(_unditherMemorial)); +			memset(&_ditheredPicColors, 0, sizeof(_ditheredPicColors));  		// 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++) { @@ -591,7 +591,7 @@ void GfxScreen::dither(bool addToFlag) {  				if (color & 0xF0) {  					color ^= color << 4;  					// remember dither combination for cel-undithering -					_unditherMemorial[color]++; +					_ditheredPicColors[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) { @@ -618,18 +618,17 @@ void GfxScreen::dither(bool addToFlag) {  	}  } -// Force a color combination into memorial -void GfxScreen::ditherForceMemorial(byte color) { -	_unditherMemorial[color] = 256; +void GfxScreen::ditherForceDitheredColor(byte color) { +	_ditheredPicColors[color] = 256;  }  void GfxScreen::debugUnditherSetState(bool flag) {  	_unditherState = flag;  } -int16 *GfxScreen::unditherGetMemorial() { +int16 *GfxScreen::unditherGetDitheredBgColors() {  	if (_unditherState) -		return (int16 *)&_unditherMemorial; +		return (int16 *)&_ditheredPicColors;  	else  		return NULL;  } diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 6f9b08deff..0bb15eddf3 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -51,7 +51,7 @@ enum GfxScreenMasks {  };  enum { -	SCI_SCREEN_UNDITHERMEMORIAL_SIZE = 256 +	DITHERED_BG_COLORS_SIZE = 256  };  /** @@ -112,9 +112,11 @@ public:  	void adjustBackUpscaledCoordinates(int16 &y, int16 &x);  	void dither(bool addToFlag); -	void ditherForceMemorial(byte color); + +	// Force a color combination as a dithered color +	void ditherForceDitheredColor(byte color);  	void debugUnditherSetState(bool flag); -	int16 *unditherGetMemorial(); +	int16 *unditherGetDitheredBgColors();  	void debugShowMap(int mapNo); @@ -146,7 +148,7 @@ private:  	void setVerticalShakePos(uint16 shakePos);  	bool _unditherState; -	int16 _unditherMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE]; +	int16 _ditheredPicColors[DITHERED_BG_COLORS_SIZE];  	// These screens have the real resolution of the game engine (320x200 for  	// SCI0/SCI1/SCI11 games, 640x480 for SCI2 games). SCI0 games will be diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index b99861319a..e637159174 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -586,11 +586,11 @@ const byte *GfxView::getBitmap(int16 loopNo, int16 celNo) {   * cel if the dithering in here matches dithering used by the current picture.   */  void GfxView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clearKey) { -	int16 *unditherMemorial = _screen->unditherGetMemorial(); +	int16 *ditheredPicColors = _screen->unditherGetDitheredBgColors(); -	// It makes no sense to go further, if no memorial data from current picture -	// is available -	if (!unditherMemorial) +	// It makes no sense to go further, if there isn't any dithered color data +	// available for the current picture +	if (!ditheredPicColors)  		return;  	// Makes no sense to process bitmaps that are 3 pixels wide or less @@ -606,13 +606,13 @@ void GfxView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte cl  		return;  	// Walk through the bitmap and remember all combinations of colors -	int16 bitmapMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE]; +	int16 ditheredBitmapColors[DITHERED_BG_COLORS_SIZE];  	byte *curPtr;  	byte color1, color2;  	byte nextColor1, nextColor2;  	int16 y, x; -	memset(&bitmapMemorial, 0, sizeof(bitmapMemorial)); +	memset(&ditheredBitmapColors, 0, sizeof(ditheredBitmapColors));  	// Count all seemingly dithered pixel-combinations as soon as at least 4  	// pixels are adjacent and check pixels in the following line as well to @@ -631,17 +631,17 @@ void GfxView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte cl  			nextColor1 = (nextColor1 >> 4) | (nextColor2 << 4);  			nextColor2 = (nextColor2 >> 4) | *nextPtr++ << 4;  			if ((color1 == color2) && (color1 == nextColor1) && (color1 == nextColor2)) -				bitmapMemorial[color1]++; +				ditheredBitmapColors[color1]++;  		}  	} -	// Now compare both memorial tables to find out matching -	// dithering-combinations -	bool unditherTable[SCI_SCREEN_UNDITHERMEMORIAL_SIZE]; +	// Now compare both dither color tables to find out matching dithered color +	// combinations +	bool unditherTable[DITHERED_BG_COLORS_SIZE];  	byte color, unditherCount = 0;  	memset(&unditherTable, false, sizeof(unditherTable));  	for (color = 0; color < 255; color++) { -		if ((bitmapMemorial[color] > 5) && (unditherMemorial[color] > 200)) { +		if ((ditheredBitmapColors[color] > 5) && (ditheredPicColors[color] > 200)) {  			// match found, check if colorKey is contained -> if so, we ignore  			// of course  			color1 = color & 0x0F; color2 = color >> 4;  | 
