[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.469,2.470 gfx.h,1.121,1.122

kirben kirben at users.sourceforge.net
Sun Sep 18 17:31:07 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9476/scumm

Modified Files:
	gfx.cpp gfx.h 
Log Message:

Switch back to using _paletteMod for the palette adjustment in 32 color Amiga games, since overflow is required for the correct palette (ie 256 should overflow to 0).

Fixes the palette regression, bug #1294513


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.469
retrieving revision 2.470
diff -u -d -r2.469 -r2.470
--- gfx.cpp	3 Sep 2005 18:27:59 -0000	2.469
+++ gfx.cpp	19 Sep 2005 00:29:40 -0000	2.470
@@ -193,10 +193,9 @@
 Gdi::Gdi(ScummEngine *vm) {
 	memset(this, 0, sizeof(*this));
 	_vm = vm;
+	_paletteMod = 0;
 	_roomPalette = vm->_roomPalette;
 	_roomStrips = 0;
-	if ((vm->_platform == Common::kPlatformAmiga) && (vm->_version >= 4))
-		_roomPalette += 16;
 }
 
 Gdi::~Gdi() {
@@ -1796,6 +1795,11 @@
 	byte code = *src++;
 	bool useOrDecompress = false;
 	
+	if ((_vm->_platform == Common::kPlatformAmiga) && (_vm->_version >= 4))
+		_paletteMod = 16;
+	else
+		_paletteMod = 0;
+
 	if (code <= 10) {
 		switch (code) {
 		case 1:
@@ -2426,7 +2430,7 @@
 					run = *src++;
 				}
 				for (z = 0; z < run; z++) {
-					*(dst + y * dstPitch + x) = (z & 1) ? _roomPalette[color & 0xf] : _roomPalette[color >> 4];
+					*(dst + y * dstPitch + x) = (z & 1) ? _roomPalette[color & 0xf] + _paletteMod : _roomPalette[color >> 4] + _paletteMod;
 
 					y++;
 					if (y >= height) {
@@ -2440,7 +2444,7 @@
 				}
 
 				for (z = 0; z < run; z++) {
-					*(dst + y * dstPitch + x) = *(dst + y * dstPitch + x - 1);
+					*(dst + y * dstPitch + x) = *(dst + y * dstPitch + x - 1) + _paletteMod;
 
 					y++;
 					if (y >= height) {
@@ -2456,7 +2460,7 @@
 			}
 			
 			for (z = 0; z < run; z++) {
-				*(dst + y * dstPitch + x) = _roomPalette[color & 0xf];
+				*(dst + y * dstPitch + x) = _roomPalette[color & 0xf] + _paletteMod;
 
 				y++;
 				if (y >= height) {
@@ -2580,7 +2584,7 @@
 		do {
 			FILL_BITS;
 			if (!transpCheck || color != _transparentColor)
-				*dst = _roomPalette[color];
+				*dst = _roomPalette[color] + _paletteMod;
 			dst++;
 
 		againPos:
@@ -2607,7 +2611,7 @@
 								return;
 						}
 						if (!transpCheck || color != _transparentColor)
-							*dst = _roomPalette[color];
+							*dst = _roomPalette[color] + _paletteMod;
 						dst++;
 					} while (--reps);
 					bits >>= 8;
@@ -2632,7 +2636,7 @@
 		do {
 			FILL_BITS;
 			if (!transpCheck || color != _transparentColor)
-				*dst = _roomPalette[color];
+				*dst = _roomPalette[color] + _paletteMod;
 			dst++;
 			if (!READ_BIT) {
 			} else if (!READ_BIT) {
@@ -2665,7 +2669,7 @@
 		do {
 			FILL_BITS;
 			if (!transpCheck || color != _transparentColor)
-				*dst = _roomPalette[color];
+				*dst = _roomPalette[color] + _paletteMod;
 			dst += dstPitch;
 			if (!READ_BIT) {
 			} else if (!READ_BIT) {

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- gfx.h	30 Jul 2005 21:11:25 -0000	1.121
+++ gfx.h	19 Sep 2005 00:29:41 -0000	1.122
@@ -204,6 +204,7 @@
 	~Gdi();
 
 protected:
+	byte _paletteMod;
 	byte *_roomPalette;
 	byte _transparentColor;
 	byte _decomp_shr, _decomp_mask;





More information about the Scummvm-git-logs mailing list