[Scummvm-cvs-logs] SF.net SVN: scummvm: [29989] scummvm/trunk/engines/cruise

yazoo at users.sourceforge.net yazoo at users.sourceforge.net
Tue Dec 25 21:17:00 CET 2007


Revision: 29989
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29989&view=rev
Author:   yazoo
Date:     2007-12-25 12:16:59 -0800 (Tue, 25 Dec 2007)

Log Message:
-----------
Fix palette issues

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/background.cpp
    scummvm/trunk/engines/cruise/cruise_main.cpp
    scummvm/trunk/engines/cruise/function.cpp

Modified: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp	2007-12-25 19:32:51 UTC (rev 29988)
+++ scummvm/trunk/engines/cruise/background.cpp	2007-12-25 20:16:59 UTC (rev 29989)
@@ -202,7 +202,7 @@
 			break;
 		case 8:
 			memcpy(backgroundPtrtable[idx], ptr2, 320 * 200);
-			ptr2 += 32000;
+			ptr2 += 320*200;
 			break;
 		}
 

Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp	2007-12-25 19:32:51 UTC (rev 29988)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp	2007-12-25 20:16:59 UTC (rev 29989)
@@ -1174,8 +1174,18 @@
 }
 
 int findHighColor() {
-	printf("Unimplemented findHighColor\n");
-	return 1;
+	int bestColorResult = -1;
+	int bestColorIdx = -1;
+
+	for(unsigned long int i=0; i<256; i++) {
+		int colorResult = (workpal[i*3+0] + workpal[i*3+1] + workpal[i*3+2]) / 256;
+
+		if(colorResult > bestColorResult) {
+			bestColorIdx = i;
+			bestColorResult =  colorResult;
+		}
+	}
+	return bestColorIdx;
 }
 
 void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-12-25 19:32:51 UTC (rev 29988)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-12-25 20:16:59 UTC (rev 29989)
@@ -903,30 +903,25 @@
 
 	int i;
 
-	int R,G,B;
-
 #define convertRatio 36.571428571428571428571428571429
 
 	for (i=startIdx; i<=endIdx; i++) {
-		R = (int)(colorR*convertRatio);
-		G = (int)(colorG*convertRatio);
-		B = (int)(colorB*convertRatio);
+		int offsetTable[3];
 
-		if (R > 0xFF)
-			R = 0xFF;
-		if (G > 0xFF)
-			G = 0xFF;
-		if (B > 0xFF)
-			B = 0xFF;
+		offsetTable[0] = (int)(colorR*convertRatio);
+		offsetTable[1] = (int)(colorG*convertRatio);
+		offsetTable[2] = (int)(colorB*convertRatio);
 
 		if (CVTLoaded) {
 			int colorIdx = cvtPalette[i];
-			gfxModuleData_setPalColor(colorIdx, R, G, B);
+			calcRGB(&palScreen[masterScreen][3*colorIdx], &workpal[3*colorIdx], offsetTable);
 		} else {
-			gfxModuleData_setPalColor(i, R, G, B);
+			calcRGB(&palScreen[masterScreen][3*i], &workpal[3*i], offsetTable);
 		}
 	}
 
+	gfxModuleData_setPal256(workpal);
+
 	return 0;
 }
 


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