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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jul 25 18:31:47 CEST 2010


Revision: 51275
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51275&view=rev
Author:   m_kiewitz
Date:     2010-07-25 16:31:46 +0000 (Sun, 25 Jul 2010)

Log Message:
-----------
SCI: sci32 coord adjustment changes

- fixes lsl6hires inventory

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/graphics/compare.cpp
    scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
    scummvm/trunk/engines/sci/graphics/coordadjuster.h

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-07-25 13:32:15 UTC (rev 51274)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-07-25 16:31:46 UTC (rev 51275)
@@ -50,7 +50,10 @@
 	// Limit the mouse cursor position, if necessary
 	g_sci->_gfxCursor->refreshPosition();
 	mousePos = g_sci->_gfxCursor->getPosition();
-	g_sci->_gfxCoordAdjuster->getEvent(mousePos);
+#ifdef ENABLE_SCI32
+	if (getSciVersion() >= SCI_VERSION_2_1)
+		g_sci->_gfxCoordAdjuster->fromDisplayToScript(mousePos.y, mousePos.x);
+#endif
 
 	// If there's a simkey pending, and the game wants a keyboard event, use the
 	// simkey instead of a normal event

Modified: scummvm/trunk/engines/sci/graphics/compare.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/compare.cpp	2010-07-25 13:32:15 UTC (rev 51274)
+++ scummvm/trunk/engines/sci/graphics/compare.cpp	2010-07-25 16:31:46 UTC (rev 51275)
@@ -139,7 +139,7 @@
 			_screen->adjustToUpscaledCoordinates(y, x);
 		break;
 	case SCI_VERSION_2_1:
-		_coordAdjuster->kernelLocalToGlobal(x, y, readSelector(_segMan, objectReference, SELECTOR(plane)));
+		_coordAdjuster->fromScriptToDisplay(y, x);
 		break;
 	default:
 		break;
@@ -157,9 +157,8 @@
 		}
 		break;
 	case SCI_VERSION_2_1: {
-		reg_t planeObj = readSelector(_segMan, objectReference, SELECTOR(plane));
-		_coordAdjuster->kernelGlobalToLocal(celRect.left, celRect.top, planeObj);
-		_coordAdjuster->kernelGlobalToLocal(celRect.right, celRect.bottom, planeObj);
+		_coordAdjuster->fromDisplayToScript(celRect.top, celRect.left);
+		_coordAdjuster->fromDisplayToScript(celRect.bottom, celRect.right);
 		break;
 	}
 	default:

Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	2010-07-25 13:32:15 UTC (rev 51274)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	2010-07-25 16:31:46 UTC (rev 51275)
@@ -122,11 +122,16 @@
 	scriptsRunningHeight = height;
 }
 
-void GfxCoordAdjuster32::getEvent(Common::Point &pos) {
-	pos.y = ((pos.y * scriptsRunningHeight) / g_sci->_gfxScreen->getHeight());
-	pos.x = ((pos.x * scriptsRunningWidth) / g_sci->_gfxScreen->getWidth());
+void GfxCoordAdjuster32::fromDisplayToScript(int16 &y, int16 &x) {
+	y = ((y * scriptsRunningHeight) / g_sci->_gfxScreen->getHeight());
+	x = ((x * scriptsRunningWidth) / g_sci->_gfxScreen->getWidth());
 }
 
+void GfxCoordAdjuster32::fromScriptToDisplay(int16 &y, int16 &x) {
+	y = ((y * g_sci->_gfxScreen->getHeight()) / scriptsRunningHeight);
+	x = ((x * g_sci->_gfxScreen->getWidth()) / scriptsRunningWidth);
+}
+
 void GfxCoordAdjuster32::pictureSetDisplayArea(Common::Rect displayArea) {
 	_pictureDisplayArea = displayArea;
 }

Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.h	2010-07-25 13:32:15 UTC (rev 51274)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.h	2010-07-25 16:31:46 UTC (rev 51275)
@@ -51,7 +51,8 @@
 	virtual void moveCursor(Common::Point &pos) { }
 
 	virtual void setScriptsResolution(uint16 width, uint16 height) { }
-	virtual void getEvent(Common::Point &pos) { }
+	virtual void fromScriptToDisplay(int16 &y, int16 &x) { }
+	virtual void fromDisplayToScript(int16 &y, int16 &x) { }
 
 	virtual Common::Rect pictureGetDisplayArea() { return Common::Rect(0, 0); }
 private:
@@ -89,7 +90,8 @@
 	Common::Rect onControl(Common::Rect rect);
 
 	void setScriptsResolution(uint16 width, uint16 height);
-	void getEvent(Common::Point &pos);
+	void fromScriptToDisplay(int16 &y, int16 &x);
+	void fromDisplayToScript(int16 &y, int16 &x);
 
 	void pictureSetDisplayArea(Common::Rect displayArea);
 	Common::Rect pictureGetDisplayArea();


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