diff options
author | Martin Kiewitz | 2010-07-20 21:22:39 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-20 21:22:39 +0000 |
commit | 2a47f573ddad57655556ccc9b91753987aedb681 (patch) | |
tree | 5439a502bfdfabbbc674a9423526c9aa84524f3f /engines/sci | |
parent | 8e24b7930cd306d84288a3d085dfc99d6fb19f4e (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 1 | ||||
-rw-r--r-- | engines/sci/graphics/coordadjuster.cpp | 41 |
4 files changed, 40 insertions, 20 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 6e5395e995..efb41bcf1d 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -447,6 +447,7 @@ static const SciKernelMapSubEntry kGraph_subops[] = { // version, subId, function-mapping, signature, workarounds static const SciKernelMapSubEntry kPalVary_subops[] = { + { SIG_SCI21, 0, MAP_CALL(PalVaryInit), "ii(i)(i)(i)", NULL }, { SIG_SCIALL, 0, MAP_CALL(PalVaryInit), "ii(i)(i)", NULL }, { SIG_SCIALL, 1, MAP_CALL(PalVaryReverse), "(i)(i)(i)", NULL }, { SIG_SCIALL, 2, MAP_CALL(PalVaryGetCurrentStep), "", NULL }, @@ -521,7 +522,8 @@ static const SciKernelMapSubEntry kList_subops[] = { // be something like ListAt instead... If we swap the two subops though, // Torin demo crashes complaining that it tried to send to a non-object, // therefore the semantics might be different here (signature was l[o0]) - { SIG_SCI21, 18, MAP_CALL(StubNull), "li", NULL }, + // In SQ6 object is passed right when skipping the intro + { SIG_SCI21, 18, MAP_CALL(StubNull), "l[io]", NULL }, { SIG_SCI21, 19, MAP_CALL(ListEachElementDo), "li(.*)", NULL }, { SIG_SCI21, 20, MAP_CALL(ListFirstTrue), "li(.*)", NULL }, { SIG_SCI21, 21, MAP_CALL(ListAllTrue), "li(.*)", NULL }, diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index f484a8bc45..c0e6a56b5e 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -861,8 +861,8 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) { // Get the object's plane reg_t planeObject = readSelector(s->_segMan, targetObject, SELECTOR(plane)); if (!planeObject.isNull()) { - uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x)); - uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y)); + //uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x)); + //uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y)); uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY)); uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX)); uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top)); @@ -872,12 +872,12 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) { // Adjust the bounding rectangle of the object by the object's // actual X, Y coordinates - itemY = ((itemY * g_sci->_gfxScreen->getHeight()) / planeResY); - itemX = ((itemX * g_sci->_gfxScreen->getWidth()) / planeResX); - itemY += planeTop; - itemX += planeLeft; + nsRect.top = ((nsRect.top * g_sci->_gfxScreen->getHeight()) / planeResY); + nsRect.left = ((nsRect.left * g_sci->_gfxScreen->getWidth()) / planeResX); + nsRect.bottom = ((nsRect.bottom * g_sci->_gfxScreen->getHeight()) / planeResY); + nsRect.right = ((nsRect.right * g_sci->_gfxScreen->getWidth()) / planeResX); - nsRect.translate(itemX, itemY); + nsRect.translate(planeLeft, planeTop); } //warning("kIsOnMe: (%d, %d) on object %04x:%04x, parameter %d", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]), argv[3].toUint16()); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index e1352477a0..338f530827 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -426,6 +426,7 @@ static const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_SQ4, -1, 928, 0, "Narrator", "startText", -1, 1000, { FAKE, 1 } }, // sq4cd: method returns this to the caller { GID_SQ6, 100, 0, 0, "SQ6", "init", -1, 2, { FAKE, 0 } }, // called when the game starts { GID_SQ6, 100, 64950, 0, "View", "handleEvent", -1, 0, { FAKE, 0 } }, // called when pressing "Start game" in the main menu + { GID_SQ6, -1, 64964, 0, "DPath", "init", -1, 1, { FAKE, 0 } }, // during the game SCI_WORKAROUNDENTRY_TERMINATOR }; 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) { |