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

yazoo at users.sourceforge.net yazoo at users.sourceforge.net
Sat Apr 28 02:26:58 CEST 2007


Revision: 26637
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26637&view=rev
Author:   yazoo
Date:     2007-04-27 17:26:57 -0700 (Fri, 27 Apr 2007)

Log Message:
-----------
Fix extended characters in font
Implement palette manipulation

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/cell.h
    scummvm/trunk/engines/cruise/font.cpp
    scummvm/trunk/engines/cruise/function.cpp
    scummvm/trunk/engines/cruise/mainDraw.cpp
    scummvm/trunk/engines/cruise/various.cpp

Modified: scummvm/trunk/engines/cruise/cell.h
===================================================================
--- scummvm/trunk/engines/cruise/cell.h	2007-04-27 23:21:36 UTC (rev 26636)
+++ scummvm/trunk/engines/cruise/cell.h	2007-04-28 00:26:57 UTC (rev 26637)
@@ -41,7 +41,7 @@
 	int16 field_A;
 	int16 field_C;
 	int16 spriteIdx;
-	int16 field_10;
+	int16 color;
 	int16 backgroundPlane;
 	int16 freeze;
 	int16 field_16;

Modified: scummvm/trunk/engines/cruise/font.cpp
===================================================================
--- scummvm/trunk/engines/cruise/font.cpp	2007-04-27 23:21:36 UTC (rev 26636)
+++ scummvm/trunk/engines/cruise/font.cpp	2007-04-28 00:26:57 UTC (rev 26637)
@@ -598,7 +598,7 @@
 
 	do {
 		int spacesCount = 0;	// si
-		char character = *string;
+		unsigned char character = *string;
 		short int strPixelLength;	// var_16
 		uint8 *ptrStringEnd;	// var_4     //ok
 		int drawPosPixel_X;	// di
@@ -628,7 +628,7 @@
 		do {
 			character = *(string++);
 
-			short int charData = fontCharacterTable[(int)character];	// get character position
+			short int charData = fontCharacterTable[character];	// get character position
 
 			if (character) {
 				if (character == ' ' || character == 0x7C) {

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-04-27 23:21:36 UTC (rev 26636)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-04-28 00:26:57 UTC (rev 26637)
@@ -703,7 +703,7 @@
 
 	if (color == -1) {
 		color = 0;
-		//ASSERT(0);
+		ASSERT(0);
 		//color = calcTabSomething();
 	} else {
 		if (CVTLoaded) {
@@ -939,18 +939,47 @@
 	return 0;
 }
 
-int16 Op_SetColor(void)	{	// TODO: palette manipulation
-	//var_4 = popVar();
-	//var_6 = popVar();
-	//var_8 = popVar();
-	//int si = popVar();
-	//int di = popVar();
-	popVar();
-	popVar();
-	popVar();
-	popVar();
-	popVar();
+int16 Op_SetColor(void)	{
+	int colorB = popVar();
+	int colorG = popVar();
+	int colorR = popVar();
+	int endIdx = popVar();
+	int startIdx = popVar();
 
+	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);
+
+		if (R > 0xFF)
+			R = 0xFF;
+		if (G > 0xFF)
+			G = 0xFF;
+		if (B > 0xFF)
+			B = 0xFF;
+
+		if (CVTLoaded) {
+			int colorIdx = cvtPalette[i];
+			
+			lpalette[colorIdx].R = R;
+			lpalette[colorIdx].G = G;
+			lpalette[colorIdx].B = B;
+		}
+		else
+		{
+			lpalette[i].R = R;
+			lpalette[i].G = G;
+			lpalette[i].B = B;
+		}
+	}
+
 	return 0;
 }
 

Modified: scummvm/trunk/engines/cruise/mainDraw.cpp
===================================================================
--- scummvm/trunk/engines/cruise/mainDraw.cpp	2007-04-27 23:21:36 UTC (rev 26636)
+++ scummvm/trunk/engines/cruise/mainDraw.cpp	2007-04-28 00:26:57 UTC (rev 26637)
@@ -1085,7 +1085,7 @@
 	mainDraw6();
 	var20 = 0;
 
-	//-------------------------------------------------- DRAW OBJECTS TYPE 5 -----------------------------------------//
+	//-------------------------------------------------- DRAW OBJECTS TYPE 5 (MSG)-----------------------------------------//
 
 	currentObjPtr = cellHead.next;
 
@@ -1093,7 +1093,7 @@
 		if (currentObjPtr->type == 5 && currentObjPtr->freeze == 0) {
 			mainSprite(currentObjPtr->field_A,
 			    currentObjPtr->field_C, currentObjPtr->gfxPtr,
-			    gfxModuleData.pPage10, currentObjPtr->field_10,
+			    gfxModuleData.pPage10, currentObjPtr->color,
 			    currentObjPtr->spriteIdx);
 			var20 = 1;
 		}

Modified: scummvm/trunk/engines/cruise/various.cpp
===================================================================
--- scummvm/trunk/engines/cruise/various.cpp	2007-04-27 23:21:36 UTC (rev 26636)
+++ scummvm/trunk/engines/cruise/various.cpp	2007-04-28 00:26:57 UTC (rev 26637)
@@ -117,6 +117,7 @@
 void createTextObject(int overlayIdx, int oldVar8, cellStruct *pObject,
     int scriptNumber, int scriptOverlayNumber, int backgroundPlane,
     int16 color, int oldVar2, int oldVar4, int oldVar6) {
+
 	char *ax;
 	cellStruct *savePObject = pObject;
 	cellStruct *cx;
@@ -144,7 +145,7 @@
 	pNewElement->field_A = oldVar6;
 	pNewElement->field_C = oldVar4;
 	pNewElement->spriteIdx = oldVar2;
-	pNewElement->field_10 = color;
+	pNewElement->color = color;
 	pNewElement->freeze = 0;
 	pNewElement->field_16 = scriptNumber;
 	pNewElement->field_18 = scriptOverlayNumber;


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