[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.235,2.236 intern.h,2.121,2.122 script_v5.cpp,1.211,1.212 scumm.h,1.333,1.334

Max Horn fingolfin at users.sourceforge.net
Wed Dec 17 09:15:15 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv24991

Modified Files:
	gfx.cpp intern.h script_v5.cpp scumm.h 
Log Message:
Patch #861716: palManipulateInit for V6 games (I modified the patch a bit)

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.235
retrieving revision 2.236
diff -u -d -r2.235 -r2.236
--- gfx.cpp	15 Dec 2003 14:54:35 -0000	2.235
+++ gfx.cpp	17 Dec 2003 17:12:09 -0000	2.236
@@ -25,6 +25,7 @@
 #include "scumm/actor.h"
 #include "scumm/bomp.h"
 #include "scumm/charset.h"
+#include "scumm/intern.h"
 #include "scumm/resource.h"
 #include "scumm/usage_bits.h"
 
@@ -2870,23 +2871,23 @@
 	doCyclePalette(_palManipIntermediatePal, start, end, 6, !direction);
 }
 
-void ScummEngine::palManipulateInit(int start, int end, int string_id, int time) {
+void ScummEngine::palManipulateInit(int resID, int start, int end, int time) {
 	byte *pal, *target, *between;
 	byte *string1, *string2, *string3;
 	int i;
 
-	string1 = getStringAddress(string_id);
-	string2 = getStringAddress(string_id + 1);
-	string3 = getStringAddress(string_id + 2);
+	string1 = getStringAddress(resID);
+	string2 = getStringAddress(resID + 1);
+	string3 = getStringAddress(resID + 2);
 	if (!string1 || !string2 || !string3) {
 		warning("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d",
-				start, end, string_id, time, string_id, string_id + 1, string_id + 2);
+				resID, start, end, time, resID, resID + 1, resID + 2);
 		return;
 	}
 
-	string1+=start;
-	string2+=start;
-	string3+=start;
+	string1 += start;
+	string2 += start;
+	string3 += start;
 
 	_palManipStart = start;
 	_palManipEnd = end;
@@ -2916,6 +2917,44 @@
 	_palManipCounter = time;
 }
 
+void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) {
+	byte *pal, *target, *between;
+	const byte *new_pal;
+	int i;
+
+	new_pal = getPalettePtr(resID);
+
+	new_pal += start*3;
+
+	_palManipStart = start;
+	_palManipEnd = end;
+	_palManipCounter = 0;
+
+	if (!_palManipPalette)
+		_palManipPalette = (byte *)calloc(0x300, 1);
+	if (!_palManipIntermediatePal)
+		_palManipIntermediatePal = (byte *)calloc(0x600, 1);
+
+	pal = _currentPalette + start * 3;
+	target = _palManipPalette + start * 3;
+	between = _palManipIntermediatePal + start * 6;
+
+	for (i = start; i < end; ++i) {
+		*target++ = *new_pal++;
+		*target++ = *new_pal++;
+		*target++ = *new_pal++;
+		*(uint16 *)between = ((uint16) *pal++) << 8;
+		between += 2;
+		*(uint16 *)between = ((uint16) *pal++) << 8;
+		between += 2;
+		*(uint16 *)between = ((uint16) *pal++) << 8;
+		between += 2;
+	}
+
+	_palManipCounter = time;
+}
+
+
 void ScummEngine::palManipulate() {
 	byte *target, *pal, *between;
 	int i, j;
@@ -2969,7 +3008,7 @@
 }
 
 void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
-	const byte *basepal = getPalettePtr();
+	const byte *basepal = getPalettePtr(_curPalIndex);
 	const byte *pal = basepal;
 	const byte *compareptr;
 	byte *table = _shadowPalette;
@@ -3054,7 +3093,7 @@
 
 	int i, j;
 
-	palPtr = getPalettePtr();
+	palPtr = getPalettePtr(_curPalIndex);
 
 	for (i = 0; i < 256; i++)
 		_proc_special_palette[i] = i;
@@ -3103,7 +3142,7 @@
 		int j;
 		int color;
 
-		cptr = getPalettePtr() + startColor * 3;
+		cptr = getPalettePtr(_curPalIndex) + startColor * 3;
 		cur = _currentPalette + startColor * 3;
 
 		for (j = startColor; j <= endColor; j++) {
@@ -3163,7 +3202,7 @@
 		byte *cur;
 		int j;
 
-		cptr = getPalettePtr() + startColor * 3;
+		cptr = getPalettePtr(_curPalIndex) + startColor * 3;
 		cur = _currentPalette + startColor * 3;
 
 		for (j = startColor; j <= endColor; j++) {
@@ -3330,7 +3369,7 @@
 	const byte *pals;
 
 	_curPalIndex = palindex;
-	pals = getPalettePtr();
+	pals = getPalettePtr(_curPalIndex);
 	setPaletteFromPtr(pals);
 }
 
@@ -3354,7 +3393,7 @@
 	return offs + READ_LE_UINT32(offs + idx * sizeof(uint32));
 }
 
-const byte *ScummEngine::getPalettePtr() {
+const byte *ScummEngine::getPalettePtr(int palindex) {
 	const byte *cptr;
 
 	cptr = getResourceAddress(rtRoom, _roomResource);
@@ -3362,7 +3401,7 @@
 	if (_CLUT_offs) {
 		cptr += _CLUT_offs;
 	} else {
-		cptr = findPalInPals(cptr + _PALS_offs, _curPalIndex);
+		cptr = findPalInPals(cptr + _PALS_offs, palindex);
 	}
 	assert(cptr);
 	return cptr;

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.121
retrieving revision 2.122
diff -u -d -r2.121 -r2.122
--- intern.h	10 Nov 2003 08:46:40 -0000	2.121
+++ intern.h	17 Dec 2003 17:12:09 -0000	2.122
@@ -343,6 +343,8 @@
 
 	virtual void setupScummVars();
 
+	virtual void palManipulateInit(int resID, int start, int end, int time);
+
 	virtual void decodeParseString(int a, int b);
 
 	int getStackList(int *args, uint maxnum);

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- script_v5.cpp	6 Dec 2003 14:17:07 -0000	1.211
+++ script_v5.cpp	17 Dec 2003 17:12:09 -0000	1.212
@@ -1986,7 +1986,7 @@
 		c = getVarOrDirectByte(PARAM_2);
 		_opcode = fetchScriptByte();
 		d = getVarOrDirectByte(PARAM_1);
-		palManipulateInit(b, c, a, d);
+		palManipulateInit(a, b, c, d);
 		break;
 
 	case 16:	// SO_CYCLE_SPEED

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- scumm.h	14 Dec 2003 20:36:37 -0000	1.333
+++ scumm.h	17 Dec 2003 17:12:09 -0000	1.334
@@ -827,7 +827,7 @@
 	void clampCameraPos(Common::Point *pt);
 	void actorFollowCamera(int act);
 
-	const byte *getPalettePtr();
+	const byte *getPalettePtr(int palindex);
 	void setupAmigaPalette();
 	void setupEGAPalette();
 	void setupV1ManiacPalette();
@@ -842,7 +842,7 @@
 	void copyPalColor(int dst, int src);
 	void cyclePalette();
 	void stopCycle(int i);
-	void palManipulateInit(int start, int end, int string_id, int time);
+	virtual void palManipulateInit(int resID, int start, int end, int time);
 	void palManipulate();
 public:
 	int remapPaletteColor(int r, int g, int b, uint threshold);		// Used by Actor::remapActorPalette





More information about the Scummvm-git-logs mailing list