[Scummvm-cvs-logs] SF.net SVN: scummvm:[50069] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Jun 20 07:25:34 CEST 2010


Revision: 50069
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50069&view=rev
Author:   dreammaster
Date:     2010-06-20 05:25:34 +0000 (Sun, 20 Jun 2010)

Log Message:
-----------
Added support for the alternate encoding for depth surfaces

Modified Paths:
--------------
    scummvm/trunk/engines/m4/mads_scene.cpp
    scummvm/trunk/engines/m4/mads_scene.h

Modified: scummvm/trunk/engines/m4/mads_scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_scene.cpp	2010-06-19 22:56:58 UTC (rev 50068)
+++ scummvm/trunk/engines/m4/mads_scene.cpp	2010-06-20 05:25:34 UTC (rev 50069)
@@ -650,7 +650,7 @@
 	int resSceneId = stream->readUint16LE();
 	assert(resSceneId == sceneNumber);
 	artFileNum = stream->readUint16LE();
-	drawStyle = stream->readUint16LE();
+	depthStyle = stream->readUint16LE();
 	width = stream->readUint16LE();
 	height = stream->readUint16LE();
 	
@@ -685,16 +685,15 @@
 	if (!surface) {
 		surface = new M4Surface(width, height);
 		ssFlag = true;
-	}
+	} else if ((width != surface->width()) || (height != surface->height()))
+		surface->setSize(width, height);
+
 	int walkSize = gfxSize;
-	if (drawStyle == 2) {
-		width >>= 2;
-		walkSize = width * height;
-	}
 	if (!depthSurface) {
 		depthSurface = new M4Surface(width, height);
 		dsFlag = true;
-	}
+	} else if ((width != depthSurface->width()) || (height != depthSurface->height()))
+		depthSurface->setSize(width, height);
 
 
 	// For Rex Nebular, read in the scene's compressed walk surface information
@@ -708,9 +707,22 @@
 		byte *destP = depthSurface->getBasePtr(0, 0);
 		const byte *srcP = walkData;
 		byte runLength;
+
+		// Run length encoded depth data
 		while ((runLength = *srcP++) != 0) {
-			Common::set_to(destP, destP + runLength, *srcP++);
-			destP += runLength;
+			if (depthStyle == 2) {
+				// 2-bit depth pixels
+				byte byteVal = *srcP++;
+				for (int byteCtr = 0; byteCtr < runLength; ++byteCtr) {
+					byte v = byteVal;
+					for (int bitCtr = 0; bitCtr < 4; ++bitCtr, v >>= 2)
+						*destP++ = v & 3;
+				}
+			} else {
+				// 8-bit depth pixels
+				Common::set_to(destP, destP + runLength, *srcP++);
+				destP += runLength;
+			}
 		}
 
 		free(walkData);

Modified: scummvm/trunk/engines/m4/mads_scene.h
===================================================================
--- scummvm/trunk/engines/m4/mads_scene.h	2010-06-19 22:56:58 UTC (rev 50068)
+++ scummvm/trunk/engines/m4/mads_scene.h	2010-06-20 05:25:34 UTC (rev 50069)
@@ -39,7 +39,7 @@
 public:
 	int sceneId;
 	int artFileNum;
-	int drawStyle;
+	int depthStyle;
 	int width;
 	int height;
 	Common::Array<MadsObject> objects;


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