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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Feb 6 14:57:44 CET 2008


Revision: 30807
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30807&view=rev
Author:   peres001
Date:     2008-02-06 05:57:44 -0800 (Wed, 06 Feb 2008)

Log Message:
-----------
Correctly implemented little-endian masks in BRA.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk_br.cpp
    scummvm/trunk/engines/parallaction/disk_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-06 13:44:31 UTC (rev 30806)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-06 13:57:44 UTC (rev 30807)
@@ -345,6 +345,7 @@
 		// NOTE: info.width and info.height are only valid if the background graphics
 		// have already been loaded
 		info.mask.create(info.width, info.height);
+		info.mask.bigEndian = false;
 		stream.read(info.mask.data, info.mask.size);
 		stream.close();
 	}

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-02-06 13:44:31 UTC (rev 30806)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-02-06 13:57:44 UTC (rev 30807)
@@ -568,6 +568,7 @@
 
 	info.bg.create(info.width, info.height, 1);
 	info.mask.create(info.width, info.height);
+	info.mask.bigEndian = true;
 	info.path.create(info.width, info.height);
 
 	Graphics::PackBitsReadStream stream(_resArchive);
@@ -595,6 +596,7 @@
 	_resArchive.read(info.path.data, info.path.size);
 
 	info.mask.create(info.width, info.height);
+	info.mask.bigEndian = true;
 	_resArchive.read(info.mask.data, info.mask.size);
 
 	return;

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-02-06 13:44:31 UTC (rev 30806)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-02-06 13:57:44 UTC (rev 30807)
@@ -27,6 +27,7 @@
 #define PARALLACTION_GRAPHICS_H
 
 #include "common/rect.h"
+#include "common/hash-str.h"
 #include "common/stream.h"
 
 #include "graphics/surface.h"
@@ -174,9 +175,10 @@
 	uint16	h;
 	uint	size;
 	byte	*data;
+	bool	bigEndian;
 
 public:
-	MaskBuffer() : w(0), internalWidth(0), h(0), size(0), data(0) {
+	MaskBuffer() : w(0), internalWidth(0), h(0), size(0), data(0), bigEndian(true) {
 	}
 
 	void create(uint16 width, uint16 height) {
@@ -198,8 +200,13 @@
 
 	inline byte getValue(uint16 x, uint16 y) {
 		byte m = data[(x >> 2) + y * internalWidth];
-		uint n = (x & 3) << 1;
-		return ((3 << n) & m) >> n;
+		uint n;
+		if (bigEndian) {
+			n = (x & 3) << 1;
+		} else {
+			n = (3 - (x & 3)) << 1;
+		}
+		return (m >> n) & 3;
 	}
 
 };


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