aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2007-08-24 15:32:05 +0000
committerFilippos Karapetis2007-08-24 15:32:05 +0000
commit2bfc4466df238fea2162466cca06de88c773e6c5 (patch)
tree0bb94eda46d1cf840fd771afcb3963223023b5ed /engines
parente156f0ff8771e1e25e042117a3fe1b09c7f47b25 (diff)
downloadscummvm-rg350-2bfc4466df238fea2162466cca06de88c773e6c5.tar.gz
scummvm-rg350-2bfc4466df238fea2162466cca06de88c773e6c5.tar.bz2
scummvm-rg350-2bfc4466df238fea2162466cca06de88c773e6c5.zip
Some more fixes to Gfx::palFade
svn-id: r28710
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/gfx.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 31e730d8d2..6e5824c1b0 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -416,12 +416,27 @@ void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 num
// 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)