[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.5,1.6 scumm.h,1.16,1.17 scummvm.cpp,1.18,1.19
Max Horn
fingolfin at users.sourceforge.net
Mon Sep 16 03:43:02 CEST 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv25324/scumm
Modified Files:
actor.cpp scumm.h scummvm.cpp
Log Message:
added some comments, cleanup
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- actor.cpp 13 Sep 2002 12:28:53 -0000 1.5
+++ actor.cpp 16 Sep 2002 10:42:12 -0000 1.6
@@ -258,7 +258,7 @@
dir = remapDirection(newDirection, is_walking);
shouldInterpolate = (dir & 1024);
to = toSimpleDir(dirType, dir & 1023);
- num = numSimpleDirDirections(dirType);
+ num = dirType ? 8 : 4;
if (shouldInterpolate) {
// Turn left or right, depending on which is shorter.
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- scumm.h 16 Sep 2002 08:22:05 -0000 1.16
+++ scumm.h 16 Sep 2002 10:42:12 -0000 1.17
@@ -1384,7 +1384,6 @@
int normalizeAngle(int angle);
int fromSimpleDir(int dirtype, int dir);
int toSimpleDir(int dirtype, int dir);
-int numSimpleDirDirections(int dirType);
#endif
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- scummvm.cpp 16 Sep 2002 09:52:21 -0000 1.18
+++ scummvm.cpp 16 Sep 2002 10:42:12 -0000 1.19
@@ -1143,15 +1143,9 @@
free(_classData);
}
-const int new_dir_table[4] = {
- 270,
- 90,
- 180,
- 0,
-};
-
-const int16 many_direction_tab[16] = {71, 109, 251, 289, -1, -1, -1, -1, 22, 72, 107, 157, 202, 252, 287, 337};
-
+//
+// Convert an old style direction to a new style one (angle),
+//
int newDirToOldDir(int dir)
{
if (dir >= 71 && dir <= 109)
@@ -1163,21 +1157,24 @@
return 3;
}
+//
+// Convert an new style (angle) direction to an old style one.
+//
int oldDirToNewDir(int dir)
{
+ const int new_dir_table[4] = { 270, 90, 180, 0 };
return new_dir_table[dir];
}
-
-int numSimpleDirDirections(int dirType)
-{
- return dirType ? 8 : 4;
-}
-
-
-/* Convert an angle to a simple direction */
+//
+// Convert an angle to a simple direction.
+//
int toSimpleDir(int dirType, int dir)
{
+ const int16 many_direction_tab[16] = {
+ 71, 109, 251, 289, -1, -1, -1, -1,
+ 22, 72, 107, 157, 202, 252, 287, 337
+ };
int num = dirType ? 8 : 4;
const int16 *dirtab = &many_direction_tab[dirType * 8];
for (int i = 1; i < num; i++, dirtab++) {
@@ -1188,16 +1185,22 @@
}
-/* Convert a simple direction to an angle */
+//
+// Convert a simple direction to an angle
+//
int fromSimpleDir(int dirType, int dir)
{
- if (!dirType)
- return dir * 90;
- else
+ if (dirType)
return dir * 45;
+ else
+ return dir * 90;
}
+//
+// Normalize the given angle - that means, ensure it is positive, and
+// change it to the closest multiple of 45 degree by abusing toSimpleDir.
+//
int normalizeAngle(int angle)
{
int temp;
More information about the Scummvm-git-logs
mailing list