diff options
-rw-r--r-- | engines/sci/graphics/compare.cpp | 29 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 36 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 25 |
3 files changed, 27 insertions, 63 deletions
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 6a99d2384e..5f6aef0153 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -133,36 +133,21 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) { view = _cache->getView(viewId); #ifdef ENABLE_SCI32 - switch (getSciVersion()) { - case SCI_VERSION_2: - if (view->isSci2Hires()) - _screen->adjustToUpscaledCoordinates(y, x); - break; - case SCI_VERSION_2_1: + if (view->isSci2Hires()) + _screen->adjustToUpscaledCoordinates(y, x); + else if (getSciVersion() == SCI_VERSION_2_1) _coordAdjuster->fromScriptToDisplay(y, x); - break; - default: - break; - } #endif view->getCelRect(loopNo, celNo, x, y, z, celRect); #ifdef ENABLE_SCI32 - switch (getSciVersion()) { - case SCI_VERSION_2: - if (view->isSci2Hires()) { - _screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left); - _screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right); - } - break; - case SCI_VERSION_2_1: { + if (view->isSci2Hires()) { + _screen->adjustBackUpscaledCoordinates(celRect.top, celRect.left); + _screen->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right); + } else if (getSciVersion() == SCI_VERSION_2_1) { _coordAdjuster->fromDisplayToScript(celRect.top, celRect.left); _coordAdjuster->fromDisplayToScript(celRect.bottom, celRect.right); - break; - } - default: - break; } #endif diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index ced9c00683..ff148da9df 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -446,22 +446,17 @@ void GfxFrameout::kernelFrameout() { // warning("view %s %04x:%04x", _segMan->getObjectName(itemEntry->object), PRINT_REG(itemEntry->object)); - switch (getSciVersion()) { - case SCI_VERSION_2: - if (view->isSci2Hires()) { - int16 dummyX = 0; - _screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x); - _screen->adjustToUpscaledCoordinates(itemEntry->z, dummyX); - } - break; - case SCI_VERSION_2_1: + + if (view->isSci2Hires()) { + int16 dummyX = 0; + _screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x); + _screen->adjustToUpscaledCoordinates(itemEntry->z, dummyX); + } else if (getSciVersion() == SCI_VERSION_2_1) { itemEntry->y = (itemEntry->y * _screen->getHeight()) / scriptsRunningHeight; itemEntry->x = (itemEntry->x * _screen->getWidth()) / scriptsRunningWidth; itemEntry->z = (itemEntry->z * _screen->getHeight()) / scriptsRunningHeight; - break; - default: - break; } + // Adjust according to current scroll position itemEntry->x -= it->planeOffsetX; @@ -487,22 +482,17 @@ void GfxFrameout::kernelFrameout() { Common::Rect nsRect = itemEntry->celRect; // Translate back to actual coordinate within scrollable plane nsRect.translate(it->planeOffsetX, 0); - switch (getSciVersion()) { - case SCI_VERSION_2: - if (view->isSci2Hires()) { - _screen->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left); - _screen->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right); - } - break; - case SCI_VERSION_2_1: + + if (view->isSci2Hires()) { + _screen->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left); + _screen->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right); + } else if (getSciVersion() == SCI_VERSION_2_1) { nsRect.top = (nsRect.top * scriptsRunningHeight) / _screen->getHeight(); nsRect.left = (nsRect.left * scriptsRunningWidth) / _screen->getWidth(); nsRect.bottom = (nsRect.bottom * scriptsRunningHeight) / _screen->getHeight(); nsRect.right = (nsRect.right * scriptsRunningWidth) / _screen->getWidth(); - break; - default: - break; } + writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsLeft), nsRect.left); writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsTop), nsRect.top); writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsRight), nsRect.right); diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 458b147795..2e6b0f1bbe 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -281,25 +281,14 @@ void GfxView::initData(GuiResourceId resourceId) { } #ifdef ENABLE_SCI32 // adjust width/height returned to scripts - switch (getSciVersion()) { - case SCI_VERSION_2: - if (_isSci2Hires) { - for (loopNo = 0; loopNo < _loopCount; loopNo++) { - for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) { - _screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight); - } - } - } - break; - - case SCI_VERSION_2_1: - for (loopNo = 0; loopNo < _loopCount; loopNo++) { - for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) { + if (_isSci2Hires) { + for (loopNo = 0; loopNo < _loopCount; loopNo++) + for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) + _screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight); + } else if (getSciVersion() == SCI_VERSION_2_1) { + for (loopNo = 0; loopNo < _loopCount; loopNo++) + for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) _coordAdjuster->fromDisplayToScript(_loop[loopNo].cel[celNo].scriptHeight, _loop[loopNo].cel[celNo].scriptWidth); - } - } - default: - break; } #endif break; |