[Scummvm-cvs-logs] CVS: scummvm/simon debug.h,1.23,1.24 simon.cpp,1.539,1.540 simon.h,1.160,1.161 vga.cpp,1.151,1.152

kirben kirben at users.sourceforge.net
Sat Nov 12 23:06:01 CET 2005


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

Modified Files:
	debug.h simon.cpp simon.h vga.cpp 
Log Message:

Fix slowFadein during Lion ride in Simon2.
Cleanup.


Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/debug.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- debug.h	11 Nov 2005 04:09:36 -0000	1.23
+++ debug.h	13 Nov 2005 07:04:56 -0000	1.24
@@ -1401,7 +1401,7 @@
 	"|FASTFADEIN",
 	/* 64 */
 	"|SKIP_IF_SPEECH_ENDED",
-	"|PALETTE_THING_3",
+	"|SLOW_FADE_IN",
 	"|SKIP_IF_NZ",
 	"|SKIP_IF_GE",
 	/* 68 */
@@ -1498,7 +1498,7 @@
 	"|FASTFADEIN",
 	/* 64 */
 	"|SKIP_IF_SPEECH_ENDED",
-	"|PALETTE_THING_3",
+	"|SLOW_FADE_IN",
 	"|SKIP_IF_NZ",
 	"|SKIP_IF_GE",
 	/* 68 */

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.539
retrieving revision 1.540
diff -u -d -r1.539 -r1.540
--- simon.cpp	12 Nov 2005 08:20:47 -0000	1.539
+++ simon.cpp	13 Nov 2005 07:04:56 -0000	1.540
@@ -738,7 +738,7 @@
 			p[2] -= 8;
 		else
 			p[2] = 0;
-		p += sizeof(uint32);
+		p += 4;
 	} while (--num);
 }
 
@@ -2520,7 +2520,7 @@
 void SimonEngine::o_fade_to_black() {
 	uint i;
 
-	memcpy(_videoBuf1, _paletteBackup, 256 * sizeof(uint32));
+	memcpy(_videoBuf1, _paletteBackup, 1024);
 
 	i = NUM_PALETTE_FADEOUT;
 	do {
@@ -2534,8 +2534,8 @@
 		delay(5);
 	} while (--i);
 
-	memcpy(_paletteBackup, _videoBuf1, 256 * sizeof(uint32));
-	memcpy(_palette, _videoBuf1, 256 * sizeof(uint32));
+	memcpy(_paletteBackup, _videoBuf1, 1024);
+	memcpy(_palette, _videoBuf1, 1024);
 }
 
 void SimonEngine::delete_vga_timer(VgaTimerEntry * vte) {
@@ -3770,7 +3770,7 @@
 
 		resfile_read(_gameOffsetsPtr, 0, size);
 #if defined(SCUMM_BIG_ENDIAN)
-		for (uint r = 0; r < size / sizeof(uint32); r++)
+		for (uint r = 0; r < size / 4; r++)
 			_gameOffsetsPtr[r] = FROM_LE_32(_gameOffsetsPtr[r]);
 #endif
 	}
@@ -3863,8 +3863,8 @@
 
 	if (_paletteColorCount == 0 && _paletteFlag == 1) {
 		_paletteFlag = 0;
-		if (memcmp(_palette, _paletteBackup, 256 * 4) != 0) {
-			memcpy(_paletteBackup, _palette, 256 * 4);
+		if (memcmp(_palette, _paletteBackup, 1024) != 0) {
+			memcpy(_paletteBackup, _palette, 1024);
 			_system->setPalette(_palette, 0, 256);
 		}
 	}
@@ -3879,79 +3879,52 @@
 			delay(100);
 			_usePaletteDelay = false;
 		}
-		realizePalette();
+		fastFadeIn();
 	}
 }
 
