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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Mar 16 10:11:52 CET 2009


Revision: 39441
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39441&view=rev
Author:   peres001
Date:     2009-03-16 09:11:51 +0000 (Mon, 16 Mar 2009)

Log Message:
-----------
Fixed most palette issues in BRA Amiga.

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

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2009-03-16 07:45:47 UTC (rev 39440)
+++ scummvm/trunk/engines/parallaction/disk.h	2009-03-16 09:11:51 UTC (rev 39441)
@@ -253,6 +253,8 @@
 	Sprites*	createSprites(Common::ReadStream &stream);
 	Font *createFont(const char *name, Common::SeekableReadStream &stream);
 	void loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream);
+	void adjustForPalette(Graphics::Surface &surf, int move);
+
 public:
 	AmigaDisk_br(Parallaction *vm);
 

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-16 07:45:47 UTC (rev 39440)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-16 09:11:51 UTC (rev 39441)
@@ -31,6 +31,7 @@
 
 namespace Parallaction {
 
+extern byte _braAmigaFramesDefaultPalette[];
 
 struct Sprite {
 	uint16	size;
@@ -440,6 +441,14 @@
 		_sset.add(subDirNames[i], _baseDir->getSubDirectory(subDirPrefixes[i], subDirNames[i], 2), 6);
 }
 
+void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int move) {
+	uint size = surf.w * surf.h;
+	byte *data = (byte*)surf.pixels;
+	for (uint i = 0; i < size; i++, data++) {
+		*data += move;
+	}
+}
+
 void AmigaDisk_br::loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream) {
 
 	byte *pal;
@@ -447,25 +456,47 @@
 	Graphics::ILBMDecoder decoder(stream, info.bg, pal);
 	decoder.decode();
 
-	uint i;
+	int i;
 
 	info.width = info.bg.w;
 	info.height = info.bg.h;
 
-	byte *p = pal;
+	/* TODO: support loading of additional palette (*.ap files), for locations which
+	   have them. If an additional palette is present then it is used in place of
+	   _braAmigaFramesDefaultPalette.
+	*/
+	byte r,g,b;
+	byte *p = _braAmigaFramesDefaultPalette;
 	for (i = 0; i < 16; i++) {
-		byte r = *p >> 2;
+		r = *p >> 2;
 		p++;
-		byte g = *p >> 2;
+		g = *p >> 2;
 		p++;
-		byte b = *p >> 2;
+		b = *p >> 2;
 		p++;
 		info.palette.setEntry(i, r, g, b);
 	}
 
+	p = pal;
+	for (i = 16; i < 32; i++) {
+		r = *p >> 2;
+		p++;
+		g = *p >> 2;
+		p++;
+		b = *p >> 2;
+		p++;
+		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.
+	info.palette.setEntry(0, pal[0] >> 2, pal[1] >> 2, pal[2] >> 0);
+#endif
 	free(pal);
 
-	return;
+	// background data is drawn used the upper portion of the palette
+	adjustForPalette(info.bg, 16);
 }
 
 
@@ -528,10 +559,12 @@
 
 	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, 16);
+
 	free(pal);
 	delete stream;
 

Modified: scummvm/trunk/engines/parallaction/staticres.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/staticres.cpp	2009-03-16 07:45:47 UTC (rev 39440)
+++ scummvm/trunk/engines/parallaction/staticres.cpp	2009-03-16 09:11:51 UTC (rev 39441)
@@ -49,7 +49,10 @@
 };
 
 /* TODO: Scale this bitmap. Its 32x16, but the original scales it twice horizontally and 6 times
-   vertically (64x96)
+   vertically (64x96).
+
+   TODO: The cursor data should be adjusted by adding 0x10 to each byte, because the bitmap
+   must be drawn using the background palette.
 */
 byte Input::_resMouseArrow_BR_Amiga[512] =
 {
@@ -87,6 +90,16 @@
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 
+/*
+	This palette snippet is used for animations in Big Red Adventure.
+*/
+byte _braAmigaFramesDefaultPalette[48] = {
+    0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0xFF, 0xE0, 0xCF, 0x7F, 0x7F, 0x7F, 0xD9, 0x9C, 0x84, 0x00,
+    0x9E, 0xF0, 0x91, 0xCC, 0x36, 0xFF, 0x6A, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0x11, 0xB0, 0xEE,
+    0xF0, 0xFF, 0x17, 0x3D, 0x18, 0xAC, 0x3A, 0xB0, 0x00, 0x00, 0x7D, 0x00, 0x00, 0xFF, 0xA8, 0xFF,
+};
+
+
 byte _amigaTopazFont[2600] = {
   0x00, 0x00, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x79, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x02, 0x79,


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