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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Jun 23 16:06:31 CEST 2010


Revision: 50181
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50181&view=rev
Author:   m_kiewitz
Date:     2010-06-23 14:06:31 +0000 (Wed, 23 Jun 2010)

Log Message:
-----------
SCI: global scaling implemented (hopefully, i'm not sure if it works 100% :P) thx to waltervn for telling me the vocab 994 stuff used for disassembly

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-06-23 13:42:09 UTC (rev 50180)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-06-23 14:06:31 UTC (rev 50181)
@@ -233,18 +233,29 @@
 		// Process global scaling, if needed
 		if (listEntry->scaleSignal & kScaleSignalDoScaling) {
 			if (listEntry->scaleSignal & kScaleSignalGlobalScaling) {
-				warning("%lx:%lx", PRINT_REG(curObject));
 				// Global scaling uses global var 2 and some other stuff to calculate scaleX/scaleY
 				int16 maxScale = readSelectorValue(_s->_segMan, curObject, SELECTOR(maxScale));
-				int16 maxCelHeight = (maxScale * view->getHeight(listEntry->loopNo, listEntry->celNo)) >> 7;
-				reg_t globalVar2 = _s->variables[VAR_GLOBAL][1]; // current room
+				int16 celHeight = view->getHeight(listEntry->loopNo, listEntry->celNo);
+				int16 maxCelHeight = (maxScale * celHeight) >> 7;
+				reg_t globalVar2 = _s->variables[VAR_GLOBAL][2]; // current room object
 				int16 vanishingY = readSelectorValue(_s->_segMan, globalVar2, SELECTOR(vanishingY));
-				//warning("vanishingY %d maxScale %d", vanishingY, maxScale);
-				// TODO!
 
+				int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
+				int16 fixedEntryY = listEntry->y - vanishingY;
+				if (!fixedEntryY)
+					fixedEntryY = 1;
+
+				if ((celHeight == 0) || (fixedPortY == 0))
+					error("global scaling panic");
+
+				listEntry->scaleY = ( maxCelHeight * fixedEntryY ) / fixedPortY;
+				listEntry->scaleY = (listEntry->scaleY * 128) / celHeight;
+
+				listEntry->scaleX = listEntry->scaleY;
+
 				// and set objects scale selectors
-				//writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), listEntry->scaleX);
-				//writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), listEntry->scaleY);
+				writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), listEntry->scaleX);
+				writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), listEntry->scaleY);
 			}
 		}
 


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