-void SimonEngine::realizePalette() {
-	_paletteFlag = false;
-	memcpy(_paletteBackup, _palette, 256 * 4);
-
+void SimonEngine::fastFadeIn() {
 	if (_paletteColorCount & 0x8000) {
-		fadeUpPalette();
+		slowFadeIn();
 	} else {
+		_paletteFlag = false;
+		memcpy(_paletteBackup, _palette, 1024);
 		_system->setPalette(_palette, 0, _paletteColorCount);
+		_paletteColorCount = 0;
 	}
-
-	_paletteColorCount = 0;
 }
 
-void SimonEngine::fadeUpPalette() {
-	bool done;
-
-	_paletteColorCount = (_paletteColorCount & 0x7fff) / 4;
-
-	memset(_videoBuf1, 0, _paletteColorCount * sizeof(uint32));
-
-	// This function is used by Simon 2 when riding the lion to the goblin
-	// camp. Note that _paletteColorCount is not 1024 in this scene, so
-	// only part of the palette is faded up. But apparently that's enough,
-	// as long as we make sure that the remaining palette colours aren't
-	// completely ignored.
+void SimonEngine::slowFadeIn() {
+	uint8 paletteTmp[768];
+	uint8 *src, *dst;
+	int c, p;
 
-	if (_paletteColorCount < _videoNumPalColors)
-		memcpy(_videoBuf1 + _paletteColorCount * sizeof(uint32),
-			_palette + _paletteColorCount * sizeof(uint32),
-			(_videoNumPalColors - _paletteColorCount) * sizeof(uint32));
+	_paletteColorCount &= 0x7fff;
+	_paletteFlag = false;
 
-	do {
-		uint8 *src;
-		byte *dst;
-		int i;
+	memcpy(_videoBuf1, _palette, 1024); // Difference
+	memset(_videoBuf1, 0, 768);
 
-		done = true;
-		src = _palette;
-		dst = _videoBuf1;
+	memcpy(_paletteBackup, _palette, 768);
+	memcpy(paletteTmp, _palette, 768);
 
-		for (i = 0; i < _paletteColorCount; i++) {
-			if (src[0] > dst[0]) {
-				if (dst[0] > src[0] - 4)
-					dst[0] = src[0];
-				else
-					dst[0] += 4;
-				done = false;
-			}
-			if (src[1] > dst[1]) {
-				if (dst[1] > src[1] - 4)
-					dst[1] = src[1];
-				else
-					dst[1] += 4;
-				done = false;
-			}
-			if (src[2] > dst[2]) {
-				if (dst[2] > src[2] - 4)
-					dst[2] = src[2];
-				else
-					dst[2] += 4;
-				done = false;
-			}
-			dst += 4;
-			src += 4;
-		}
+	for (c = 255; c > 0; c -= 4) {
+	  	src = paletteTmp;
+ 		dst = _videoBuf1;
 
-		_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
-		delay(5);
- 	} while (!done);
+		for (p = _paletteColorCount; p !=0 ; p--) {
+			if (*src >= c)
+				*dst = *dst + 4;
+			
+			src++;
+			dst++;
+ 		}
+ 		_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
+		if (_fade)
+			_system->updateScreen();
+ 		delay(5);
+ 	}
+	_paletteColorCount = 0;
 }
 
 int SimonEngine::go() {

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- simon.h	12 Nov 2005 08:20:47 -0000	1.160
+++ simon.h	13 Nov 2005 07:04:56 -0000	1.161
@@ -858,8 +858,8 @@
 	void decodeStripA(byte *dst, const byte *src, int height);
 	void scroll_timeout();
 	void hitarea_stuff_helper_2();
-	void realizePalette();
-	void fadeUpPalette();
+	void fastFadeIn();
+	void slowFadeIn();
 
 	void vc_kill_sprite(uint file, uint sprite);
 

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- vga.cpp	12 Nov 2005 08:04:10 -0000	1.151
+++ vga.cpp	13 Nov 2005 07:04:56 -0000	1.152
@@ -1108,7 +1108,7 @@
 
 	// Work around to allow inventory arrows to be
 	// shown in some versions of Simon the Sorcerer 1
-	if ((getGameType() == GType_SIMON1) && vsp->id == 0x80)
+	if ((getGameType() == GType_SIMON1) && vsp->id == 128)
 		num = 0;
 	else
 		num += VGA_DELAY_BASE;
@@ -1770,7 +1770,7 @@
 		if (_windowNum == 4)
 			_videoNumPalColors = 208;
 
-		memcpy(_videoBuf1, _paletteBackup, _videoNumPalColors * sizeof(uint32));
+		memcpy(_videoBuf1, _paletteBackup, _videoNumPalColors * 4);
 		for (i = NUM_PALETTE_FADEOUT; i != 0; --i) {
 			palette_fadeout((uint32 *)_videoBuf1, _videoNumPalColors);
 			_system->setPalette(_videoBuf1, 0, _videoNumPalColors);
@@ -1787,7 +1787,7 @@
 
 			vsp = _vgaSprites;
 			while (vsp->id != 0) {
-				if (vsp->id == 0x80) {
+				if (vsp->id == 128) {
 					byte *old_file_1 = _curVgaFile1;
 					byte *old_file_2 = _curVgaFile2;
 					uint palmode = _windowNum;





More information about the Scummvm-git-logs mailing list