[Scummvm-cvs-logs] CVS: scummvm scummvm.cpp,1.210,1.211

Max Horn fingolfin at users.sourceforge.net
Tue Aug 20 15:18:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv15671

Modified Files:
	scummvm.cpp 
Log Message:
applied patch #588501; enhanced comments on palManipulate

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- scummvm.cpp	20 Aug 2002 02:13:41 -0000	1.210
+++ scummvm.cpp	20 Aug 2002 22:17:52 -0000	1.211
@@ -891,38 +891,98 @@
 	return a;
 }
 
-void Scumm::unkRoomFunc3(int a, int b, int c, int d, int e)
+void Scumm::unkRoomFunc3(int unk1, int unk2, int rfact, int gfact, int bfact)
 {
-	warning("stub unkRoomFunc3(%d,%d,%d,%d,%d)", a, b, c, d, e);
-}
-
+	byte *pal = _currentPalette;
+	byte *table = _shadowPalette;
+	int i;
 
-void Scumm::palManipulate(int palettes, int brightness, int color, int time, int e)
-{
-	byte *cptr;
+	warning("unkRoomFunc3(%d,%d,%d,%d,%d): not fully implemented", unk1, unk2, rfact, gfact, bfact);
 
-	/* TODO: implement this */
-	warning("palManipulate(%d, %d, %d, %d): not implemented", palettes, brightness, color, time);
+	// TODO - correctly implement this function (see also patch #588501)
+	//
+	// Some "typical" examples of how this function is being invoked in real life:
+	//
+	// unkRoomFunc3(16, 255, 200, 200, 200)
+	//
+	// FOA: Sets up the colors for the boat and submarine shadows in the
+	// diving scene. Are the shadows too light? Maybe unk1 is used to
+	// darken the colors?
+	//
+	// unkRoomFunc3(0, 255, 700, 700, 700)
+	//
+	// FOA: Sets up the colors for the subway car headlight when it first
+	// goes on. This seems to work ok.
+	//
+	// unkRoomFunc3(160, 191, 300, 300, 300)
+	// unkRoomFunc3(160, 191, 289, 289, 289)
+	//     ...
+	// unkRoomFunc3(160, 191, 14, 14, 14)
+	// unkRoomFunc3(160, 191, 3, 3, 3)
+	//
+	// FOA: Sets up the colors for the subway car headlight for the later
+	// half of the trip, where it fades out. This currently doesn't work
+	// at all. The colors are too dark to be brightened. At first I thought
+	// unk1 and unk2 were used to tell which color interval to manipulate,
+	// but as far as I can tell the colors 160-191 aren't used at all to
+	// draw the light, that can't be it. Apparently unk1 and/or unk2 are
+	// used to brighten the colors.
 	
-	printf("_curPalIndex=%d\n", _curPalIndex);
+	for (i = 0; i <= 255; i++) {
+		int r = (int) (*pal++ * rfact) >> 8;
+		int g = (int) (*pal++ * gfact) >> 8;
+		int b = (int) (*pal++ * bfact) >> 8;
 
-	cptr = _currentPalette + color * 3;
-	printf("color %d = (%d,%d,%d)\n", color, (int)*cptr++, (int)*cptr++, (int)*cptr++);
+		*table++ = remapPaletteColor(r, g, b, (uint) -1);
+	}
+}
 
-//	darkenPalette(0, 255, 0xFF+0x10, brightness, brightness);
+
+void Scumm::palManipulate(int start, int end, int color, int time, int e)
+{
+	// TODO - correctly implement this function (see also bug #588501)
+	//
+	// The only place I know of where this function is being called is in the 
+	// FOA extro, to change the color to match the sinking sun. The following
+	// three calls (with some pauses between them) are issued:
+	//
+	// palManipulate(16, 190, 32, 180, 1)
+	// palManipulate(16, 190, 32, 1, 1)
+	// palManipulate(16, 190, 32, 800, 1)
+	//
+	// The first two parameters seem to specify a palette range (as the colors
+	// from 16 to 190 are the ones that make up water & sky).
+	//
+	// Maybe the change has to be done over a period of time, possibly specified
+	// by the second last parameter - between call 1 and 2, about 17-18 seconds
+	// seem to pass (well using get_msecs, I measured 17155 ms, 17613 ms, 17815 ms).
+	//
+	// No clue about the third and fifth parameter right now, they just always
+	// are 32 and 1 - possibly finding another example of this function being
+	// used would help a lot. Also, I can't currently compare it with the original,
+	// doing that (and possibly, taking screenshots of it for analysis!) would 
+	// help a lot.
+	
+	static int sys_time = 0;
+	int new_sys_time = _system->get_msecs();
+	
+	warning("palManipulate(%d, %d, %d, %d, %d): not implemented", start, end, d, time, e);
+	if (sys_time != 0)
+		printf("Time since last call: %d\n", new_sys_time-sys_time);
+	sys_time = new_sys_time;
+	
 	{
-		int startColor = 0;
-		int endColor = 255;
 		int redScale = 0xFF;
-		int greenScale = brightness;
-		int blueScale = brightness;
+		int greenScale = 0xFF - d;
+		int blueScale = 0xFF - d;
+		byte *cptr;
 		byte *cur;
 		int num;
 		int color;
 	
-		cptr = _currentPalette + startColor * 3;
-		cur = _currentPalette + startColor * 3;
-		num = endColor - startColor + 1;
+		cptr = _currentPalette + start * 3;
+		cur = _currentPalette + start * 3;
+		num = end - start + 1;
 
 		do {
 			color = *cptr++;
@@ -946,13 +1006,8 @@
 				color = 255;
 			*cur++ = color;
 		} while (--num);
-		setDirtyColors(startColor, endColor);
+		setDirtyColors(start, end);
 	}
-
-	cptr = _currentPalette + color * 3;
-	printf("color %d = (%d,%d,%d)\n", color, (int)*cptr++, (int)*cptr++, (int)*cptr++);
-
-//	setPalette(palettes);
 }
 
 void Scumm::pauseGame(bool user)





More information about the Scummvm-git-logs mailing list