aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-31 08:05:23 +0000
committerMartin Kiewitz2010-07-31 08:05:23 +0000
commite40ee138af219f934d8d420afd16e2713cb75aa9 (patch)
tree9012fc34ddd692a5c903bd14f6c0d50178a197fa
parent9deb52fba60f73be7d09406bd4dd89385b95742a (diff)
downloadscummvm-rg350-e40ee138af219f934d8d420afd16e2713cb75aa9.tar.gz
scummvm-rg350-e40ee138af219f934d8d420afd16e2713cb75aa9.tar.bz2
scummvm-rg350-e40ee138af219f934d8d420afd16e2713cb75aa9.zip
SCI: kAnimate - limit update of nsRect when scaled
only set nsRect when being drawn later (scaled only), fixes sq5 instant-death in elevator shaft svn-id: r51534
-rw-r--r--engines/sci/graphics/animate.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index f260ee41be..537505a926 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -182,6 +182,9 @@ void GfxAnimate::makeSortedList(List *list) {
// at the time of writing this comment, we work around that in our ordering
// comparator. If that changes in the future or we want to use some
// stable sorting algorithm here, we should change that.
+ // In that case we should test such changes intensively. A good place to test stable sort
+ // is iceman, cupboard within the submarine. If sort isn't stable, the cupboard will be
+ // half-open, half-closed. Of course that's just one of many special cases.
// Now sort the list according y and z (descending)
Common::sort(_list.begin(), _list.end(), sortHelper);
@@ -196,6 +199,7 @@ void GfxAnimate::fill(byte &old_picNotValid) {
for (it = _list.begin(); it != end; ++it) {
curObject = it->object;
+ signal = it->signal;
// Get the corresponding view
view = _cache->getView(it->viewId);
@@ -239,18 +243,23 @@ void GfxAnimate::fill(byte &old_picNotValid) {
}
}
+ bool setNsRect = true;
+
// Create rect according to coordinates and given cel
if (it->scaleSignal & kScaleSignalDoScaling) {
view->getCelScaledRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->scaleX, it->scaleY, it->celRect);
+ // when being scaled, only set nsRect, if object will get drawn
+ if ((signal & kSignalHidden) && !(signal & kSignalAlwaysUpdate))
+ setNsRect = false;
} else {
view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
}
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft), it->celRect.left);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop), it->celRect.top);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsRight), it->celRect.right);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsBottom), it->celRect.bottom);
-
- signal = it->signal;
+ if (setNsRect) {
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft), it->celRect.left);
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop), it->celRect.top);
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsRight), it->celRect.right);
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsBottom), it->celRect.bottom);
+ }
// Calculate current priority according to y-coordinate
if (!(signal & kSignalFixedPriority)) {