This commit is contained in:
parent
8631119b6e
commit
2f7d86bd76
2 changed files with 9 additions and 3 deletions
|
@ -58,7 +58,12 @@ void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform )
|
||||||
pivotPos.vx = newXPos << 4;
|
pivotPos.vx = newXPos << 4;
|
||||||
pivotPos.vy = newYPos << 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 );
|
init( pivotPos );
|
||||||
}
|
}
|
||||||
|
@ -74,7 +79,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
if ( m_extendDir == EXTEND_LEFT )
|
if ( m_extendDir == EXTEND_LEFT )
|
||||||
{
|
{
|
||||||
if ( m_extension > 512 )
|
if ( m_extension > m_maxExtension )
|
||||||
{
|
{
|
||||||
m_extendDir = EXTEND_RIGHT;
|
m_extendDir = EXTEND_RIGHT;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +90,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_extension < -512 )
|
if ( m_extension < -m_maxExtension )
|
||||||
{
|
{
|
||||||
m_extendDir = EXTEND_LEFT;
|
m_extendDir = EXTEND_LEFT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ protected:
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
||||||
s32 m_length;
|
s32 m_length;
|
||||||
|
s32 m_maxExtension;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Reference in a new issue