This commit is contained in:
parent
b5516f0c58
commit
5ffa10e470
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 );
|
||||
}
|
||||
|
31
source/platform/ppendulm.h
Normal file
31
source/platform/ppendulm.h
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user