aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/toon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toon/toon.cpp')
-rw-r--r--engines/toon/toon.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 61b558ca6c..54a261fedc 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -1820,6 +1820,10 @@ int32 ToonEngine::getScaleAtPoint(int32 x, int32 y) {
if (!_currentMask)
return 1024;
+ // clamp values
+ x = MIN(1279, MAX(0, x));
+ y = MIN(399, MAX(0, y));
+
int32 maskData = _currentMask->getData(x, y) & 0x1f;
return _roomScaleData[maskData+2] * 1024 / 100;
}
@@ -1828,6 +1832,10 @@ int32 ToonEngine::getLayerAtPoint(int32 x, int32 y) {
if (!_currentMask)
return 0;
+ // clamp values
+ x = MIN(1279, MAX(0, x));
+ y = MIN(399, MAX(0, y));
+
int32 maskData = _currentMask->getData(x, y) & 0x1f;
return _roomScaleData[maskData+130] << 5;
}