aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-11 21:47:44 +0000
committerMartin Kiewitz2010-08-11 21:47:44 +0000
commit06139e2be77960df89f3ca88223035add9802835 (patch)
tree9ed61612b80e886a8d0fc13975cb5ee54f9502b8
parent7e3b2bedb6bcffb172dda4f4436dc3dc89a0a649 (diff)
downloadscummvm-rg350-06139e2be77960df89f3ca88223035add9802835.tar.gz
scummvm-rg350-06139e2be77960df89f3ca88223035add9802835.tar.bz2
scummvm-rg350-06139e2be77960df89f3ca88223035add9802835.zip
SCI: properly doing kAnimate loop/cel fixing
really weird, but it works now. Bug #3037578 (kq5 trunk), bug #3043286 (lb1 knight) svn-id: r52007
-rw-r--r--engines/sci/graphics/animate.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 4aa19db9f4..b962e819a6 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -205,13 +205,28 @@ void GfxAnimate::fill(byte &old_picNotValid, bool maySetNsRect) {
view = _cache->getView(it->viewId);
// adjust loop and cel, if any of those is invalid
- if (it->loopNo >= view->getLoopCount()) {
+ // this seems to be completely crazy code
+ // sierra sci checked signed int16 to be above or equal the counts and reseted to 0 in those cases
+ // later during view processing those are compared unsigned again and then set to maximum count - 1
+ // Games rely on this behaviour. For example laura bow 1 has a knight standing around in room 37
+ // which has cel set to 3. This cel does not exist and the actual knight is 0
+ // In kq5 on the other hand during the intro, when the trunk is opened, cel is set to some real
+ // high number, which is negative when considered signed. This actually requires to get fixed to
+ // maximum cel, otherwise the trunk would be closed.
+ int16 viewLoopCount = view->getLoopCount();
+ if (it->loopNo >= viewLoopCount) {
it->loopNo = 0;
writeSelectorValue(_s->_segMan, curObject, SELECTOR(loop), it->loopNo);
+ } else if (it->loopNo < 0) {
+ it->loopNo = viewLoopCount - 1;
+ // not setting selector is right, sierra sci didn't do it during view processing as well
}
- if (it->celNo >= view->getCelCount(it->loopNo)) {
+ int16 viewCelCount = view->getCelCount(it->loopNo);
+ if (it->celNo >= viewCelCount) {
it->celNo = 0;
writeSelectorValue(_s->_segMan, curObject, SELECTOR(cel), it->celNo);
+ } else if (it->celNo < 0) {
+ it->celNo = viewCelCount - 1;
}
// Process global scaling, if needed