This commit is contained in:
Charles 2001-02-22 15:39:38 +00:00
parent 895fbfd27b
commit dedfdcf295
7 changed files with 114 additions and 6 deletions

View file

@ -229,4 +229,32 @@ s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChang
s32 headingToTarget = ratan2( yDist, xDist );
return( headingToTarget );
}
bool CNpcPath::think2D( DVECTOR currentPos, s32 *distX, s32 *distY )
{
bool pointChange = false;
if ( !this->waypoint )
{
return( true );
}
if ( !currentWaypoint )
{
// if no currentWaypoint set, start it off
currentWaypoint = this->waypoint;
}
*distX = currentWaypoint->pos.vx - currentPos.vx;
*distY = currentWaypoint->pos.vy - currentPos.vy;
if ( abs( *distX ) < 10 )
{
pointChange = true;
incPath();
}
return( pointChange );
}