This commit is contained in:
parent
b5516f0c58
commit
5ffa10e470
2 changed files with 85 additions and 0 deletions
54
source/platform/ppendulm.cpp
Normal file
54
source/platform/ppendulm.cpp
Normal file
|
@ -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 );
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue