aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/animate.cpp12
-rw-r--r--engines/sci/graphics/animate.h4
2 files changed, 9 insertions, 7 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 913b369790..ebfec34e4e 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -204,13 +204,15 @@ void GfxAnimate::fill(byte &old_picNotValid) {
// Get the corresponding view
view = _cache->getView(it->viewId);
+ uint16 viewLoopCount = view->getLoopCount();
// adjust loop and cel, if any of those is invalid
- if (it->loopNo >= view->getLoopCount()) {
- it->loopNo = 0;
+ if (it->loopNo >= viewLoopCount) {
+ it->loopNo = viewLoopCount - 1;
writeSelectorValue(_s->_segMan, curObject, SELECTOR(loop), it->loopNo);
}
- if (it->celNo >= view->getCelCount(it->loopNo)) {
- it->celNo = 0;
+ uint16 viewCelCount = view->getCelCount(it->loopNo);
+ if (it->celNo >= viewCelCount) {
+ it->celNo = viewCelCount - 1;
writeSelectorValue(_s->_segMan, curObject, SELECTOR(cel), it->celNo);
}
@@ -243,7 +245,7 @@ void GfxAnimate::fill(byte &old_picNotValid) {
}
}
- //warning("%s", _s->_segMan->getObjectName(curObject));
+ //warning("%s view %d, loop %d, cel %d", _s->_segMan->getObjectName(curObject), it->viewId, it->loopNo, it->celNo);
if (!view->isScaleable()) {
// Laura Bow 2 (especially floppy) depends on this, some views are not supposed to be scaleable
diff --git a/engines/sci/graphics/animate.h b/engines/sci/graphics/animate.h
index c2101e5384..c0d99a7ff5 100644
--- a/engines/sci/graphics/animate.h
+++ b/engines/sci/graphics/animate.h
@@ -60,8 +60,8 @@ struct AnimateEntry {
int16 givenOrderNo;
reg_t object;
GuiResourceId viewId;
- int16 loopNo;
- int16 celNo;
+ uint16 loopNo;
+ uint16 celNo;
int16 paletteNo;
int16 x, y, z;
int16 priority;