diff --git a/source/platform/ppendulm.cpp b/source/platform/ppendulm.cpp new file mode 100644 index 000000000..d35004d77 --- /dev/null +++ b/source/platform/ppendulm.cpp @@ -0,0 +1,54 @@ +/*========================================================================= + + ppendulm.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PPENDULM_H__ +#include "platform\ppendulm.h" +#endif + +void CNpcPendulumPlatform::postInit() +{ + m_extendDir = EXTEND_LEFT; + m_extension = 0; + m_heading = 1024; + m_length = 200; +} + +void CNpcPendulumPlatform::processMovement( int _frames ) +{ + if ( m_extendDir == EXTEND_LEFT ) + { + if ( m_extension > 512 ) + { + m_extendDir = EXTEND_RIGHT; + } + else + { + m_extension += _frames << 3; + } + } + else + { + if ( m_extension < -512 ) + { + m_extendDir = EXTEND_LEFT; + } + else + { + m_extension -= _frames << 3; + } + } + + Pos.vx = m_base.vx + ( ( m_length * rcos( m_heading + m_extension ) ) >> 12 ); + Pos.vy = m_base.vy + ( ( m_length * rsin( m_heading + m_extension ) ) >> 12 ); +} + diff --git a/source/platform/ppendulm.h b/source/platform/ppendulm.h new file mode 100644 index 000000000..0ca43d31b --- /dev/null +++ b/source/platform/ppendulm.h @@ -0,0 +1,31 @@ +/*========================================================================= + + ppendulm.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PPENDULM_H__ +#define __PLATFORM_PPENDULM_H__ + +#ifndef __PLATFORM_PLATFORM_H__ +#include "platform\platform.h" +#endif + +class CNpcPendulumPlatform : public CNpcPlatform +{ +public: + virtual void postInit(); +protected: + virtual void processMovement( int _frames ); + + s32 m_length; +}; + +#endif \ No newline at end of file