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

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Feb 2 23:29:15 CET 2011


Revision: 55744
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55744&view=rev
Author:   mthreepwood
Date:     2011-02-02 22:29:14 +0000 (Wed, 02 Feb 2011)

Log Message:
-----------
SCI: Fix GK1 Mac scaling

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/compare.cpp
    scummvm/trunk/engines/sci/graphics/frameout.cpp
    scummvm/trunk/engines/sci/graphics/view.cpp

Modified: scummvm/trunk/engines/sci/graphics/compare.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/compare.cpp	2011-02-02 22:26:05 UTC (rev 55743)
+++ scummvm/trunk/engines/sci/graphics/compare.cpp	2011-02-02 22:29:14 UTC (rev 55744)
@@ -133,37 +133,22 @@
 	view = _cache->getView(viewId);
 
 #ifdef ENABLE_SCI32
-	switch (getSciVersion()) {
-	case SCI_VERSION_2:
-		if (view->isSci2Hires())
-			_screen->adjustToUpscaledCoordinates(y, x);
-		break;
-	case SCI_VERSION_2_1:
+	if (view->isSci2Hires())
+		_screen->adjustToUpscaledCoordinates(y, x);
+	else if (getSciVersion() == SCI_VERSION_2_1)
 		_coordAdjuster->fromScriptToDisplay(y, x);
-		break;
-	default:
-		break;
-	}
 #endif
 
 	view->getCelRect(loopNo, celNo, x, y, z, celRect);
 
 #ifdef ENABLE_SCI32
-	switch (getSciVersion()) {
-	case SCI_VERSION_2:
-		if (view->isSci2Hires()) {
-			_screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left);
-			_screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right);
-		}
-		break;
-	case SCI_VERSION_2_1: {
+	if (view->isSci2Hires()) {
+		_screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left);
+		_screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right);
+	} else if (getSciVersion() == SCI_VERSION_2_1) {
 		_coordAdjuster->fromDisplayToScript(celRect.top, celRect.left);
 		_coordAdjuster->fromDisplayToScript(celRect.bottom, celRect.right);
-		break;
 	}
-	default:
-		break;
-	}
 #endif
 
 	if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), NULL, NULL) == kSelectorVariable) {

Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp	2011-02-02 22:26:05 UTC (rev 55743)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp	2011-02-02 22:29:14 UTC (rev 55744)
@@ -446,22 +446,17 @@
 
 //				warning("view %s %04x:%04x", _segMan->getObjectName(itemEntry->object), PRINT_REG(itemEntry->object));
 
-				switch (getSciVersion()) {
-				case SCI_VERSION_2:
-					if (view->isSci2Hires()) {
-						int16 dummyX = 0;
-						_screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
-						_screen->adjustToUpscaledCoordinates(itemEntry->z, dummyX);
-					}
-					break;
-				case SCI_VERSION_2_1:
+
+				if (view->isSci2Hires()) {
+					int16 dummyX = 0;
+					_screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
+					_screen->adjustToUpscaledCoordinates(itemEntry->z, dummyX);
+				} else if (getSciVersion() == SCI_VERSION_2_1) {
 					itemEntry->y = (itemEntry->y * _screen->getHeight()) / scriptsRunningHeight;
 					itemEntry->x = (itemEntry->x * _screen->getWidth()) / scriptsRunningWidth;
 					itemEntry->z = (itemEntry->z * _screen->getHeight()) / scriptsRunningHeight;
-					break;
-				default:
-					break;
 				}
+
 				// Adjust according to current scroll position
 				itemEntry->x -= it->planeOffsetX;
 
@@ -487,22 +482,17 @@
 					Common::Rect nsRect = itemEntry->celRect;
 					// Translate back to actual coordinate within scrollable plane
 					nsRect.translate(it->planeOffsetX, 0);
-					switch (getSciVersion()) {
-					case SCI_VERSION_2:
-						if (view->isSci2Hires()) {
-							_screen->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left);
-							_screen->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right);
-						}
-						break;
-					case SCI_VERSION_2_1:
+
+					if (view->isSci2Hires()) {
+						_screen->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left);
+						_screen->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right);
+					} else if (getSciVersion() == SCI_VERSION_2_1) {
 						nsRect.top = (nsRect.top * scriptsRunningHeight) / _screen->getHeight();
 						nsRect.left = (nsRect.left * scriptsRunningWidth) / _screen->getWidth();
 						nsRect.bottom = (nsRect.bottom * scriptsRunningHeight) / _screen->getHeight();
 						nsRect.right = (nsRect.right * scriptsRunningWidth) / _screen->getWidth();
-						break;
-					default:
-						break;
 					}
+
 					writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsLeft), nsRect.left);
 					writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsTop), nsRect.top);
 					writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsRight), nsRect.right);

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2011-02-02 22:26:05 UTC (rev 55743)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2011-02-02 22:29:14 UTC (rev 55744)
@@ -281,25 +281,14 @@
 		}
 #ifdef ENABLE_SCI32
 		// adjust width/height returned to scripts
-		switch (getSciVersion()) {
-		case SCI_VERSION_2:
-			if (_isSci2Hires) {
-				for (loopNo = 0; loopNo < _loopCount; loopNo++) {
-					for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) {
-						_screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight);
-					}
-				}
-			}
-			break;
-
-		case SCI_VERSION_2_1:
-			for (loopNo = 0; loopNo < _loopCount; loopNo++) {
-				for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) {
+		if (_isSci2Hires) {
+			for (loopNo = 0; loopNo < _loopCount; loopNo++)
+				for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++)
+					_screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight);
+		} else if (getSciVersion() == SCI_VERSION_2_1) {
+			for (loopNo = 0; loopNo < _loopCount; loopNo++)
+				for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++)
 					_coordAdjuster->fromDisplayToScript(_loop[loopNo].cel[celNo].scriptHeight, _loop[loopNo].cel[celNo].scriptWidth);
-				}
-			}
-		default:
-			break;
 		}
 #endif
 		break;


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