diff options
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/actor.cpp | 26 | ||||
-rw-r--r-- | engines/scumm/actor.h | 5 | ||||
-rw-r--r-- | engines/scumm/object.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 6 |
4 files changed, 22 insertions, 19 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index fccd07106d..295bb1b036 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -2368,27 +2368,27 @@ void Actor::saveLoadWithSerializer(Serializer *ser) { ser->saveLoadEntries(this, actorEntries); if (ser->isLoading() && _vm->_game.version <= 2 && ser->getVersion() < VER(70)) { - _pos.x /= V12_X_MULTIPLIER; - _pos.y /= V12_Y_MULTIPLIER; + _pos.x >>= V12_X_SHIFT; + _pos.y >>= V12_Y_SHIFT; - _speedx /= V12_X_MULTIPLIER; - _speedy /= V12_Y_MULTIPLIER; - _elevation /= V12_Y_MULTIPLIER; + _speedx >>= V12_X_SHIFT; + _speedy >>= V12_Y_SHIFT; + _elevation >>= V12_Y_SHIFT; if (_walkdata.dest.x != -1) { - _walkdata.dest.x /= V12_X_MULTIPLIER; - _walkdata.dest.y /= V12_Y_MULTIPLIER; + _walkdata.dest.x >>= V12_X_SHIFT; + _walkdata.dest.y >>= V12_Y_SHIFT; } - _walkdata.cur.x /= V12_X_MULTIPLIER; - _walkdata.cur.y /= V12_Y_MULTIPLIER; + _walkdata.cur.x >>= V12_X_SHIFT; + _walkdata.cur.y >>= V12_Y_SHIFT; - _walkdata.next.x /= V12_X_MULTIPLIER; - _walkdata.next.y /= V12_Y_MULTIPLIER; + _walkdata.next.x >>= V12_X_SHIFT; + _walkdata.next.y >>= V12_Y_SHIFT; if (_walkdata.point3.x != 32000) { - _walkdata.point3.x /= V12_X_MULTIPLIER; - _walkdata.point3.y /= V12_Y_MULTIPLIER; + _walkdata.point3.x >>= V12_X_SHIFT; + _walkdata.point3.y >>= V12_Y_SHIFT; } } } diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index f590f61e11..31200f6296 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -35,7 +35,10 @@ namespace Scumm { enum { V12_X_MULTIPLIER = 8, - V12_Y_MULTIPLIER = 2 + V12_Y_MULTIPLIER = 2, + + V12_X_SHIFT = 3, + V12_Y_SHIFT = 1 }; enum MoveFlags { diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index b3c3b9cb8a..783cbdea6b 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -413,8 +413,8 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { y = od.y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y); } } else if (_game.version <= 2) { - x = od.walk_x / V12_X_MULTIPLIER; - y = od.walk_y / V12_Y_MULTIPLIER; + x = od.walk_x >> V12_X_SHIFT; + y = od.walk_y >> V12_Y_SHIFT; } else { x = od.walk_x; y = od.walk_y; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index c25603c48d..c3e7d9ef45 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 / V12_X_MULTIPLIER; + VAR(VAR_CAMERA_POS_X) = camera._cur.x >> V12_X_SHIFT; } else { VAR(VAR_CAMERA_POS_X) = camera._cur.x; } @@ -1937,8 +1937,8 @@ void ScummEngine::scummLoop_updateScummVars() { // 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 + VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x >> V12_X_SHIFT; + VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y >> V12_Y_SHIFT; // Adjust mouse coordinates as narrow rooms in NES are centered if (_game.platform == Common::kPlatformNES && _NESStartStrip > 0) { |