[Scummvm-cvs-logs] SF.net SVN: scummvm: [25611] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Feb 15 19:12:30 CET 2007


Revision: 25611
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25611&view=rev
Author:   fingolfin
Date:     2007-02-15 10:12:29 -0800 (Thu, 15 Feb 2007)

Log Message:
-----------
Introduced V12_X_SHIFT / V12_Y_SHIFT

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/actor.cpp
    scummvm/trunk/engines/scumm/actor.h
    scummvm/trunk/engines/scumm/object.cpp
    scummvm/trunk/engines/scumm/scumm.cpp

Modified: scummvm/trunk/engines/scumm/actor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/actor.cpp	2007-02-15 17:53:59 UTC (rev 25610)
+++ scummvm/trunk/engines/scumm/actor.cpp	2007-02-15 18:12:29 UTC (rev 25611)
@@ -2368,27 +2368,27 @@
 	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;
 		}
 	}
 }

Modified: scummvm/trunk/engines/scumm/actor.h
===================================================================
--- scummvm/trunk/engines/scumm/actor.h	2007-02-15 17:53:59 UTC (rev 25610)
+++ scummvm/trunk/engines/scumm/actor.h	2007-02-15 18:12:29 UTC (rev 25611)
@@ -35,7 +35,10 @@
 
 enum {
 	V12_X_MULTIPLIER = 8,
-	V12_Y_MULTIPLIER = 2
+	V12_Y_MULTIPLIER = 2,
+
+	V12_X_SHIFT = 3,
+	V12_Y_SHIFT = 1
 };
 
 enum MoveFlags {

Modified: scummvm/trunk/engines/scumm/object.cpp
===================================================================
--- scummvm/trunk/engines/scumm/object.cpp	2007-02-15 17:53:59 UTC (rev 25610)
+++ scummvm/trunk/engines/scumm/object.cpp	2007-02-15 18:12:29 UTC (rev 25611)
@@ -413,8 +413,8 @@
 			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;

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2007-02-15 17:53:59 UTC (rev 25610)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2007-02-15 18:12:29 UTC (rev 25611)
@@ -1917,7 +1917,7 @@
 		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 @@
 		// 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) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list