[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.334,2.335

Max Horn fingolfin at users.sourceforge.net
Sat Sep 25 17:12:20 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4723

Modified Files:
	gfx.cpp 
Log Message:
reorder stuff

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.334
retrieving revision 2.335
diff -u -d -r2.334 -r2.335
--- gfx.cpp	25 Sep 2004 23:14:09 -0000	2.334
+++ gfx.cpp	26 Sep 2004 00:06:51 -0000	2.335
@@ -967,6 +967,15 @@
 	return (VAR_CURRENT_LIGHTS == 0xFF) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
 }
 
+void ScummEngine::setShake(int mode) {
+	if (_shakeEnabled != (mode != 0))
+		_fullRedraw = true;
+
+	_shakeEnabled = mode != 0;
+	_shakeFrame = 0;
+	_system->set_shake_pos(0);
+}
+
 #pragma mark -
 #pragma mark --- Image drawing ---
 #pragma mark -
@@ -1759,83 +1768,158 @@
 	}
 }
 
-/**
- * Create and fill a table with offsets to the graphic and mask strips in the
- * given V2 EGA bitmap.
- * @param src		the V2 EGA bitmap
- * @param width		the width of the bitmap
- * @param height	the height of the bitmap
- * @param table		the strip table to fill
- * @return filled strip table
- */
-StripTable *Gdi::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
+bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess) {
+	assert(numLinesToProcess);
 
-	// If no strip table was given to use, allocate a new one
-	if (table == 0)
-		table = (StripTable *)calloc(1, sizeof(StripTable));
+	byte code = *src++;
+	bool useOrDecompress = false;
+	
+	if (code <= 10) {
+		switch (code) {
+		case 1:
+			unkDecode7(dst, dstPitch, src, numLinesToProcess);
+			break;
+	
+		case 2:
+			unkDecode8(dst, dstPitch, src, numLinesToProcess);       /* Ender - Zak256/Indy256 */
+			break;
+	
+		case 3:
+			unkDecode9(dst, dstPitch, src, numLinesToProcess);       /* Ender - Zak256/Indy256 */
+			break;
+	
+		case 4:
+			unkDecode10(dst, dstPitch, src, numLinesToProcess);      /* Ender - Zak256/Indy256 */
+			break;
+	
+		case 7:
+			unkDecode11(dst, dstPitch, src, numLinesToProcess);      /* Ender - Zak256/Indy256 */
+			break;
+	
+		// 8/9 used in 3do version of puttputt joins the parade maybe others
+		case 8:
+			useOrDecompress = true;
+			drawStrip3DO(dst, dstPitch, src, numLinesToProcess, true);
+			break;
+	
+		case 9:
+			drawStrip3DO(dst, dstPitch, src, numLinesToProcess, false);
+			break;
+	
+		// used in amiga version of Monkey Island
+		case 10:
+			drawStripEGA(dst, dstPitch, src, numLinesToProcess);
+			break;
 
-	const byte *bitmapStart = src;
-	byte color = 0, data = 0;
-	int x, y, length = 0;
-	byte run = 1;
+		default:
+			error("Gdi::decompressBitmap: default case %d", code);
+		}
+	} else {
+		_decomp_shr = code % 10;
+		_decomp_mask = 0xFF >> (8 - _decomp_shr);
+		code /= 10;
+		
+		switch (code) {
+		case 1:
+			// FIXME: Ugly workaround for bug #901462
+			if (_vm->_version == 8)
+				useOrDecompress = true;
+			drawStripBasicV(dst, dstPitch, src, numLinesToProcess, false);
+			break;
+	
+		case 2:
+			drawStripBasicH(dst, dstPitch, src, numLinesToProcess, false);
+			break;
+	
+		case 3:
+			useOrDecompress = true;
+			drawStripBasicV(dst, dstPitch, src, numLinesToProcess, true);
+			break;
+	
+		case 4:
+			useOrDecompress = true;
+			drawStripBasicH(dst, dstPitch, src, numLinesToProcess, true);
+			break;
+	
+		case 6:
+		case 10:
+			// FIXME: Ugly workaround for bug #901462
+			if (_vm->_version == 8 && code == 10)
+				useOrDecompress = true;
+			drawStripComplex(dst, dstPitch, src, numLinesToProcess, false);
+			break;
+	
+		case 8:
+		case 12:
+			useOrDecompress = true;
+			drawStripComplex(dst, dstPitch, src, numLinesToProcess, true);
+			break;
+	
+		case 13:
+			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
+			break;
+	
+		case 14:
+			useOrDecompress = true;
+			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
+			break;
+	
+		default:
+			error("Gdi::decompressBitmap: default case %d", code);
+		}
+	}
+	
+	return useOrDecompress;
+}
 
