2001-04-24 16:00:16 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
hpendulm.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __HAZARD_HPENDULM_H__
|
|
|
|
#include "hazard\hpendulm.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcPendulumHazard::init()
|
|
|
|
{
|
|
|
|
CNpcHazard::init();
|
|
|
|
|
|
|
|
m_extendDir = EXTEND_LEFT;
|
|
|
|
m_extension = 0;
|
|
|
|
m_heading = 1024;
|
2001-04-24 21:14:52 +02:00
|
|
|
m_length = 200;
|
2001-04-24 16:00:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcPendulumHazard::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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-24 21:14:52 +02:00
|
|
|
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 );
|
2001-04-24 16:00:16 +02:00
|
|
|
}
|