aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-07-19 21:13:47 -0500
committerColin Snover2017-07-23 10:35:13 -0500
commit9f33f2b3df22a26314dbb74173f49bc930c7a1f9 (patch)
tree122cabf7d44efa0bb007a4053ec1f0ee4fcff43a
parent970c312e76c2c3ca721fe6abe7bb4a6ba9533dcf (diff)
downloadscummvm-rg350-9f33f2b3df22a26314dbb74173f49bc930c7a1f9.tar.gz
scummvm-rg350-9f33f2b3df22a26314dbb74173f49bc930c7a1f9.tar.bz2
scummvm-rg350-9f33f2b3df22a26314dbb74173f49bc930c7a1f9.zip
SCI32: Don't warp the mouse when it doesn't need to be warped
-rw-r--r--engines/sci/graphics/cursor32.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index fc853bbfd6..c626487970 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -151,20 +151,28 @@ void GfxCursor32::setRestrictedArea(const Common::Rect &rect) {
mulru(_restrictedArea, Ratio(screenWidth, scriptWidth), Ratio(screenHeight, scriptHeight), 0);
+ bool restricted = false;
+
if (_position.x < rect.left) {
_position.x = rect.left;
+ restricted = true;
}
if (_position.x >= rect.right) {
_position.x = rect.right - 1;
+ restricted = true;
}
if (_position.y < rect.top) {
_position.y = rect.top;
+ restricted = true;
}
if (_position.y >= rect.bottom) {
_position.y = rect.bottom - 1;
+ restricted = true;
}
- g_system->warpMouse(_position.x, _position.y);
+ if (restricted) {
+ g_system->warpMouse(_position.x, _position.y);
+ }
}
void GfxCursor32::clearRestrictedArea() {
@@ -367,22 +375,31 @@ void GfxCursor32::donePainting() {
}
void GfxCursor32::deviceMoved(Common::Point &position) {
+ bool restricted = false;
+
if (position.x < _restrictedArea.left) {
position.x = _restrictedArea.left;
+ restricted = true;
}
if (position.x >= _restrictedArea.right) {
position.x = _restrictedArea.right - 1;
+ restricted = true;
}
if (position.y < _restrictedArea.top) {
position.y = _restrictedArea.top;
+ restricted = true;
}
if (position.y >= _restrictedArea.bottom) {
position.y = _restrictedArea.bottom - 1;
+ restricted = true;
}
_position = position;
- g_system->warpMouse(position.x, position.y);
+ if (restricted) {
+ g_system->warpMouse(position.x, position.y);
+ }
+
move();
}