[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.452,2.453 palette_he.cpp,1.11,1.12 script_v90he.cpp,2.234,2.235

kirben kirben at users.sourceforge.net
Thu Apr 21 08:41:09 CEST 2005


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

Modified Files:
	intern.h palette_he.cpp script_v90he.cpp 
Log Message:

Add palette function foe He99+ games.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.452
retrieving revision 2.453
diff -u -d -r2.452 -r2.453
--- intern.h	20 Apr 2005 23:53:27 -0000	2.452
+++ intern.h	21 Apr 2005 15:40:40 -0000	2.453
@@ -1002,6 +1002,8 @@
 	
 	uint8 *getHEPaletteIndex(int palSlot);
 	int getHEPaletteColor(int palSlot, int color);
+	int getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end);
+
 	void setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b);
 	void setHEPaletteFromPtr(int palSlot, const uint8 *palData);
 	void setHEPaletteFromCostume(int palSlot, int resId);

Index: palette_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/palette_he.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- palette_he.cpp	18 Apr 2005 15:15:27 -0000	1.11
+++ palette_he.cpp	21 Apr 2005 15:40:40 -0000	1.12
@@ -78,6 +78,59 @@
 	}
 }
 
+int ScummEngine_v90he::getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end) {
+	assert(palSlot >= 1 && palSlot <= _numPalettes);
+	assert(start >= 1 && start <= 255);
+	assert(end >= 1 && end <= 255);
+
+	int eax, edi, edp, edx, esi;
+	int sum, bestitem, bestsum;
+	uint8 *palPtr;
+
+	palPtr = _hePalettes + palSlot * 1024 + start * 3;
+
+	bestsum = 0xFFFFFFFF;
+	bestitem = start;
+	edp = arg_8;
+
+	for (int i = start; i <= end; i++) {
+		esi = arg_4;
+
+		edi = *palPtr++;
+		edx = *palPtr;
+		esi -= edi;
+		eax = edx;
+
+		edi = edp;
+		eax = -eax;
+		eax <<= 31;
+		eax -= edx;		
+		edi -= edx;
+
+		eax += edp;
+
+		edx = esi;
+
+		eax *= edi;
+		edx *= esi;
+
+		sum = edx + eax * 2;
+
+		palPtr += 2;
+
+		if (sum < bestsum) {
+			if (sum == 0) {
+				return i;
+			}
+
+			bestsum = sum;
+			bestitem = i;
+		}
+	}
+
+	return bestitem;
+}
+
 int ScummEngine_v90he::getHEPaletteColor(int palSlot, int color) {
 	assert(palSlot >= 1 && palSlot <= _numPalettes);
 	assert(color >= 1 && color <= 255);

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.234
retrieving revision 2.235
diff -u -d -r2.234 -r2.235
--- script_v90he.cpp	20 Apr 2005 06:55:30 -0000	2.234
+++ script_v90he.cpp	21 Apr 2005 15:40:40 -0000	2.235
@@ -2256,6 +2256,7 @@
 }
 
 void ScummEngine_v90he::o90_getPaletteData() {
+	int b, c, d, e;
 	int palSlot, color;
 
 	byte subOp = fetchScriptByte();
@@ -2263,13 +2264,13 @@
 
 	switch (subOp) {
 	case 0:
+		e = pop();
+		d = pop();
+		palSlot = pop();
 		pop();
-		pop();
-		pop();
-		pop();
-		pop();
-		pop();
-		push(0);
+		c = pop();
+		b = pop();
+		push(getPaletteUnk1(palSlot, b, c, d, e));
 		break;
 	case 7:
 		pop();
@@ -2289,9 +2290,13 @@
 		break;
 	case 172:
 		pop();
-		pop();
-		pop();
-		push(0);
+		c = pop();
+		c = MAX(0, c);
+		c = MIN(c, 255);
+		b = pop();
+		b = MAX(0, b);
+		b = MIN(b, 255);
+		push(getPaletteUnk1(1, b, c, 10, 245));
 		break;
 	default:
 		error("o90_getPaletteData: Unknown case %d", subOp);





More information about the Scummvm-git-logs mailing list