[Scummvm-cvs-logs] SF.net SVN: scummvm:[51534] scummvm/trunk/engines/sci/graphics/animate.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jul 31 10:05:23 CEST 2010


Revision: 51534
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51534&view=rev
Author:   m_kiewitz
Date:     2010-07-31 08:05:23 +0000 (Sat, 31 Jul 2010)

Log Message:
-----------
SCI: kAnimate - limit update of nsRect when scaled

only set nsRect when being drawn later (scaled only), fixes sq5 instant-death in elevator shaft

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/animate.cpp

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-07-31 07:37:06 UTC (rev 51533)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-07-31 08:05:23 UTC (rev 51534)
@@ -182,6 +182,9 @@
 	// 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 @@
 
 	for (it = _list.begin(); it != end; ++it) {
 		curObject = it->object;
+		signal = it->signal;
 
 		// Get the corresponding view
 		view = _cache->getView(it->viewId);
@@ -239,19 +243,24 @@
 			}
 		}
 
+		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);
+		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);
+		}
 
-		signal = it->signal;
-
 		// Calculate current priority according to y-coordinate
 		if (!(signal & kSignalFixedPriority)) {
 			it->priority = _ports->kernelCoordinateToPriority(it->y);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list