[Scummvm-cvs-logs] CVS: scummvm/scumm palette.cpp,2.55,2.56 saveload.cpp,1.252,1.253 saveload.h,1.70,1.71 scumm.h,1.653,1.654

Gregory Montoir cyx at users.sourceforge.net
Mon Oct 31 18:44:56 CET 2005


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

Modified Files:
	palette.cpp saveload.cpp saveload.h scumm.h 
Log Message:
in v7/v8, remapPaletteColor() ignores color 255
in v7, remapPaletteColor() ignores colors setup by initCycle()

Index: palette.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/palette.cpp,v
retrieving revision 2.55
retrieving revision 2.56
diff -u -d -r2.55 -r2.56
--- palette.cpp	18 Oct 2005 01:30:21 -0000	2.55
+++ palette.cpp	1 Nov 2005 02:43:54 -0000	2.56
@@ -306,6 +306,7 @@
 			cycl->end = end;
 		}
 	} else {
+		memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
 		while ((j = *ptr++) != 0) {
 			if (j < 1 || j > 16) {
 				error("Invalid color cycle index %d", j);
@@ -320,6 +321,10 @@
 			ptr += 2;
 			cycl->start = *ptr++;
 			cycl->end = *ptr++;
+
+			for (int i = cycl->start; i <= cycl->end; ++i) {
+				_colorUsedByCycle[i] = 1;
+			}
 		}
 	}
 }
@@ -787,7 +792,10 @@
 	g &= ~3;
 	b &= ~3;
 
-	for (i = startColor; i < 256; i++, pal += 3) {
+	for (i = startColor; i < 255; i++, pal += 3) {
+		if (_version == 7 && _colorUsedByCycle[i])
+			continue;
+
 		ar = pal[0] & ~3;
 		ag = pal[1] & ~3;
 		ab = pal[2] & ~3;

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -d -r1.252 -r1.253
--- saveload.cpp	23 Oct 2005 19:29:23 -0000	1.252
+++ saveload.cpp	1 Nov 2005 02:43:54 -0000	1.253
@@ -759,6 +759,7 @@
 		MKLINE(ScummEngine, _mouse.x, sleInt16, VER(20)),
 		MKLINE(ScummEngine, _mouse.y, sleInt16, VER(20)),
 
+		MKARRAY(ScummEngine, _colorUsedByCycle[0], sleByte, 256, VER(60)),
 		MKLINE(ScummEngine, _doEffect, sleByte, VER(8)),
 		MKLINE(ScummEngine, _switchRoomEffect, sleByte, VER(8)),
 		MKLINE(ScummEngine, _newEffect, sleByte, VER(8)),
@@ -1094,6 +1095,10 @@
 		memcpy(_darkenPalette, _currentPalette, 768);
 	}
 
+	// _colorUsedByCycle was not saved before V60
+	if (s->isLoading() && s->getVersion() < VER(60)) {
+		memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
+	}
 
 	//
 	// Save/load more global object state

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- saveload.h	22 Oct 2005 23:42:12 -0000	1.70
+++ saveload.h	1 Nov 2005 02:43:54 -0000	1.71
@@ -45,7 +45,7 @@
  * only saves/loads those which are valid for the version of the savegame
  * which is being loaded/saved currently.
  */
-#define CURRENT_VER 59
+#define CURRENT_VER 60
 
 /**
  * An auxillary macro, used to specify savegame versions. We use this instead

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.653
retrieving revision 1.654
diff -u -d -r1.653 -r1.654
--- scumm.h	28 Oct 2005 11:41:07 -0000	1.653
+++ scumm.h	1 Nov 2005 02:43:54 -0000	1.654
@@ -916,6 +916,7 @@
 
 protected:
 	ColorCycle _colorCycle[16];	// Palette cycles
+	uint8 _colorUsedByCycle[256];
 
 	uint32 _ENCD_offs, _EXCD_offs;
 	uint32 _CLUT_offs, _EPAL_offs;





More information about the Scummvm-git-logs mailing list