aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kurushin2005-01-06 23:02:53 +0000
committerAndrew Kurushin2005-01-06 23:02:53 +0000
commit37a858d6f5046fb6c0e2be347b37c8f1d61fe1fe (patch)
treee61af50398783b172484faf2b633a8015e6fba96
parentfa3d618fae78501272a62c02fd754a4cbecb84d3 (diff)
downloadscummvm-rg350-37a858d6f5046fb6c0e2be347b37c8f1d61fe1fe.tar.gz
scummvm-rg350-37a858d6f5046fb6c0e2be347b37c8f1d61fe1fe.tar.bz2
scummvm-rg350-37a858d6f5046fb6c0e2be347b37c8f1d61fe1fe.zip
- compiles debug path displaying only if ACTOR_DEBUG defined
- removed some temporary variable svn-id: r16469
-rw-r--r--saga/actor.cpp39
-rw-r--r--saga/actor.h4
2 files changed, 26 insertions, 17 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index b2b8d211e8..3f7a95fcf4 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -138,8 +138,10 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
return;
}
+#ifdef ACTOR_DEBUG
_debugPoints = NULL;
_debugPointsAlloced = _debugPointsCount = 0;
+#endif
_pathNodeList = _newPathNodeList = NULL;
_pathList = NULL;
@@ -201,7 +203,11 @@ Actor::~Actor() {
ActorData *actor;
debug(9, "Actor::~Actor()");
+
+#ifdef ACTOR_DEBUG
free(_debugPoints);
+#endif
+
free(_pathNodeList);
free(_newPathNodeList);
free(_pathList);
@@ -1356,7 +1362,9 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
int i;
Rect intersect;
+#ifdef ACTOR_DEBUG
_debugPointsCount = 0;
+#endif
actor->walkStepsCount = 0;
if (fromPoint == toPoint) {
@@ -1385,8 +1393,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
}
}
-#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 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
if (validPathCellPoint(fromPoint)) {
setPathCell(fromPoint, kDirUp);
+#ifdef ACTOR_DEBUG
addDebugPoint(fromPoint, 24+36);
+#endif
}
pathDirectionIterator = pathDirectionList.begin();
@@ -1521,7 +1530,9 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
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 @@ void Actor::setActorPath(ActorData *actor, const Point &fromPoint, const Point &
nextPoint.y -= pathDirectionLUT2[direction][1];
addPathListPoint(nextPoint);
+#ifdef ACTOR_DEBUG
addDebugPoint(nextPoint, 0x8a);
+#endif
}
pathToNode();
@@ -1773,7 +1786,7 @@ void Actor::removePathPoints() {
int newPathNodeIndex;
int start;
int end;
- Point point1, point2, point3, point4;
+ Point point1, point2;
if (_pathNodeListIndex < 2)
@@ -1795,23 +1808,14 @@ void Actor::removePathPoints() {
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::removePathPoints() {
}
void Actor::drawPathTest() {
+#ifdef ACTOR_DEBUG
int i;
SURFACE *surface;
surface = _vm->_gfx->getBackBuffer();
@@ -1851,10 +1856,10 @@ void Actor::drawPathTest() {
return;
}
-
for (i = 0; i < _debugPointsCount; i++) {
*((byte *)surface->pixels + (_debugPoints[i].point.y * surface->pitch) + _debugPoints[i].point.x) = _debugPoints[i].color;
}
+#endif
}
/*
diff --git a/saga/actor.h b/saga/actor.h
index 97b1625100..0b7a114411 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -32,6 +32,8 @@
namespace Saga {
+//#define ACTOR_DEBUG
+
#define ACTOR_BARRIERS_MAX 16
#define ACTOR_MAX_STEPS_COUNT 32
@@ -385,6 +387,7 @@ private:
_pathNodeList[_pathNodeListIndex].point = point;
}
public:
+#ifdef ACTOR_DEBUG
//path debug - use with care
struct DebugPoint {
Point point;
@@ -401,6 +404,7 @@ public:
_debugPoints[_debugPointsCount].color = color;
_debugPoints[_debugPointsCount++].point = point;
}
+#endif
};
inline int16 quickDistance(const Point &point1, const Point &point2) {