[Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.14,1.15 router.cpp,1.6,1.7 screen.cpp,1.11,1.12

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Fri Dec 19 06:18:01 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv18104

Modified Files:
	logic.cpp router.cpp screen.cpp 
Log Message:
Changed abs() to ABS(), and changed a sorting function to use SWAP()


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- logic.cpp	19 Dec 2003 14:07:12 -0000	1.14
+++ logic.cpp	19 Dec 2003 14:16:31 -0000	1.15
@@ -1431,7 +1431,7 @@
 
 	int32 lookDir = whatTarget(x, y, cpt->o_xcoord, cpt->o_ycoord);
 	lookDir -= dir;
-	lookDir = abs(lookDir);
+	lookDir = ABS(lookDir);
 
 	if (lookDir > 4)
 		lookDir = 8 - lookDir;

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- router.cpp	19 Dec 2003 14:07:12 -0000	1.6
+++ router.cpp	19 Dec 2003 14:16:31 -0000	1.7
@@ -704,7 +704,7 @@
 		stepY = stepY * scale;
 		stepX = stepX >> 19;// quarter a step minimum
 		stepY = stepY >> 19;
-		if ((abs(deltaX)>=abs(stepX)) &&	(abs(deltaY)>=abs(stepY)))
+		if ((ABS(deltaX)>=ABS(stepX)) &&	(ABS(deltaY)>=ABS(stepY)))
 		{									
 	 		modularPath[slidy].x = smoothPath[smooth].x;
 			modularPath[slidy].y = smoothPath[smooth].y;
@@ -936,7 +936,7 @@
 					lastErrorY = modularPath[p].y - walkAnim[stepCount-7].y;
 					if (stepX==0)
 					{
-						if (3*abs(lastErrorY) < abs(errorY)) //the last stop was closest
+						if (3*ABS(lastErrorY) < ABS(errorY)) //the last stop was closest
 						{
 							stepCount -= framesPerStep;
 							if (left == 0)
@@ -947,7 +947,7 @@
 					}
 					else
 					{
-						if (3*abs(lastErrorX) < abs(errorX)) //the last stop was closest
+						if (3*ABS(lastErrorX) < ABS(errorX)) //the last stop was closest
 						{
 							stepCount -= framesPerStep;
 							if (left == 0)
@@ -1187,7 +1187,7 @@
 		stepY = stepY * scale;
 		stepX = stepX >> 16;
 		stepY = stepY >> 16;
-		if ((abs(deltaX)>=abs(stepX)) &&	(abs(deltaY)>=abs(stepY)))
+		if ((ABS(deltaX)>=ABS(stepX)) &&	(ABS(deltaY)>=ABS(stepY)))
 		{
 			modularPath[solid].x = smoothPath[smooth].x;
 			modularPath[solid].y = smoothPath[smooth].y;
@@ -1677,13 +1677,13 @@
 					x2 = node[k].x;
 					y2 = node[k].y;
 
-					if (abs(x2-x1)>(4.5*abs(y2-y1)))
+					if (ABS(x2-x1)>(4.5*ABS(y2-y1)))
 					{
-						distance = (8*abs(x2-x1)+18*abs(y2-y1))/(54*8)+1;
+						distance = (8*ABS(x2-x1)+18*ABS(y2-y1))/(54*8)+1;
 					}
 					else
 					{
-						distance = (6*abs(x2-x1)+36*abs(y2-y1))/(36*14)+1;
+						distance = (6*ABS(x2-x1)+36*ABS(y2-y1))/(36*14)+1;
 					}
 
 					if ((distance + node[i].dist < node[nnodes].dist) && (distance + node[i].dist < node[k].dist))
@@ -2629,9 +2629,9 @@
 	int signY = (deltaY > 0);
 	int	slope;
 
-	if ( (abs(deltaY) * DIAGONALX ) < (abs(deltaX) * DIAGONALY / 2))
+	if ( (ABS(deltaY) * DIAGONALX ) < (ABS(deltaX) * DIAGONALY / 2))
 		slope = 0;// its flat
-	else if ( (abs(deltaY) * DIAGONALX / 2) > (abs(deltaX) * DIAGONALY ) )
+	else if ( (ABS(deltaY) * DIAGONALX / 2) > (ABS(deltaX) * DIAGONALY ) )
 		slope = 2;// its vertical
 	else
 		slope = 1;// its diagonal

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- screen.cpp	19 Dec 2003 14:07:12 -0000	1.11
+++ screen.cpp	19 Dec 2003 14:16:31 -0000	1.12
@@ -288,13 +288,10 @@
 	for (uint8 cnt = 0; cnt < _backLength; cnt++)
 		processImage(_backList[cnt]);
 
-	SortSpr temp;
 	for (uint8 cnt = 0; cnt < _sortLength - 1; cnt++)
 		for (uint8 sCnt = 0; sCnt < _sortLength - 1; sCnt++)
 			if (_sortList[sCnt].y > _sortList[sCnt + 1].y) {
-				temp = _sortList[sCnt];
-				_sortList[sCnt] = _sortList[sCnt + 1];
-				_sortList[sCnt + 1] = temp;
+				SWAP(_sortList[sCnt], _sortList[sCnt + 1]);
 			}
 	for (uint8 cnt = 0; cnt < _sortLength; cnt++)
 		processImage(_sortList[cnt].id);
@@ -748,8 +745,8 @@
 
 void SwordScreen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
 	int x, y, ddx, ddy, e;
-	ddx = abs(x2 - x1);
-	ddy = abs(y2 - y1) << 1;
+	ddx = ABS(x2 - x1);
+	ddy = ABS(y2 - y1) << 1;
 	e = ddx - ddy;
 	ddx <<= 1;
 
@@ -772,8 +769,8 @@
 
 void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
 	int x, y, ddx, ddy, e;
-	ddx = abs(x2 - x1) << 1;
-	ddy = abs(y2 - y1);
+	ddx = ABS(x2 - x1) << 1;
+	ddy = ABS(y2 - y1);
 	e = ddy - ddx;
 	ddy <<= 1;
 
@@ -796,8 +793,8 @@
 
 void SwordScreen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
 	int x, y, ddx, ddy, e;
-	ddx = abs(x1 - x2) << 1;
-	ddy = abs(y2 - y1);
+	ddx = ABS(x1 - x2) << 1;
+	ddy = ABS(y2 - y1);
 	e = ddy - ddx;
 	ddy <<= 1;
 
@@ -820,8 +817,8 @@
 
 void SwordScreen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
 	int x, y, ddx, ddy, e;
-	ddy = abs(y2 - y1) << 1;
-	ddx = abs(x1 - x2);
+	ddy = ABS(y2 - y1) << 1;
+	ddx = ABS(x1 - x2);
 	e = ddx - ddy;
 	ddx <<= 1;
 





More information about the Scummvm-git-logs mailing list