[Scummvm-cvs-logs] CVS: scummex image.cpp,1.26,1.27 image.h,1.13,1.14

Eugene Sandulenko sev at users.sourceforge.net
Tue Jun 22 18:49:05 CEST 2004


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

Modified Files:
	image.cpp image.h 
Log Message:
Added 3DO and HE graphics decoders.


Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- image.cpp	14 Feb 2004 20:51:10 -0000	1.26
+++ image.cpp	23 Jun 2004 01:48:12 -0000	1.27
@@ -557,6 +557,15 @@
 			unkDecode11(dst, src, numLinesToProcess);
 			break;
 
+		// 8/9 used in 3do version of puttputt joins the parade maybe others
+		case 8:
+			decodeStrip3DO(dst, src, numLinesToProcess, true);
+			break;
+
+		case 9:
+			decodeStrip3DO(dst, src, numLinesToProcess, false);
+			break;
+
 		case 10:
 			decodeStripEGA(dst, src, numLinesToProcess);
 			break;
@@ -610,6 +619,22 @@
 			unkDecodeA(dst, src, numLinesToProcess);
 			break;
 		
+		case 134:
+		case 135:
+		case 136:
+		case 137:
+		case 138:
+			decodeStripHE(dst, src, numLinesToProcess);
+			break;
+
+		case 144:
+		case 145:
+		case 146:
+		case 147:
+		case 148:
+			decodeStripHE(dst, src, numLinesToProcess);
+			break;
+
 		default:
 			printf("Unknown codec: %d!\n", code);
 	}
@@ -855,6 +880,123 @@
 	} while (--x);
 }
 
+void Image::decodeStrip3DO(byte *dst, const byte *src, int height, byte transpCheck) {
+	int destbytes, olddestbytes2, olddestbytes1;
+	byte color;
+	int data;
+
+	olddestbytes1 = 0;
+
+	destbytes = height << 3;
+
+	if (!height)
+		return;
+
+	do {
+		data = *src;
+		src++;
+
+		if (!(data & 1)) {
+			data >>= 1;
+			data++;
+			destbytes -= data;
+			if (destbytes < 0)
+				data += destbytes;
+
+			olddestbytes2 = destbytes;
+			destbytes = olddestbytes1;
+
+			for (; data > 0; data--, src++, dst++) {
+				//if (*src != _transparentColor || !transpCheck)
+					*dst = *src;
+			
+				destbytes++;
+				if (!(destbytes & 7))
+					dst += 312;
+			}
+
+			olddestbytes1 = destbytes;
+			if (olddestbytes2 > 0) {
+				destbytes = olddestbytes2;
+			}
+		} else {
+			data >>= 1;
+			color = *src;
+			src++;
+
+			data++;
+			destbytes -= data;
+			if (destbytes < 0)
+				data += destbytes;
+
+			olddestbytes2 = destbytes;
+			destbytes = olddestbytes1;
+
+			for (; data > 0; data--, dst++) {
+				//if (color != _transparentColor || !transpCheck)
+					*dst = color;
+				destbytes++;
+				if (!(destbytes & 7))
+					dst += 312;
+			}
+			olddestbytes1 = destbytes;
+			if (olddestbytes2 > 0) {
+				destbytes = olddestbytes2;
+			}
+		}
+	} while (olddestbytes2 > 0);
+}
+
+
+void Image::decodeStripHE(byte *dst, const byte *src, int height) {
+	uint32 color, dataBit, data, shift, iteration;
+
+     color = *src;
+	 src++;
+	 data = src[2] << 16 + src[1] << 8 + src[0];
+	 src += 3;
+     shift = 24;
+
+	 while (height) {
+		 for (iteration = 0; iteration < 8; iteration++) {
+			 *dst = color;
+			 dst++;
+			 if (shift <= 16) {
+				 data |= *src << shift;
+				 src++;
+				 shift += 8;
+				 data |= *src << shift;
+				 src++;
+				 shift += 8;
+			 }
+			 
+			 dataBit = data & 1;
+			 shift--;
+			 data >>= 1;
+			 if (dataBit) {
+				 dataBit = data & 1;
+				 shift--;
+				 data >>= 1;
+				 if (!dataBit) {
+					 color = _decomp_mask & data;
+					 shift -= _decomp_shr;
+					 data >>= _decomp_shr;
+				 } else {
+					 dataBit = data & 7;
+					 shift -= 3;
+					 data >>= 3;
+					 if (dataBit >= 4)
+						 color += dataBit - 3;
+					 else
+						 color += dataBit - 4;
+				 }
+			 }
+		 }
+		 dst += 312;
+		 height--;
+	 }
+}
+
 #undef READ_BIT
 #undef FILL_BITS
 

Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- image.h	27 Sep 2003 14:56:11 -0000	1.13
+++ image.h	23 Jun 2004 01:48:12 -0000	1.14
@@ -72,6 +72,8 @@
 	void unkDecode9(byte *dst, const byte *src, int height);
 	void unkDecode10(byte *dst, const byte *src, int height);
 	void unkDecode11(byte *dst, const byte *src, int height);
+	void decodeStrip3DO(byte *dst, const byte *src, int height, byte transpCheck);
+	void decodeStripHE(byte *dst, const byte *src, int height);
 
 public:
 	Image();





More information about the Scummvm-git-logs mailing list