[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.78,1.79 actor.h,1.41,1.42
Andrew Kurushin
h00ligan at users.sourceforge.net
Thu Jan 6 15:04:38 CET 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11063
Modified Files:
actor.cpp actor.h
Log Message:
- compiles debug path displaying only if ACTOR_DEBUG defined
- removed some temporary variable
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- actor.cpp 6 Jan 2005 22:22:19 -0000 1.78
+++ actor.cpp 6 Jan 2005 23:02:45 -0000 1.79
@@ -138,8 +138,10 @@
return;
}
+#ifdef ACTOR_DEBUG
_debugPoints = NULL;
_debugPointsAlloced = _debugPointsCount = 0;
+#endif
_pathNodeList = _newPathNodeList = NULL;
_pathList = NULL;
@@ -201,7 +203,11 @@
ActorData *actor;
debug(9, "Actor::~Actor()");
+
+#ifdef ACTOR_DEBUG
free(_debugPoints);
+#endif
+
free(_pathNodeList);
free(_newPathNodeList);
free(_pathList);
@@ -1356,7 +1362,9 @@
int i;
Rect intersect;
+#ifdef ACTOR_DEBUG
_debugPointsCount = 0;
+#endif
actor->walkStepsCount = 0;
if (fromPoint == toPoint) {
@@ -1385,8 +1393,7 @@
}
}
-#if 1
-
+#ifdef ACTOR_DEBUG
for (iteratorPoint.y = 0; iteratorPoint.y < _yCellCount; iteratorPoint.y++) {
for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) {
if (getPathCell(iteratorPoint) == kPathCellBarrier) {
@@ -1499,7 +1506,9 @@
if (validPathCellPoint(fromPoint)) {
setPathCell(fromPoint, kDirUp);
+#ifdef ACTOR_DEBUG
addDebugPoint(fromPoint, 24+36);
+#endif
}
pathDirectionIterator = pathDirectionList.begin();
@@ -1521,7 +1530,9 @@
setPathCell(nextPoint, samplePathDirection->direction);
+#ifdef ACTOR_DEBUG
addDebugPoint(nextPoint, samplePathDirection->direction + 96);
+#endif
newPathDirectionIterator = pathDirectionList.pushBack();
pathDirection = newPathDirectionIterator.operator->();
pathDirection->x = nextPoint.x;
@@ -1563,7 +1574,9 @@
nextPoint.y -= pathDirectionLUT2[direction][1];
addPathListPoint(nextPoint);
+#ifdef ACTOR_DEBUG
addDebugPoint(nextPoint, 0x8a);
+#endif
}
pathToNode();
@@ -1773,7 +1786,7 @@
int newPathNodeIndex;
int start;
int end;
- Point point1, point2, point3, point4;
+ Point point1, point2;
if (_pathNodeListIndex < 2)
@@ -1795,23 +1808,14 @@
continue;
}
- point1.x = _pathList[start].x;
- if (point1.x == PATH_NODE_EMPTY) {
- continue;
- }
- point2.x = _pathList[end].x;
- if (point2.x == PATH_NODE_EMPTY) {
+ point1 = _pathList[start];
+ point2 = _pathList[end];
+ if ((point1.x == PATH_NODE_EMPTY) || (point2.x == PATH_NODE_EMPTY)) {
continue;
}
- point1.y = _pathList[start].y;
- point2.y = _pathList[end].y;
- point3.x = point1.x;
- point3.y = point1.y;
- point4.x = point2.x;
- point4.y = point2.y;
- if (scanPathLine( point3, point4)) {
+ if (scanPathLine(point1, point2)) {
for (l = 1; l <= newPathNodeIndex; l++) {
if (start <= _newPathNodeList[l].link) {
newPathNodeIndex = l;
@@ -1844,6 +1848,7 @@
}
void Actor::drawPathTest() {
+#ifdef ACTOR_DEBUG
int i;
SURFACE *surface;
surface = _vm->_gfx->getBackBuffer();
@@ -1851,10 +1856,10 @@
return;
}
-
for (i = 0; i < _debugPointsCount; i++) {
*((byte *)surface->pixels + (_debugPoints[i].point.y * surface->pitch) + _debugPoints[i].point.x) = _debugPoints[i].color;
}
+#endif
}
/*
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- actor.h 6 Jan 2005 22:22:20 -0000 1.41
+++ actor.h 6 Jan 2005 23:02:53 -0000 1.42
@@ -32,6 +32,8 @@
namespace Saga {
+//#define ACTOR_DEBUG
+
#define ACTOR_BARRIERS_MAX 16
#define ACTOR_MAX_STEPS_COUNT 32
@@ -385,6 +387,7 @@
_pathNodeList[_pathNodeListIndex].point = point;
}
public:
+#ifdef ACTOR_DEBUG
//path debug - use with care
struct DebugPoint {
Point point;
@@ -401,6 +404,7 @@
_debugPoints[_debugPointsCount].color = color;
_debugPoints[_debugPointsCount++].point = point;
}
+#endif
};
inline int16 quickDistance(const Point &point1, const Point &point2) {
More information about the Scummvm-git-logs
mailing list