aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2009-03-17 06:57:49 +0000
committerNicola Mettifogo2009-03-17 06:57:49 +0000
commit17d38f27636e4416d6399b36a4a09860e2e9f3ec (patch)
treec02b796dcb6664b6c388c16ff91b8c2ae01a18be /engines/parallaction
parentcb837c3fe030e2a975727f94889e78b2338db8ca (diff)
downloadscummvm-rg350-17d38f27636e4416d6399b36a4a09860e2e9f3ec.tar.gz
scummvm-rg350-17d38f27636e4416d6399b36a4a09860e2e9f3ec.tar.bz2
scummvm-rg350-17d38f27636e4416d6399b36a4a09860e2e9f3ec.zip
Fixed the remaining palette problems by loading the shadow (mask) file for static objects.
svn-id: r39473
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/disk_br.cpp45
1 files changed, 36 insertions, 9 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 3debf6e354..4ef7b5c357 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -500,11 +500,9 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, const char *filename) {
info.palette.setEntry(i, r, g, b);
}
-#if 0
- // The first entry in the palette is overwritten in the original, but I could not
- // find any difference so far.
+ // Overwrite the first color (transparent key) in the palette
info.palette.setEntry(0, pal[0] >> 2, pal[1] >> 2, pal[2] >> 0);
-#endif
+
free(pal);
// background data is drawn used the upper portion of the palette
@@ -561,19 +559,48 @@ void AmigaDisk_br::loadSlide(BackgroundInfo& info, const char *name) {
GfxObj* AmigaDisk_br::loadStatic(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_br::loadStatic '%s'", name);
- Common::SeekableReadStream *stream = openFile("ras/" + Common::String(name), ".ras");
+ Common::String sName = name;
+ Common::SeekableReadStream *stream = openFile("ras/" + sName, ".ras");
byte *pal = 0;
Graphics::Surface* surf = new Graphics::Surface;
Graphics::ILBMDecoder decoder(*stream, *surf, pal);
decoder.decode();
-
- // static pictures are drawn used the upper half of the palette
- adjustForPalette(*surf, 0);
-
free(pal);
delete stream;
+ // NOTE: this assumes that the extension is always present in the file name
+ sName.deleteLastChar();
+ sName.deleteLastChar();
+ sName.deleteLastChar();
+ sName.deleteLastChar();
+ stream = openFile("ras/" + sName + ".ras_shdw");
+
+ if (!stream) {
+ warning("Cannot find shadow file for '%s'\n", name);
+ } else {
+ uint32 shadowWidth = ((surf->w + 15)/8) & ~1;
+ uint32 shadowSize = shadowWidth * surf->h;
+ byte *shadow = new byte[shadowSize];
+ assert(shadow);
+ stream->read(shadow, shadowSize);
+ for (int32 i = 0; i < surf->h; ++i) {
+ byte *src = shadow + shadowWidth * i;
+ byte *dst = (byte*)surf->pixels + surf->pitch * i;
+
+ for (int32 j = 0; j < surf->w; ++j, ++dst) {
+ byte bit = src[j/8] & (1 << (7 - (j & 7)));
+ if (bit == 0) *dst = 0;
+ }
+ }
+
+ delete []shadow;
+ delete stream;
+ }
+
+ // static pictures are drawn used the upper half of the palette
+ adjustForPalette(*surf);
+
return new GfxObj(0, new SurfaceToFrames(surf), name);
}