-	// Decode the graphics strips, and memorize the run/color values
-	// as well as the byte offset.
-	for (x = 0 ; x < width; x++) {
+void Gdi::decompressMaskImg(byte *dst, const byte *src, int height) const {
+	byte b, c;
 
-		if ((x % 8) == 0) {
-			assert(x / 8 < 160);
-			table->run[x / 8] = run;
-			table->color[x / 8] = color;
-			table->offsets[x / 8] = src - bitmapStart;
-		}
+	while (height) {
+		b = *src++;
 
-		for (y = 0; y < height; y++) {
-			if (--run == 0) {
-				data = *src++;
-				if (data & 0x80) {
-					run = data & 0x7f;
-				} else {
-					run = data >> 4;
-				}
-				if (run == 0) {
-					run = *src++;
-				}
-				color = data & 0x0f;
-			}
+		if (b & 0x80) {
+			b &= 0x7F;
+			c = *src++;
+
+			do {
+				*dst = c;
+				dst += _numStrips;
+				--height;
+			} while (--b && height);
+		} else {
+			do {
+				*dst = *src++;
+				dst += _numStrips;
+				--height;
+			} while (--b && height);
 		}
 	}
+}
 
-	// The mask data follows immediately after the graphics.
-	x = 0;
-	y = height;
-	width /= 8;
-	
-	for (;;) {
-		length = *src++;
-		const byte runFlag = length & 0x80;
-		if (runFlag) {
-			length &= 0x7f;
-			data = *src++;
+void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
+	byte b, c;
+
+	while (height) {
+		b = *src++;
+		
+		if (b & 0x80) {
+			b &= 0x7F;
+			c = *src++;
+
+			do {
+				*dst |= c;
+				dst += _numStrips;
+				--height;
+			} while (--b && height);
+		} else {
+			do {
+				*dst |= *src++;
+				dst += _numStrips;
+				--height;
+			} while (--b && height);
 		}
-		do {
-			if (!runFlag)
-				data = *src++;
-			if (y == height) {
-				assert(x < 120);
-				table->zoffsets[x] = src - bitmapStart - 1;
-				table->zrun[x] = length | runFlag;
-			}
-			if (--y == 0) {
-				if (--width == 0)
-					return table;
-				x++;
-				y = height;
-			}
-		} while (--length);
 	}
-
-	return table;
 }
 
 void Gdi::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) {
@@ -1929,6 +2013,85 @@
 	}
 }
 
+/**
+ * Create and fill a table with offsets to the graphic and mask strips in the
+ * given V2 EGA bitmap.
+ * @param src		the V2 EGA bitmap
+ * @param width		the width of the bitmap
+ * @param height	the height of the bitmap
+ * @param table		the strip table to fill
+ * @return filled strip table
+ */
+StripTable *Gdi::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
+
+	// If no strip table was given to use, allocate a new one
+	if (table == 0)
+		table = (StripTable *)calloc(1, sizeof(StripTable));
+
+	const byte *bitmapStart = src;
+	byte color = 0, data = 0;
+	int x, y, length = 0;
+	byte run = 1;
+
+	// Decode the graphics strips, and memorize the run/color values
+	// as well as the byte offset.
+	for (x = 0 ; x < width; x++) {
+
+		if ((x % 8) == 0) {
+			assert(x / 8 < 160);
+			table->run[x / 8] = run;
+			table->color[x / 8] = color;
+			table->offsets[x / 8] = src - bitmapStart;
+		}
+
+		for (y = 0; y < height; y++) {
+			if (--run == 0) {
+				data = *src++;
+				if (data & 0x80) {
+					run = data & 0x7f;
+				} else {
+					run = data >> 4;
+				}
+				if (run == 0) {
+					run = *src++;
+				}
+				color = data & 0x0f;
+			}
+		}
+	}
+
+	// The mask data follows immediately after the graphics.
+	x = 0;
+	y = height;
+	width /= 8;
+	
+	for (;;) {
+		length = *src++;
+		const byte runFlag = length & 0x80;
+		if (runFlag) {
+			length &= 0x7f;
+			data = *src++;
+		}
+		do {
+			if (!runFlag)
+				data = *src++;
+			if (y == height) {
+				assert(x < 120);
+				table->zoffsets[x] = src - bitmapStart - 1;
+				table->zrun[x] = length | runFlag;
+			}
+			if (--y == 0) {
+				if (--width == 0)
+					return table;
+				x++;
+				y = height;
+			}
+		} while (--length);
+	}
+
+	return table;
+}
+
 void Gdi::drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const {
 	byte color = 0;
 	int run = 0, x = 0, y = 0, z;
@@ -1988,160 +2151,6 @@
 	}
 }
 
-bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess) {
-	assert(numLinesToProcess);
-
-	byte code = *src++;
-	bool useOrDecompress = false;
-	
-	if (code <= 10) {
-		switch (code) {
-		case 1:
-			unkDecode7(dst, dstPitch, src, numLinesToProcess);
-			break;
-	
-		case 2:
-			unkDecode8(dst, dstPitch, src, numLinesToProcess);       /* Ender - Zak256/Indy256 */
-			break;
-	
-		case 3:
-			unkDecode9(dst, dstPitch, src, numLinesToProcess);       /* Ender - Zak256/Indy256 */
-			break;
-	
-		case 4:
-			unkDecode10(dst, dstPitch, src, numLinesToProcess);      /* Ender - Zak256/Indy256 */
-			break;
-	
-		case 7:
-			unkDecode11(dst, dstPitch, src, numLinesToProcess);      /* Ender - Zak256/Indy256 */
-			break;
-	
-		// 8/9 used in 3do version of puttputt joins the parade maybe others
-		case 8:
-			useOrDecompress = true;
-			drawStrip3DO(dst, dstPitch, src, numLinesToProcess, true);
-			break;
-	
-		case 9:
-			drawStrip3DO(dst, dstPitch, src, numLinesToProcess, false);
-			break;
-	
-		// used in amiga version of Monkey Island
-		case 10:
-			drawStripEGA(dst, dstPitch, src, numLinesToProcess);
-			break;
-
-		default:
-			error("Gdi::decompressBitmap: default case %d", code);
-		}
-	} else {
-		_decomp_shr = code % 10;
-		_decomp_mask = 0xFF >> (8 - _decomp_shr);
-		code /= 10;
-		
-		switch (code) {
-		case 1:
-			// FIXME: Ugly workaround for bug #901462
-			if (_vm->_version == 8)
-				useOrDecompress = true;
-			drawStripBasicV(dst, dstPitch, src, numLinesToProcess, false);
-			break;
-	
-		case 2:
-			drawStripBasicH(dst, dstPitch, src, numLinesToProcess, false);
-			break;
-	
-		case 3:
-			useOrDecompress = true;
-			drawStripBasicV(dst, dstPitch, src, numLinesToProcess, true);
-			break;
-	
-		case 4:
-			useOrDecompress = true;
-			drawStripBasicH(dst, dstPitch, src, numLinesToProcess, true);
-			break;
-	
-		case 6:
-		case 10:
-			// FIXME: Ugly workaround for bug #901462
-			if (_vm->_version == 8 && code == 10)
-				useOrDecompress = true;
-			drawStripComplex(dst, dstPitch, src, numLinesToProcess, false);
-			break;
-	
-		case 8:
-		case 12:
-			useOrDecompress = true;
-			drawStripComplex(dst, dstPitch, src, numLinesToProcess, true);
-			break;
-	
-		case 13:
-			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
-			break;
-	
-		case 14:
-			useOrDecompress = true;
-			drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
-			break;
-	
-		default:
-			error("Gdi::decompressBitmap: default case %d", code);
-		}
-	}
-	
-	return useOrDecompress;
-}
-
-void Gdi::decompressMaskImg(byte *dst, const byte *src, int height) const {
-	byte b, c;
-
-	while (height) {
-		b = *src++;
-
-		if (b & 0x80) {
-			b &= 0x7F;
-			c = *src++;
-
-			do {
-				*dst = c;
-				dst += _numStrips;
-				--height;
-			} while (--b && height);
-		} else {
-			do {
-				*dst = *src++;
-				dst += _numStrips;
-				--height;
-			} while (--b && height);
-		}
-	}
-}
-
-void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
-	byte b, c;
-
-	while (height) {
-		b = *src++;
-		
-		if (b & 0x80) {
-			b &= 0x7F;
-			c = *src++;
-
-			do {
-				*dst |= c;
-				dst += _numStrips;
-				--height;
-			} while (--b && height);
-		} else {
-			do {
-				*dst |= *src++;
-				dst += _numStrips;
-				--height;
-			} while (--b && height);
-		}
-	}
-}
-
 #define READ_BIT (shift--, dataBit = data & 1, data >>= 1, dataBit)
 #define FILL_BITS do {               \
 		if (shift <= 16) {           \
@@ -2551,10 +2560,10 @@
 	} while (--x);
 }
 
-
 #undef NEXT_ROW
 #undef READ_BIT_256
 
+
 #pragma mark -
 #pragma mark --- Transition effects ---
 #pragma mark -
@@ -2976,15 +2985,6 @@
 	warning("stub unkScreenEffect(%d)", a);
 }
 
-void ScummEngine::setShake(int mode) {
-	if (_shakeEnabled != (mode != 0))
-		_fullRedraw = true;
-
-	_shakeEnabled = mode != 0;
-	_shakeFrame = 0;
-	_system->set_shake_pos(0);
-}
-
 } // End of namespace Scumm
 
 #ifdef __PALM_OS__





More information about the Scummvm-git-logs mailing list