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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Aug 11 07:20:29 CEST 2010


Revision: 51969
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51969&view=rev
Author:   m_kiewitz
Date:     2010-08-11 05:20:29 +0000 (Wed, 11 Aug 2010)

Log Message:
-----------
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

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

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-08-11 03:39:51 UTC (rev 51968)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-08-11 05:20:29 UTC (rev 51969)
@@ -204,13 +204,15 @@
 		// 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 @@
 			}
 		}
 
-		//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

Modified: scummvm/trunk/engines/sci/graphics/animate.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.h	2010-08-11 03:39:51 UTC (rev 51968)
+++ scummvm/trunk/engines/sci/graphics/animate.h	2010-08-11 05:20:29 UTC (rev 51969)
@@ -60,8 +60,8 @@
 	int16 givenOrderNo;
 	reg_t object;
 	GuiResourceId viewId;
-	int16 loopNo;
-	int16 celNo;
+	uint16 loopNo;
+	uint16 celNo;
 	int16 paletteNo;
 	int16 x, y, z;
 	int16 priority;


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