This commit is contained in:
Charles 2001-04-24 14:00:16 +00:00
parent 1aaa94b09f
commit a0b66fcd15
2 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,58 @@
/*=========================================================================
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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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;
}
}
Pos.vx = m_base.vx + ( ( 100 * rcos( m_heading + m_extension ) ) >> 12 );
Pos.vy = m_base.vy + ( ( 100 * rsin( m_heading + m_extension ) ) >> 12 );
}

29
source/hazard/hpendulm.h Normal file
View File

@ -0,0 +1,29 @@
/*=========================================================================
hpendulm.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __HAZARD_HPENDULM_H__
#define __HAZARD_HPENDULM_H__
#ifndef __HAZARD_HAZARD_H__
#include "hazard\hazard.h"
#endif
class CNpcPendulumHazard : public CNpcHazard
{
public:
void init();
protected:
void processMovement( int _frames );
};
#endif