aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-02-15 18:12:29 +0000
committerMax Horn2007-02-15 18:12:29 +0000
commitdc5ef8425ba63b0901ed08017be43f749573cdec (patch)
tree6b74c949bb3384153c65532f2b30d1ea75f65574 /engines/scumm
parent310e275a79a047212fcff6d10ea8e3067ad7dc1f (diff)
downloadscummvm-rg350-dc5ef8425ba63b0901ed08017be43f749573cdec.tar.gz
scummvm-rg350-dc5ef8425ba63b0901ed08017be43f749573cdec.tar.bz2
scummvm-rg350-dc5ef8425ba63b0901ed08017be43f749573cdec.zip
Introduced V12_X_SHIFT / V12_Y_SHIFT
svn-id: r25611
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/actor.cpp26
-rw-r--r--engines/scumm/actor.h5
-rw-r--r--engines/scumm/object.cpp4
-rw-r--r--engines/scumm/scumm.cpp6
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) {