[Scummvm-cvs-logs] SF.net SVN: scummvm:[42638] scummvm/trunk/engines/agos

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Jul 21 12:37:59 CEST 2009


Revision: 42638
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42638&view=rev
Author:   Kirben
Date:     2009-07-21 10:37:58 +0000 (Tue, 21 Jul 2009)

Log Message:
-----------
Fix fade effects in Waxworks.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/vga_e2.cpp
    scummvm/trunk/engines/agos/vga_ww.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2009-07-21 09:39:58 UTC (rev 42637)
+++ scummvm/trunk/engines/agos/agos.h	2009-07-21 10:37:58 UTC (rev 42638)
@@ -1248,6 +1248,7 @@
 	void hitarea_stuff_helper_2();
 	void fastFadeIn();
 	void slowFadeIn();
+	void fullFade();
 
 	virtual void vcStopAnimation(uint16 zone, uint16 sprite);
 

Modified: scummvm/trunk/engines/agos/vga_e2.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_e2.cpp	2009-07-21 09:39:58 UTC (rev 42637)
+++ scummvm/trunk/engines/agos/vga_e2.cpp	2009-07-21 10:37:58 UTC (rev 42638)
@@ -353,9 +353,32 @@
 	_needHitAreaRecalc++;
 }
 
+void AGOSEngine::fullFade() {
+	uint8 *srcPal, *dstPal;
+	int c, p;
+
+	for (c = 64; c != 0; c --) {
+		srcPal = _curVgaFile2 + 32;
+		dstPal = _currentPalette;
+		for (p = 768; p !=0 ; p -= 3) {
+			uint8 r = srcPal[0] * 4;
+			if (dstPal[0] != r)
+				dstPal[0] += 4;
+			uint8 g = srcPal[1] * 4;
+			if (dstPal[1] != g)
+				dstPal[1] += 4;
+			uint8 b = srcPal[2] * 4;
+			if (dstPal[2] != b)
+				dstPal[2] += 4;
+			srcPal += 3;
+			dstPal += 4;
+		}
+		_system->setPalette(_currentPalette, 0, 256);
+		delay(5);
+	}
+}
+
 void AGOSEngine::vc56_fullScreen() {
-	uint8 palette[1024];
-
 	Graphics::Surface *screen = _system->lockScreen();
 	byte *dst = (byte *)screen->pixels;
 	byte *src = _curVgaFile2 + 800;
@@ -367,23 +390,12 @@
 	}
 	 _system->unlockScreen();
 
-	//fullFade();
-
-	src = _curVgaFile2 + 32;
-	for (int i = 0; i < 256; i++) {
-		palette[i * 4 + 0] = *src++ * 4;
-		palette[i * 4 + 1] = *src++ * 4;
-		palette[i * 4 + 2] = *src++ * 4;
-		palette[i * 4 + 3] = 0;
-	}
-
-	_system->setPalette(palette, 0, 256);
+	fullFade();
 }
 
 void AGOSEngine::vc57_blackPalette() {
-	uint8 palette[1024];
-	memset(palette, 0, sizeof(palette));
-	_system->setPalette(palette, 0, 256);
+	memset(_currentPalette, 0, sizeof(_currentPalette));
+	_system->setPalette(_currentPalette, 0, 256);
 }
 
 void AGOSEngine::vc58_checkCodeWheel() {

Modified: scummvm/trunk/engines/agos/vga_ww.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_ww.cpp	2009-07-21 09:39:58 UTC (rev 42637)
+++ scummvm/trunk/engines/agos/vga_ww.cpp	2009-07-21 10:37:58 UTC (rev 42638)
@@ -193,20 +193,8 @@
 
 	_system->unlockScreen();
 
-	if (a == 6) {
-		//fullFade();
-		src = _curVgaFile2 + 32;
-
-		uint8 palette[1024];
-		for (int i = 0; i < 256; i++) {
-			palette[i * 4 + 0] = *src++ * 4;
-			palette[i * 4 + 1] = *src++ * 4;
-			palette[i * 4 + 2] = *src++ * 4;
-			palette[i * 4 + 3] = 0;
-		}
-
-		_system->setPalette(palette, 0, 256);
-	}
+	if (a == 6)
+		fullFade();
 }
 
 void AGOSEngine::vc62_fastFadeOut() {
@@ -221,8 +209,6 @@
 				_fastFadeCount = 208;
 		}
 
-		memcpy(_videoBuf1, _currentPalette, _fastFadeCount * 4);
-
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
 			if (getGameType() == GType_FF && getBitFlag(75)) {
 				fadeCount = 4;
@@ -237,8 +223,8 @@
 		}
 
 		for (i = fadeCount; i != 0; --i) {
-			paletteFadeOut(_videoBuf1, _fastFadeCount, fadeSize);
-			_system->setPalette(_videoBuf1, 0, _fastFadeCount);
+			paletteFadeOut(_currentPalette, _fastFadeCount, fadeSize);
+			_system->setPalette(_currentPalette, 0, _fastFadeCount);
 			delay(5);
 		}
 


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