aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-25 16:31:46 +0000
committerMartin Kiewitz2010-07-25 16:31:46 +0000
commitb3949cf4be02136c633becd841a4a5e45033f8d5 (patch)
treeb7af657a4fa0361e1c6d21d4e78fadbf4377718c /engines/sci
parent8145fea6b9afdc90f1a24ce845133e46ac3f68ff (diff)
downloadscummvm-rg350-b3949cf4be02136c633becd841a4a5e45033f8d5.tar.gz
scummvm-rg350-b3949cf4be02136c633becd841a4a5e45033f8d5.tar.bz2
scummvm-rg350-b3949cf4be02136c633becd841a4a5e45033f8d5.zip
SCI: sci32 coord adjustment changes
- fixes lsl6hires inventory svn-id: r51275
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kevent.cpp5
-rw-r--r--engines/sci/graphics/compare.cpp7
-rw-r--r--engines/sci/graphics/coordadjuster.cpp11
-rw-r--r--engines/sci/graphics/coordadjuster.h6
4 files changed, 19 insertions, 10 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 93bdb5ccf3..3395811700 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -50,7 +50,10 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
// 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
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index c67126bfba..46ccd84e7f 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -139,7 +139,7 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
_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 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
}
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:
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 70b04b37bf..468c41f1c1 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -122,9 +122,14 @@ void GfxCoordAdjuster32::setScriptsResolution(uint16 width, uint16 height) {
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) {
diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h
index 8b9144981c..7e5d2351b9 100644
--- a/engines/sci/graphics/coordadjuster.h
+++ b/engines/sci/graphics/coordadjuster.h
@@ -51,7 +51,8 @@ public:
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 @@ public:
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();