SCI: sci32 coord adjustment changes

- fixes lsl6hires inventory

svn-id: r51275
This commit is contained in:
Martin Kiewitz 2010-07-25 16:31:46 +00:00
parent 8145fea6b9
commit b3949cf4be
4 changed files with 19 additions and 10 deletions

View File

@ -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

View File

@ -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:

View File

@ -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) {

View File

@ -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();