[Scummvm-cvs-logs] SF.net SVN: scummvm: [26352] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Apr 1 17:41:35 CEST 2007


Revision: 26352
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26352&view=rev
Author:   peres001
Date:     2007-04-01 08:41:34 -0700 (Sun, 01 Apr 2007)

Log Message:
-----------
Fixed loading of graphics. Now things really look what they are, except the character which still looks a bit jagged.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk.cpp
    scummvm/trunk/engines/parallaction/disk.h

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-04-01 15:04:11 UTC (rev 26351)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-04-01 15:41:34 UTC (rev 26352)
@@ -684,50 +684,56 @@
 
 }
 
-// FIXME: unpacking doesn't work
-void AmigaDisk::unpackBitmap(byte *dst, byte *src, uint16 height, uint16 bytesPerPlane) {
+#define NUM_PLANES		5
 
+// FIXME: multi-frames bitmaps looks jagged
+void AmigaDisk::unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 planeSize) {
+
 	byte s0, s1, s2, s3, s4, mask, t0, t1, t2, t3, t4;
 
-	for (uint32 k = 0; k < height; k++) {
-		for (uint32 i = 0; i < bytesPerPlane; i++) {
-			s0 = src[i];
-			s1 = src[i+bytesPerPlane];
-			s2 = src[i+bytesPerPlane*2];
-			s3 = src[i+bytesPerPlane*3];
-			s4 = src[i+bytesPerPlane*4];
+	for (uint32 i = 0; i < numFrames; i++) {
+		for (uint32 j = 0; j < planeSize; j++) {
+			s0 = src[j];
+			s1 = src[j+planeSize];
+			s2 = src[j+planeSize*2];
+			s3 = src[j+planeSize*3];
+			s4 = src[j+planeSize*4];
 
-			for (uint32 j = 0; j < 8; j++) {
-				mask = 1 << (7 - j);
-				t0 = (s0 & mask ? 1 : 0);
-				t1 = (s1 & mask ? 1 : 0);
-				t2 = (s2 & mask ? 1 : 0);
-				t3 = (s3 & mask ? 1 : 0);
-				t4 = (s4 & mask ? 1 : 0);
-				*dst++ = t0 + (t1 << 1) + (t2 << 2) + (t3 << 3) + (t4 << 4);
+			for (uint32 k = 0; k < 8; k++) {
+				mask = 1 << (7 - k);
+				t0 = (s0 & mask ? 1 << 0 : 0);
+				t1 = (s1 & mask ? 1 << 1 : 0);
+				t2 = (s2 & mask ? 1 << 2 : 0);
+				t3 = (s3 & mask ? 1 << 3 : 0);
+				t4 = (s4 & mask ? 1 << 4 : 0);
+				*dst++ = t0 | t1 | t2 | t3 | t4;
 			}
+
 		}
+
+		src += planeSize * NUM_PLANES;
 	}
-
 }
 
 StaticCnv* AmigaDisk::makeStaticCnv(Common::SeekableReadStream &stream) {
-#define NUM_PLANES		5
 
+
 	uint16 numFrames = stream.readByte();
 	uint16 width = stream.readByte();
 	uint16 height = stream.readByte();
 
 	assert(numFrames == 1 && (width & 7) == 0);
 
-	uint32 rawsize = (width * height * NUM_PLANES) / 8;
+	byte bytesPerPlane = width / 8;
+
+	uint32 rawsize = bytesPerPlane * NUM_PLANES * height;
 	byte *buf = (byte*)malloc(rawsize);
 	stream.read(buf, rawsize);
 
 	uint32 decsize = width * height;
 	byte *data = (byte*)calloc(decsize, 1);
 
-	unpackBitmap(data, buf, height, width / 8);
+	unpackBitmap(data, buf, 1, height * bytesPerPlane);
 
 	free(buf);
 
@@ -738,11 +744,9 @@
 	cnv->_data1 = NULL;
 
 	return cnv;
-#undef NUM_PLANES
 }
 
 Cnv* AmigaDisk::makeCnv(Common::SeekableReadStream &stream) {
-#define NUM_PLANES		5
 
 	uint16 numFrames = stream.readByte();
 	uint16 width = stream.readByte();
@@ -750,22 +754,23 @@
 
 	assert((width & 7) == 0);
 
-	uint32 rawsize = (numFrames * width * height * NUM_PLANES) / 8;
+	byte bytesPerPlane = width / 8;
+
+	uint32 rawsize = numFrames * bytesPerPlane * NUM_PLANES * height;
 	byte *buf = (byte*)malloc(rawsize);
 	stream.read(buf, rawsize);
 
 	uint32 decsize = numFrames * width * height;
 	byte *data = (byte*)calloc(decsize, 1);
 
-	unpackBitmap(data, buf, height, width / 8);
+	unpackBitmap(data, buf, numFrames, height * bytesPerPlane);
 
 	free(buf);
 
 	return new Cnv(numFrames, width, height, data);
+}
 #undef NUM_PLANES
-}
 
-
 Script* AmigaDisk::loadLocation(const char *name) {
 	debugC(1, kDebugDisk, "AmigaDisk::loadLocation '%s'", name);
 

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-04-01 15:04:11 UTC (rev 26351)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-04-01 15:41:34 UTC (rev 26352)
@@ -145,7 +145,7 @@
 protected:
 	Cnv* makeCnv(Common::SeekableReadStream &stream);
 	StaticCnv* makeStaticCnv(Common::SeekableReadStream &stream);
-	void unpackBitmap(byte *dst, byte *src, uint16 height, uint16 bytesPerPlane);
+	void unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 planeSize);
 
 public:
 	AmigaDisk(Parallaction *vm);


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