[Scummvm-cvs-logs] SF.net SVN: scummvm: [28710] scummvm/trunk/engines/saga/gfx.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Aug 24 17:32:05 CEST 2007


Revision: 28710
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28710&view=rev
Author:   thebluegr
Date:     2007-08-24 08:32:05 -0700 (Fri, 24 Aug 2007)

Log Message:
-----------
Some more fixes to Gfx::palFade

Modified Paths:
--------------
    scummvm/trunk/engines/saga/gfx.cpp

Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp	2007-08-24 13:40:03 UTC (rev 28709)
+++ scummvm/trunk/engines/saga/gfx.cpp	2007-08-24 15:32:05 UTC (rev 28710)
@@ -416,12 +416,27 @@
 
 	// Exponential fade
 	fpercent = percent * percent;
+	fpercent = fpercent < 0.0 ? 0.0 : fpercent;
+	fpercent = fpercent > 1.0 ? 1.0 : fpercent;
 
+	// TODO: finish this (use from and to properly). The fpercent value will need to be
+	// correctly assigned, based on from and to. For now, only certain cases work correctly
+	if (from == 0 || to == 0) {
+		// This case works like palToBlack or blackToPal, so no changes are needed
+	} else if ((from / to == 2) || (to / from == 2)) {
+		// It's easy to use the current algorithm if we're trying to fade to half the value
+		fpercent /= 2;
+		if (from < to)
+			fpercent += 0.5;
+	} else {
+		// FIXME: In all other cases, throw a warning, as we'll fade out to/from black
+		if (percent == 0.0)
+			warning("Screen fading effect not supported yet, fading to/from black for now");
+	}
+
 	if (from > to)
 		fpercent = 1.0 - fpercent;
 
-	// TODO: finish this (it always fades to black!) -> use from and to
-
 	// Use the correct percentage change per frame for each palette entry
 	for (i = 0, ppal = _currentPal; i < PAL_ENTRIES; i++, ppal += 4) {
 		if (i < start || i >= start + numColors)


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