aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2007-08-24 11:37:58 +0000
committerFilippos Karapetis2007-08-24 11:37:58 +0000
commitf48ce0d82111e9b209e7a2a069df472b46dfc687 (patch)
tree60d73682925322f8f0ca6730f6ad5da63aee1ae5 /engines/saga
parent65c390cbfc10b1bf524a4dbc047bcc6130f3c82b (diff)
downloadscummvm-rg350-f48ce0d82111e9b209e7a2a069df472b46dfc687.tar.gz
scummvm-rg350-f48ce0d82111e9b209e7a2a069df472b46dfc687.tar.bz2
scummvm-rg350-f48ce0d82111e9b209e7a2a069df472b46dfc687.zip
Some more updates to Gfx::palFade (not finished yet, though)
svn-id: r28705
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/gfx.cpp40
1 files changed, 10 insertions, 30 deletions
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 86160fc98d..7aec6a05ce 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -402,49 +402,29 @@ void Gfx::blackToPal(PalEntry *srcPal, double percent) {
// Used in IHNM only
void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 numColors, double percent) {
- //short value, delta;
- int i;
+ int i;
int new_entry;
byte *ppal;
PalEntry *palE;
-
double fpercent;
- if (percent > 1.0)
- percent = 1.0;
-
- if (from > 256)
- from = 256;
- if (from < 0 )
- from = 0;
- if (to > 256)
- to = 256;
- if (to < 0)
- to = 0;
+ 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 = 1.0 - fpercent;
-
- // TODO: finish this
- //delta = (from < to) ? +1 : -1;
- if (percent == 0.0) // only display the warning once
- warning("TODO: Gfx::palFade");
+ if (from > to)
+ fpercent = 1.0 - fpercent;
- return; // Don't do anything for now
-
- /*
- for (value = from; value != to+delta; value += delta) {
- // adjust palette color
- // delay here
- }
- */
- //_vm->_frameCount++; // is this needed?
+ // 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 < from || i >= from + numColors)
+ if (i < start || i >= start + numColors)
palE = &_globalPalette[i];
else
palE = &srcPal[i];