aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-20 21:22:39 +0000
committerMartin Kiewitz2010-07-20 21:22:39 +0000
commit2a47f573ddad57655556ccc9b91753987aedb681 (patch)
tree5439a502bfdfabbbc674a9423526c9aa84524f3f /engines/sci/graphics
parent8e24b7930cd306d84288a3d085dfc99d6fb19f4e (diff)
downloadscummvm-rg350-2a47f573ddad57655556ccc9b91753987aedb681.tar.gz
scummvm-rg350-2a47f573ddad57655556ccc9b91753987aedb681.tar.bz2
scummvm-rg350-2a47f573ddad57655556ccc9b91753987aedb681.zip
SCI: some sci32 fixes
kOnMe, kLocal2Global, kGlobal2Local now hires capable, hotspots seem to work in lsl6 and sq6, although pressing on start in sq6 doesn't work yet, you need to click on the rightmost/bottom area svn-id: r51074
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/coordadjuster.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 9481a68f13..fbeffa7cd2 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -31,6 +31,7 @@
#include "sci/engine/selector.h"
#include "sci/graphics/coordadjuster.h"
#include "sci/graphics/ports.h"
+#include "sci/graphics/screen.h"
namespace Sci {
@@ -94,20 +95,36 @@ GfxCoordAdjuster32::~GfxCoordAdjuster32() {
}
void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
- //int16 resY = readSelectorValue(_s->_segMan, planeObj, SELECTOR(resY));
- //int16 resX = readSelectorValue(_s->_segMan, planeObj, SELECTOR(resX));
- //*x = ( *x * _screen->getWidth()) / resX;
- //*y = ( *y * _screen->getHeight()) / resY;
- x -= readSelectorValue(_segMan, planeObject, SELECTOR(left));
- y -= readSelectorValue(_segMan, planeObject, SELECTOR(top));
+ EngineState *s = g_sci->getEngineState();
+ uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY));
+ uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX));
+ uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top));
+ uint16 planeLeft = readSelectorValue(s->_segMan, planeObject, SELECTOR(left));
+
+ planeTop = (planeTop * g_sci->_gfxScreen->getHeight()) / planeResY;
+ planeLeft = (planeLeft * g_sci->_gfxScreen->getWidth()) / planeResX;
+
+ y -= planeTop;
+ x -= planeLeft;
+
+ y = ((y * planeResY) / g_sci->_gfxScreen->getHeight());
+ x = ((x * planeResX) / g_sci->_gfxScreen->getWidth());
}
void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
- //int16 resY = readSelectorValue(_s->_segMan, planeObj, SELECTOR(resY));
- //int16 resX = readSelectorValue(_s->_segMan, planeObj, SELECTOR(resX));
- x += readSelectorValue(_segMan, planeObject, SELECTOR(left));
- y += readSelectorValue(_segMan, planeObject, SELECTOR(top));
- //*x = ( *x * resX) / _screen->getWidth();
- //*y = ( *y * resY) / _screen->getHeight();
+ EngineState *s = g_sci->getEngineState();
+ uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY));
+ uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX));
+ uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top));
+ uint16 planeLeft = readSelectorValue(s->_segMan, planeObject, SELECTOR(left));
+
+ planeTop = (planeTop * g_sci->_gfxScreen->getHeight()) / planeResY;
+ planeLeft = (planeLeft * g_sci->_gfxScreen->getWidth()) / planeResX;
+
+ y = ((y * g_sci->_gfxScreen->getHeight()) / planeResY);
+ x = ((x * g_sci->_gfxScreen->getWidth()) / planeResX);
+
+ x += planeLeft;
+ y += planeTop;
}
Common::Rect GfxCoordAdjuster32::onControl(Common::Rect rect) {