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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Mar 17 07:57:49 CET 2009


Revision: 39473
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39473&view=rev
Author:   peres001
Date:     2009-03-17 06:57:49 +0000 (Tue, 17 Mar 2009)

Log Message:
-----------
Fixed the remaining palette problems by loading the shadow (mask) file for static objects.

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

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-17 05:29:59 UTC (rev 39472)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-17 06:57:49 UTC (rev 39473)
@@ -500,11 +500,9 @@
 		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 @@
 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();
+	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, 0);
+	adjustForPalette(*surf);
 
-	free(pal);
-	delete stream;
-
 	return new GfxObj(0, new SurfaceToFrames(surf), name);
 }
 


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