diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 24 | ||||
-rw-r--r-- | engines/sci/graphics/screen_item32.h | 2 |
2 files changed, 12 insertions, 14 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index a49ea08b82..6613b6b88c 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -1908,27 +1908,23 @@ uint16 GfxFrameout::isOnMe(Plane *screenItemPlane, ScreenItem *screenItem, int16 //warning("Check Pixels"); CelObj &screenItemCelObject = screenItem->getCelObj(); - int32 celAdjustedX = adjustedX; - int32 celAdjustedY = adjustedY; + Common::Point celAdjustedPoint(adjustedX, adjustedY); bool celMirrored = screenItem->_mirrorX ^ screenItemCelObject._mirrorX; - celAdjustedX -= screenItem->_scaledPosition.x; - celAdjustedY -= screenItem->_scaledPosition.y; + celAdjustedPoint.x -= screenItem->_scaledPosition.x; + celAdjustedPoint.y -= screenItem->_scaledPosition.y; - celAdjustedX = celAdjustedX * screenItemCelObject._scaledWidth / getCurrentBuffer().screenWidth; - celAdjustedY = celAdjustedY * screenItemCelObject._scaledHeight / getCurrentBuffer().screenHeight; + Ratio celAdjustXRatio(screenItemCelObject._scaledWidth, getCurrentBuffer().screenWidth); + Ratio celAdjustYRatio(screenItemCelObject._scaledHeight, getCurrentBuffer().screenHeight); + mulru(celAdjustedPoint, celAdjustXRatio, celAdjustYRatio); - // if adjustedX/Y larger than width/height divide again?? - // + if >0 afterwards increase by 1 - -#if 0 if ((screenItem->_scale.signal) && (screenItem->_scale.x) && (screenItem->_scale.y)) { - celAdjustedX = celAdjustedX * 128 / screenItem->_scale.x; - celAdjustedY = celAdjustedY * 128 / screenItem->_scale.y; + // Apply scaling + celAdjustedPoint.x = celAdjustedPoint.x * 128 / screenItem->_scale.x; + celAdjustedPoint.y = celAdjustedPoint.y * 128 / screenItem->_scale.y; } -#endif - byte coordinateColor = screenItemCelObject.readPixel(celAdjustedX, celAdjustedY, celMirrored); + byte coordinateColor = screenItemCelObject.readPixel(celAdjustedPoint.x, celAdjustedPoint.y, celMirrored); byte transparentColor = screenItemCelObject._transparentColor; if (coordinateColor == transparentColor) { diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h index d3968efeef..0ca840a13a 100644 --- a/engines/sci/graphics/screen_item32.h +++ b/engines/sci/graphics/screen_item32.h @@ -69,6 +69,7 @@ private: */ reg_t _plane; +public: /** * Scaling data used to calculate the final screen * dimensions of the screen item as well as the scaling @@ -76,6 +77,7 @@ private: */ ScaleInfo _scale; +private: /** * The position & dimensions of the screen item in * screen coordinates. This rect includes the offset |