aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-20 16:14:34 +0100
committerMartin Kiewitz2016-02-20 16:15:01 +0100
commitdda637e7ac3d54c72bb5e6f8639f439e2f26ecf9 (patch)
tree67cfe9f54c6e09ee79a07e759b827625f572b902 /engines
parent9cb7caeb247adbc60ab67045c79ee24f3f497026 (diff)
downloadscummvm-rg350-dda637e7ac3d54c72bb5e6f8639f439e2f26ecf9.tar.gz
scummvm-rg350-dda637e7ac3d54c72bb5e6f8639f439e2f26ecf9.tar.bz2
scummvm-rg350-dda637e7ac3d54c72bb5e6f8639f439e2f26ecf9.zip
SCI32: kIsOnMe apply scaling + use mulru() thx snover
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/frameout.cpp24
-rw-r--r--engines/sci/graphics/screen_item32.h2
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