diff options
Diffstat (limited to 'engines/sci/graphics/screen.cpp')
-rw-r--r-- | engines/sci/graphics/screen.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index d544dad26f..1838ba779d 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -32,6 +32,7 @@ #include "sci/sci.h" #include "sci/engine/state.h" #include "sci/graphics/screen.h" +#include "sci/graphics/view.h" namespace Sci { @@ -695,12 +696,45 @@ void GfxScreen::scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHei } } -void GfxScreen::adjustToUpscaledCoordinates(int16 &y, int16 &x) { +typedef struct { + GfxScreenUpscaledMode gameHiresMode; + Sci32ViewNativeResolution viewNativeRes; + int numerator; + int denominator; +} UpScaledAdjust; + +UpScaledAdjust upscaledAdjustTable[] = { + {GFX_SCREEN_UPSCALED_640x480, SCI_VIEW_NATIVERES_640x400, 5, 6}, +}; + +int upscaledAdjustTableSize = ARRAYSIZE(upscaledAdjustTable); + +void GfxScreen::adjustToUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) { x *= 2; y = _upscaledMapping[y]; + + for (int i = 0; i < upscaledAdjustTableSize; i++) + { + if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires && + upscaledAdjustTable[i].viewNativeRes == viewNativeRes) + { + y = (y * upscaledAdjustTable[i].numerator) / upscaledAdjustTable[i].denominator; + break; + } + } } -void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x) { +void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) { + for (int i = 0; i < upscaledAdjustTableSize; i++) + { + if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires && + upscaledAdjustTable[i].viewNativeRes == viewNativeRes) + { + y = (y * upscaledAdjustTable[i].denominator) / upscaledAdjustTable[i].numerator; + break; + } + } + switch (_upscaledHires) { case GFX_SCREEN_UPSCALED_640x400: x /= 2; |