aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2008-02-06 13:57:44 +0000
committerNicola Mettifogo2008-02-06 13:57:44 +0000
commit715e33d63d62dc02dd37c7db9bfb92d5cb323b0c (patch)
treeda8be6212a479932865b89a222e419342a639f65 /engines/parallaction
parent782563f7492fd65cbc81b3f1bbc13cddd3c04480 (diff)
downloadscummvm-rg350-715e33d63d62dc02dd37c7db9bfb92d5cb323b0c.tar.gz
scummvm-rg350-715e33d63d62dc02dd37c7db9bfb92d5cb323b0c.tar.bz2
scummvm-rg350-715e33d63d62dc02dd37c7db9bfb92d5cb323b0c.zip
Correctly implemented little-endian masks in BRA.
svn-id: r30807
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/disk_br.cpp1
-rw-r--r--engines/parallaction/disk_ns.cpp2
-rw-r--r--engines/parallaction/graphics.h13
3 files changed, 13 insertions, 3 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 57ea999871..ad24b94c9f 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -345,6 +345,7 @@ void DosDisk_br::loadScenery(BackgroundInfo& info, const char *name, const char
// 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();
}
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index b0b1232a37..9da299dce1 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -568,6 +568,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) {
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 @@ void DosDisk_ns::loadMaskAndPath(BackgroundInfo& info, const char *name) {
_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;
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index ce4cca0d1a..3eb8f88a01 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -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 @@ struct MaskBuffer {
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 @@ public:
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;
}
};