[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.365,1.366 camera.cpp,2.33,2.34 script_v6.cpp,1.438,1.439

Max Horn fingolfin at users.sourceforge.net
Wed May 25 02:20:27 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18839

Modified Files:
	actor.cpp camera.cpp script_v6.cpp 
Log Message:
abs -> ABS (code unification)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.365
retrieving revision 1.366
diff -u -d -r1.365 -r1.366
--- actor.cpp	24 May 2005 17:22:09 -0000	1.365
+++ actor.cpp	25 May 2005 09:17:31 -0000	1.366
@@ -176,7 +176,7 @@
 		double temp = atan2((double)x, (double)-y);
 		return normalizeAngle((int)(temp * 180 / 3.1415926535));
 	} else {
-		if (abs(y) * 2 < abs(x)) {
+		if (ABS(y) * 2 < ABS(x)) {
 			if (x > 0)
 				return 90;
 			return 270;
@@ -210,7 +210,7 @@
 		deltaYFactor = 0;
 	}
 
-	if ((uint) abs((int)(deltaXFactor >> 16)) > _speedx) {
+	if ((uint) ABS((int)(deltaXFactor >> 16)) > _speedx) {
 		deltaXFactor = _speedx << 16;
 		if (diffX < 0)
 			deltaXFactor = -deltaXFactor;
@@ -349,7 +349,7 @@
 
 		// Turn left or right, depending on which is shorter.
 		int diff = to - from;
-		if (abs(diff) > (num >> 1))
+		if (ABS(diff) > (num >> 1))
 			diff = -diff;
 
 		if (diff > 0) {
@@ -391,10 +391,10 @@
 		setBox(_walkdata.curbox);
 	}
 
-	distX = abs(_walkdata.next.x - _walkdata.cur.x);
-	distY = abs(_walkdata.next.y - _walkdata.cur.y);
+	distX = ABS(_walkdata.next.x - _walkdata.cur.x);
+	distY = ABS(_walkdata.next.y - _walkdata.cur.y);
 
-	if (abs(_actorPos.x - _walkdata.cur.x) >= distX && abs(_actorPos.y - _walkdata.cur.y) >= distY) {
+	if (ABS(_actorPos.x - _walkdata.cur.x) >= distX && ABS(_actorPos.y - _walkdata.cur.y) >= distY) {
 		_moving &= ~MF_IN_LEG;
 		return 0;
 	}
@@ -407,11 +407,11 @@
 	_walkdata.yfrac = (uint16)tmpY;
 	_actorPos.y = (tmpY >> 16);
 
-	if (abs(_actorPos.x - _walkdata.cur.x) > distX) {
+	if (ABS(_actorPos.x - _walkdata.cur.x) > distX) {
 		_actorPos.x = _walkdata.next.x;
 	}
 
-	if (abs(_actorPos.y - _walkdata.cur.y) > distY) {
+	if (ABS(_actorPos.y - _walkdata.cur.y) > distY) {
 		_actorPos.y = _walkdata.next.y;
 	}
 

Index: camera.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/camera.cpp,v
retrieving revision 2.33
retrieving revision 2.34
diff -u -d -r2.33 -r2.34
--- camera.cpp	14 May 2005 22:56:38 -0000	2.33
+++ camera.cpp	25 May 2005 09:17:31 -0000	2.34
@@ -37,7 +37,7 @@
 }
 
 void ScummEngine::setCameraAt(int pos_x, int pos_y) {
-	if (camera._mode != kFollowActorCameraMode || abs(pos_x - camera._cur.x) > (_screenWidth / 2)) {
+	if (camera._mode != kFollowActorCameraMode || ABS(pos_x - camera._cur.x) > (_screenWidth / 2)) {
 		camera._cur.x = pos_x;
 	}
 	camera._dest.x = pos_x;
@@ -261,8 +261,8 @@
 		startScene(a->getRoom(), 0, 0);
 	}
 
-	ax = abs(a->_pos.x - camera._cur.x);
-	ay = abs(a->_pos.y - camera._cur.y);
+	ax = ABS(a->_pos.x - camera._cur.x);
+	ay = ABS(a->_pos.y - camera._cur.y);
 
 	if (ax > VAR(VAR_CAMERA_THRESHOLD_X) || ay > VAR(VAR_CAMERA_THRESHOLD_Y) || ax > (_screenWidth / 2) || ay > (_screenHeight / 2)) {
 		setCameraAt(a->_pos.x, a->_pos.y);
@@ -278,8 +278,8 @@
 
 	if (camera._follows) {
 		a = derefActor(camera._follows, "moveCamera");
-		if (abs(camera._cur.x - a->_pos.x) > VAR(VAR_CAMERA_THRESHOLD_X) ||
-				abs(camera._cur.y - a->_pos.y) > VAR(VAR_CAMERA_THRESHOLD_Y)) {
+		if (ABS(camera._cur.x - a->_pos.x) > VAR(VAR_CAMERA_THRESHOLD_X) ||
+				ABS(camera._cur.y - a->_pos.y) > VAR(VAR_CAMERA_THRESHOLD_Y)) {
 			camera._movingToActor = true;
 			if (VAR(VAR_CAMERA_THRESHOLD_X) == 0)
 				camera._cur.x = a->_pos.x;

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.438
retrieving revision 1.439
diff -u -d -r1.438 -r1.439
--- script_v6.cpp	14 May 2005 23:28:21 -0000	1.438
+++ script_v6.cpp	25 May 2005 09:17:32 -0000	1.439
@@ -2425,8 +2425,8 @@
 }
 
 void ScummEngine_v6::o6_abs() {
-	int a = pop();	// palmos: prevent multi pop if we use an abs function defined as : #define abs(a) ((a) < 0 ? -(a) : (a))
-	push(abs(a));
+	int a = pop();
+	push(ABS(a));
 }
 
 void ScummEngine_v6::o6_distObjectObject() {





More information about the Scummvm-git-logs mailing list