This commit is contained in:
Charles 2001-02-05 14:55:11 +00:00
parent 2a71836478
commit b9ccd83f66
7 changed files with 72 additions and 6 deletions

View file

@ -40,6 +40,7 @@ void CNpcPath::initPath()
waypoint = NULL;
pathType = SINGLE_USE_PATH;
currentWaypoint = NULL;
lastWaypoint = NULL;
waypointCount = 0;
reversePath = false;
}
@ -47,6 +48,7 @@ void CNpcPath::initPath()
void CNpcPath::resetPath()
{
currentWaypoint = waypoint;
lastWaypoint = NULL;
}
void CNpcPath::addWaypoint( DVECTOR newPos )
@ -118,6 +120,7 @@ bool CNpcPath::incPath()
{
if ( currentWaypoint->nextWaypoint )
{
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->nextWaypoint;
}
else
@ -132,6 +135,7 @@ bool CNpcPath::incPath()
case REPEATING_PATH:
// go back to start
lastWaypoint = currentWaypoint;
currentWaypoint = this->waypoint;
break;
@ -143,6 +147,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->prevWaypoint )
{
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->prevWaypoint;
}
@ -156,6 +161,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->prevWaypoint )
{
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->prevWaypoint;
}
else
@ -164,6 +170,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->nextWaypoint )
{
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->nextWaypoint;
}
}
@ -172,6 +179,23 @@ bool CNpcPath::incPath()
return( false );
}
void CNpcPath::reversePathDir()
{
if ( lastWaypoint )
{
CNpcWaypoint *tempWaypoint;
tempWaypoint = currentWaypoint;
currentWaypoint = lastWaypoint;
lastWaypoint = tempWaypoint;
if ( pathType == PONG_PATH )
{
reversePath = !reversePath;
}
}
}
bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY )
{
return( currentWaypoint->isPointNear( currentPos, distX, distY ) );