From 433105141b820c40db0561d22e7f69c0257eaf49 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 25 Aug 2007 13:13:03 +0000 Subject: Some more fixes to Gfx::palFade. Benny's nightfall scene is shown correctly now svn-id: r28722 --- engines/saga/gfx.cpp | 14 ++++++-------- 1 file 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; -- cgit v1.2.3