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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Jun 30 17:44:26 CEST 2010


Revision: 50536
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50536&view=rev
Author:   m_kiewitz
Date:     2010-06-30 15:44:26 +0000 (Wed, 30 Jun 2010)

Log Message:
-----------
SCI: adjust brRect and nsRect, if sci2 hires views are used, fixes hotspots in gk1

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/compare.cpp
    scummvm/trunk/engines/sci/graphics/cursor.cpp
    scummvm/trunk/engines/sci/graphics/screen.cpp
    scummvm/trunk/engines/sci/graphics/screen.h

Modified: scummvm/trunk/engines/sci/graphics/compare.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/compare.cpp	2010-06-30 15:26:45 UTC (rev 50535)
+++ scummvm/trunk/engines/sci/graphics/compare.cpp	2010-06-30 15:44:26 UTC (rev 50536)
@@ -130,10 +130,18 @@
 	if (SELECTOR(z) > -1)
 		z = (int16)readSelectorValue(_segMan, objectReference, SELECTOR(z));
 
-	// now get cel rectangle
 	view = _cache->getView(viewId);
+
+	if (view->isSci2Hires())
+		_screen->adjustToUpscaledCoordinates(y, x);
+
 	view->getCelRect(loopNo, celNo, x, y, z, celRect);
 
+	if (view->isSci2Hires()) {
+		_screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left);
+		_screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right);
+	}
+
 	if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), NULL, NULL) == kSelectorVariable) {
 		writeSelectorValue(_segMan, objectReference, SELECTOR(nsLeft), celRect.left);
 		writeSelectorValue(_segMan, objectReference, SELECTOR(nsRight), celRect.right);
@@ -200,7 +208,16 @@
 		GfxView *tmpView = _cache->getView(viewId);
 		Common::Rect celRect;
 
+		if (tmpView->isSci2Hires())
+			_screen->adjustToUpscaledCoordinates(y, x);
+
 		tmpView->getCelRect(loopNo, celNo, x, y, z, celRect);
+
+		if (tmpView->isSci2Hires()) {
+			_screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left);
+			_screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right);
+		}
+
 		celRect.bottom = y + 1;
 		celRect.top = celRect.bottom - yStep;
 

Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp	2010-06-30 15:26:45 UTC (rev 50535)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp	2010-06-30 15:44:26 UTC (rev 50536)
@@ -276,21 +276,8 @@
 Common::Point GfxCursor::getPosition() {
 	Common::Point mousePos = g_system->getEventManager()->getMousePos();
 
-	switch (_upscaledHires) {
-	case GFX_SCREEN_UPSCALED_640x400:
-		mousePos.x /= 2;
-		mousePos.y /= 2;
-		break;
-	case GFX_SCREEN_UPSCALED_640x440:
-		mousePos.x /= 2;
-		mousePos.y = (mousePos.y * 5) / 11;
-		break;
-	case GFX_SCREEN_UPSCALED_640x480:
-		mousePos.x /= 2;
-		mousePos.y = (mousePos.y * 5) / 12;
-	default:
-		break;
-	}
+	if (_upscaledHires)
+		_screen->adjustBackUpscaledCoordinates(mousePos.y, mousePos.x);
 
 	return mousePos;
 }

Modified: scummvm/trunk/engines/sci/graphics/screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/screen.cpp	2010-06-30 15:26:45 UTC (rev 50535)
+++ scummvm/trunk/engines/sci/graphics/screen.cpp	2010-06-30 15:44:26 UTC (rev 50536)
@@ -617,6 +617,24 @@
 	y = _upscaledMapping[y];
 }
 
+void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x) {
+	switch (_upscaledHires) {
+	case GFX_SCREEN_UPSCALED_640x400:
+		x /= 2;
+		y /= 2;
+		break;
+	case GFX_SCREEN_UPSCALED_640x440:
+		x /= 2;
+		y = (y * 5) / 11;
+		break;
+	case GFX_SCREEN_UPSCALED_640x480:
+		x /= 2;
+		y = (y * 5) / 12;
+	default:
+		break;
+	}
+}
+
 int16 GfxScreen::kernelPicNotValid(int16 newPicNotValid) {
 	int16 oldPicNotValid;
 

Modified: scummvm/trunk/engines/sci/graphics/screen.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/screen.h	2010-06-30 15:26:45 UTC (rev 50535)
+++ scummvm/trunk/engines/sci/graphics/screen.h	2010-06-30 15:44:26 UTC (rev 50536)
@@ -112,6 +112,7 @@
 	void scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight);
 
 	void adjustToUpscaledCoordinates(int16 &y, int16 &x);
+	void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
 
 	void dither(bool addToFlag);
 	void debugUnditherSetState(bool flag);


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