diff options
-rw-r--r-- | engines/scumm/scumm.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f2268c2a1a..c25603c48d 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1917,7 +1917,7 @@ void ScummEngine::scummLoop_updateScummVars() { VAR(VAR_CAMERA_POS_X) = camera._cur.x; VAR(VAR_CAMERA_POS_Y) = camera._cur.y; } else if (_game.version <= 2) { - VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8; + VAR(VAR_CAMERA_POS_X) = camera._cur.x / V12_X_MULTIPLIER; } else { VAR(VAR_CAMERA_POS_X) = camera._cur.x; } @@ -1934,8 +1934,11 @@ void ScummEngine::scummLoop_updateScummVars() { VAR(VAR_DEBUGMODE) = _debugMode; } } else if (_game.version >= 1) { - VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8; - VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2; + // We use shifts below instead of dividing by V12_X_MULTIPLIER resp. + // V12_Y_MULTIPLIER to handle negative coordinates correctly. + // This fixes e.g. bugs #1328131 and #1537595. + VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x >> 3; // V12_X_MULTIPLIER + VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y >> 1; // V12_X_MULTIPLIER // Adjust mouse coordinates as narrow rooms in NES are centered if (_game.platform == Common::kPlatformNES && _NESStartStrip > 0) { |