aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2016-07-09 19:37:18 -0500
committerColin Snover2016-07-11 10:39:50 -0500
commit60c36631425755cbb9d7b06637b129b0e9b4a9da (patch)
tree01330e18a416c8028c62ea86d6271c247bab6eb4 /engines/sci
parentbc362e5b7cf5867946adc45c3a961050323e14b5 (diff)
downloadscummvm-rg350-60c36631425755cbb9d7b06637b129b0e9b4a9da.tar.gz
scummvm-rg350-60c36631425755cbb9d7b06637b129b0e9b4a9da.tar.bz2
scummvm-rg350-60c36631425755cbb9d7b06637b129b0e9b4a9da.zip
SCI32: Fix incorrect logic of cycler overflow
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/palette32.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index 4ee33bdd38..9d1cc655b9 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -651,18 +651,15 @@ void GfxPalette32::setCycle(const uint8 fromColor, const uint8 toColor, const in
// SCI engine overrides the first oldest cycler that it finds where
// “oldest” is determined by the difference between the tick and now
if (cycler == nullptr) {
- int maxUpdateDelta = -1;
- // Optimization: Unlike actual SCI (SQ6) engine, we call
- // getTickCount only once and store it, instead of calling it
- // twice on each iteration through the loop
const uint32 now = g_sci->getTickCount();
+ uint32 minUpdateDelta = 0xFFFFFFFF;
for (cyclerIndex = 0; cyclerIndex < numCyclers; ++cyclerIndex) {
PalCycler *candidate = _cyclers[cyclerIndex];
- const int32 updateDelta = now - candidate->lastUpdateTick;
- if (updateDelta >= maxUpdateDelta) {
- maxUpdateDelta = updateDelta;
+ const uint32 updateDelta = now - candidate->lastUpdateTick;
+ if (updateDelta < minUpdateDelta) {
+ minUpdateDelta = updateDelta;
cycler = candidate;
}
}