From 2f7d86bd76d7dc6ee43b9dd03e2e00c7f7bfd026 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 26 Apr 2001 16:07:25 +0000 Subject: [PATCH] --- source/platform/ppendulm.cpp | 11 ++++++++--- source/platform/ppendulm.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/platform/ppendulm.cpp b/source/platform/ppendulm.cpp index d05a15515..99ae757e8 100644 --- a/source/platform/ppendulm.cpp +++ b/source/platform/ppendulm.cpp @@ -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; } diff --git a/source/platform/ppendulm.h b/source/platform/ppendulm.h index 70b4c643d..99567b486 100644 --- a/source/platform/ppendulm.h +++ b/source/platform/ppendulm.h @@ -27,6 +27,7 @@ protected: virtual void processMovement( int _frames ); s32 m_length; + s32 m_maxExtension; }; #endif \ No newline at end of file