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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Oct 8 12:35:25 CEST 2010


Revision: 53068
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53068&view=rev
Author:   m_kiewitz
Date:     2010-10-08 10:35:25 +0000 (Fri, 08 Oct 2010)

Log Message:
-----------
SCI: add global scaling again to kAddToPic

fixes regression of r52887 - lb2 actors not scaled correctly bug #3083577

needs to get backported

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-10-08 08:19:22 UTC (rev 53067)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-10-08 10:35:25 UTC (rev 53068)
@@ -190,6 +190,34 @@
 	Common::sort(_list.begin(), _list.end(), sortHelper);
 }
 
+void GfxAnimate::applyGlobalScaling(AnimateList::iterator entry, GfxView *view) {
+	reg_t curObject = entry->object;
+
+	// Global scaling uses global var 2 and some other stuff to calculate scaleX/scaleY
+	int16 maxScale = readSelectorValue(_s->_segMan, curObject, SELECTOR(maxScale));
+	int16 celHeight = view->getHeight(entry->loopNo, entry->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));
+
+	int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
+	int16 fixedEntryY = entry->y - vanishingY;
+	if (!fixedEntryY)
+		fixedEntryY = 1;
+
+	if ((celHeight == 0) || (fixedPortY == 0))
+		error("global scaling panic");
+
+	entry->scaleY = ( maxCelHeight * fixedEntryY ) / fixedPortY;
+	entry->scaleY = (entry->scaleY * 128) / celHeight;
+
+	entry->scaleX = entry->scaleY;
+
+	// and set objects scale selectors
+	writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), entry->scaleX);
+	writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), entry->scaleY);
+}
+
 void GfxAnimate::fill(byte &old_picNotValid, bool maySetNsRect) {
 	reg_t curObject;
 	uint16 signal;
@@ -238,29 +266,7 @@
 			// Process global scaling, if needed
 			if (it->scaleSignal & kScaleSignalDoScaling) {
 				if (it->scaleSignal & kScaleSignalGlobalScaling) {
-					// Global scaling uses global var 2 and some other stuff to calculate scaleX/scaleY
-					int16 maxScale = readSelectorValue(_s->_segMan, curObject, SELECTOR(maxScale));
-					int16 celHeight = view->getHeight(it->loopNo, it->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));
-
-					int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
-					int16 fixedEntryY = it->y - vanishingY;
-					if (!fixedEntryY)
-						fixedEntryY = 1;
-
-					if ((celHeight == 0) || (fixedPortY == 0))
-						error("global scaling panic");
-
-					it->scaleY = ( maxCelHeight * fixedEntryY ) / fixedPortY;
-					it->scaleY = (it->scaleY * 128) / celHeight;
-
-					it->scaleX = it->scaleY;
-
-					// and set objects scale selectors
-					writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), it->scaleX);
-					writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), it->scaleY);
+					applyGlobalScaling(it, view);
 				}
 			}
 		}
@@ -568,6 +574,7 @@
 
 		// Create rect according to coordinates and given cel
 		if (it->scaleSignal & kScaleSignalDoScaling) {
+			applyGlobalScaling(it, view);
 			view->getCelScaledRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->scaleX, it->scaleY, it->celRect);
 			writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft), it->celRect.left);
 			writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop), it->celRect.top);

Modified: scummvm/trunk/engines/sci/graphics/animate.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.h	2010-10-08 08:19:22 UTC (rev 53067)
+++ scummvm/trunk/engines/sci/graphics/animate.h	2010-10-08 10:35:25 UTC (rev 53068)
@@ -84,6 +84,7 @@
 class GfxScreen;
 class GfxPalette;
 class GfxTransitions;
+class GfxView;
 /**
  * Animate class, kAnimate and relevant functions for SCI16 (SCI0-SCI1.1) games
  */
@@ -95,6 +96,7 @@
 	void disposeLastCast();
 	bool invoke(List *list, int argc, reg_t *argv);
 	void makeSortedList(List *list);
+	void applyGlobalScaling(AnimateList::iterator entry, GfxView *view);
 	void fill(byte &oldPicNotValid, bool maySetNsRect);
 	void update();
 	void drawCels();


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