This commit is contained in:
parent
895fbfd27b
commit
dedfdcf295
7 changed files with 114 additions and 6 deletions
|
@ -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 );
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue