This commit is contained in:
Charles 2001-04-26 16:07:25 +00:00
parent 8631119b6e
commit 2f7d86bd76
2 changed files with 9 additions and 3 deletions

View file

@ -58,7 +58,12 @@ void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform )
pivotPos.vx = newXPos << 4;
pivotPos.vy = newYPos << 4;
m_length = startPos.vy - pivotPos.vy;
s32 xDist = startPos.vx - pivotPos.vx;
s32 yDist = startPos.vy - pivotPos.vy;
m_maxExtension = 1024 - ratan2( abs( yDist ), abs( xDist ) );
m_length = isqrt2( ( xDist * xDist ) + ( yDist * yDist ) );
init( pivotPos );
}
@ -74,7 +79,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
{
if ( m_extendDir == EXTEND_LEFT )
{
if ( m_extension > 512 )
if ( m_extension > m_maxExtension )
{
m_extendDir = EXTEND_RIGHT;
}
@ -85,7 +90,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
}
else
{
if ( m_extension < -512 )
if ( m_extension < -m_maxExtension )
{
m_extendDir = EXTEND_LEFT;
}

View file

@ -27,6 +27,7 @@ protected:
virtual void processMovement( int _frames );
s32 m_length;
s32 m_maxExtension;
};
#endif