aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2016-01-08 17:16:09 +0200
committerFilippos Karapetis2016-01-08 17:16:09 +0200
commit28b91136cd98353f48cb7d2501f49d8d30828889 (patch)
tree6324ed14a0f43d8346a97e74bb1ecccbb5069862
parent65f54c227f8d296acb819c2420bd10f26222457e (diff)
downloadscummvm-rg350-28b91136cd98353f48cb7d2501f49d8d30828889.tar.gz
scummvm-rg350-28b91136cd98353f48cb7d2501f49d8d30828889.tar.bz2
scummvm-rg350-28b91136cd98353f48cb7d2501f49d8d30828889.zip
SCI: Fix the math in applyFade(), and simplify setFade()
-rw-r--r--engines/sci/graphics/palette32.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index f7bf61fbec..95c4f99974 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -320,17 +320,15 @@ void GfxPalette32::applyFade() {
// TODO: Create and update a _nextPalette, not a single _sysPalette, to
// conform to the way the actual SCI32 engine works (writes to a
// next-frame-palette and then copies to the current palette on frameout)
- _sysPalette.colors[i].r *= _fadeTable[i] / 100;
- _sysPalette.colors[i].g *= _fadeTable[i] / 100;
- _sysPalette.colors[i].b *= _fadeTable[i] / 100;
+ _sysPalette.colors[i].r = (_sysPalette.colors[i].r * _fadeTable[i]) / 100;
+ _sysPalette.colors[i].g = (_sysPalette.colors[i].g * _fadeTable[i]) / 100;
+ _sysPalette.colors[i].b = (_sysPalette.colors[i].b * _fadeTable[i]) / 100;
}
}
void GfxPalette32::setFade(uint8 percent, uint16 fromColor, uint16 toColor) {
- uint8 *fadeAmount = _fadeTable;
- for (int i = fromColor, len = toColor - fromColor + 1; i < len; ++i) {
- *fadeAmount++ = percent;
- }
+ for (int i = fromColor; i <= toColor; i++)
+ _fadeTable[i] = percent;
}
void GfxPalette32::fadeOff() {