aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-11 05:20:29 +0000
committerMartin Kiewitz2010-08-11 05:20:29 +0000
commit42c3cc4c08ed720b39fedbc4463c07f31fefa4ef (patch)
tree569602b4d8cf46f3aafa22f45e8fc37011652954
parent7a7916421ab9d38fea89d9510f85c942d665c6be (diff)
downloadscummvm-rg350-42c3cc4c08ed720b39fedbc4463c07f31fefa4ef.tar.gz
scummvm-rg350-42c3cc4c08ed720b39fedbc4463c07f31fefa4ef.tar.bz2
scummvm-rg350-42c3cc4c08ed720b39fedbc4463c07f31fefa4ef.zip
SCI: kAnimate invalid loop/cels now correctly fixed
fixes kq5 trunk getting closed again during intro - is actually a script bug that sets cel to some really high number - bug #3037578, may also fix other similar issues svn-id: r51969
-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;