diff options
author | Nicola Mettifogo | 2007-07-31 19:25:07 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-07-31 19:25:07 +0000 |
commit | b29935e93c9ffddf8c510c0f192e9aafd522ea2d (patch) | |
tree | 8ed4d9b6929d058f16152f97dd9819bb63c198fa | |
parent | 873a3e24e578eb2b32627352c69ecd4f05add677 (diff) | |
download | scummvm-rg350-b29935e93c9ffddf8c510c0f192e9aafd522ea2d.tar.gz scummvm-rg350-b29935e93c9ffddf8c510c0f192e9aafd522ea2d.tar.bz2 scummvm-rg350-b29935e93c9ffddf8c510c0f192e9aafd522ea2d.zip |
Generalized fadePalette to support custom target palette.
svn-id: r28367
-rw-r--r-- | engines/parallaction/graphics.cpp | 14 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 2 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 948f2a7b34..27e2de939d 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -226,11 +226,19 @@ void Gfx::makeGrayscalePalette(Palette pal) { return; } -void Gfx::fadePalette(Palette pal) { +void Gfx::fadePalette(Palette pal, Palette target, uint step) { + + if (step == 0) + return; for (uint16 i = 0; i < BASE_PALETTE_COLORS * 3; i++) { - if (pal[i] == _palette[i]) continue; - pal[i] += (pal[i] < _palette[i] ? 4 : -4); + if (pal[i] == target[i]) continue; + + if (pal[i] < target[i]) + pal[i] = CLIP(pal[i] + step, (uint)0, (uint)target[i]); + else + pal[i] = CLIP(pal[i] - step, (uint)target[i], (uint)255); + } return; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 11589b22cd..b7013d125e 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -210,7 +210,7 @@ public: void setBlackPalette(); void animatePalette(); void fadeInPalette(Palette palette); // fades palette (from black) to system palette - void fadePalette(Palette palette); // fades palette to system palette + void fadePalette(Palette palette, Palette target, uint step); // fades palette to target palette, with specified step void makeGrayscalePalette(Palette palette); // transform palette into black and white // amiga specific diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index e689a8e82d..024938074b 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -452,7 +452,7 @@ void Parallaction::doLocationEnterTransition() { // fades maximum intensity palette towards approximation of main palette for (uint16 _si = 0; _si<6; _si++) { - _gfx->fadePalette(pal); + _gfx->fadePalette(pal, _gfx->_palette, 4); _gfx->setPalette(pal); waitTime( 1 ); _gfx->updateScreen(); |