This commit is contained in:
Charles 2001-04-04 20:10:29 +00:00
parent 056511ac63
commit 51f8412d46

View file

@ -742,20 +742,35 @@ bool CNpcEnemy::processSensor()
{ {
if ( playerXDistSqr + playerYDistSqr < 10000 ) if ( playerXDistSqr + playerYDistSqr < 10000 )
{ {
m_controlFunc = NPC_CONTROL_CLOSE; // only attack if within path extents
m_extension = 0;
m_velocity = 5; s32 minX, maxX;
m_base = Pos; m_npcPath.getPathXExtents( &minX, &maxX );
if ( playerXDist < 0 ) if ( playerXDist < 0 )
{ {
m_extendDir = EXTEND_LEFT; m_extendDir = EXTEND_LEFT;
if ( ( Pos.vx + playerXDist - 128 ) < minX )
{
return( false );
}
} }
else else
{ {
m_extendDir = EXTEND_RIGHT; m_extendDir = EXTEND_RIGHT;
if ( ( Pos.vx + playerXDist + 128 ) > maxX )
{
return( false );
}
} }
m_controlFunc = NPC_CONTROL_CLOSE;
m_extension = 0;
m_velocity = 5;
m_base = Pos;
return( true ); return( true );
} }
else else