diff options
author | Filippos Karapetis | 2007-08-25 13:13:03 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-08-25 13:13:03 +0000 |
commit | 433105141b820c40db0561d22e7f69c0257eaf49 (patch) | |
tree | f0beabd77e0cd569cc4efe063ac37d08b48eafb2 /engines | |
parent | 05ba86577eea6697c36123c0dd09b91709db33c3 (diff) | |
download | scummvm-rg350-433105141b820c40db0561d22e7f69c0257eaf49.tar.gz scummvm-rg350-433105141b820c40db0561d22e7f69c0257eaf49.tar.bz2 scummvm-rg350-433105141b820c40db0561d22e7f69c0257eaf49.zip |
Some more fixes to Gfx::palFade. Benny's nightfall scene is shown correctly now
svn-id: r28722
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/gfx.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp index 6e5824c1b0..05d32679c8 100644 --- a/engines/saga/gfx.cpp +++ b/engines/saga/gfx.cpp @@ -408,32 +408,30 @@ void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 num PalEntry *palE; double fpercent; - percent = percent > 1.0 ? 1.0 : percent; from = from > 256 ? 256 : from; from = from < 0 ? 0 : from; to = to > 256 ? 256 : to; to = to < 0 ? 0 : to; - // 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; + percent /= 2; if (from < to) - fpercent += 0.5; + percent += 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"); } + // Exponential fade + percent = percent > 1.0 ? 1.0 : percent; + fpercent = percent * percent; + if (from > to) fpercent = 1.0 - fpercent; |