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 /engines/parallaction/graphics.cpp | |
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
Diffstat (limited to 'engines/parallaction/graphics.cpp')
-rw-r--r-- | engines/parallaction/graphics.cpp | 14 |
1 files changed, 11 insertions, 3 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; |