This commit is contained in:
Charles 2001-07-10 17:08:34 +00:00
parent 29aff513ef
commit 56bbd22107
3 changed files with 35 additions and 2 deletions

View file

@ -132,7 +132,7 @@ public:
static CNpcPlatform *Create(int Type);
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
virtual void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
protected:
// NPC data structure definitions //
@ -177,7 +177,7 @@ protected:
// functions
void reinit();
virtual void reinit();
bool processSensor();
virtual void processMovement( int _frames );
virtual void processLifetime( int _frames );

View file

@ -36,12 +36,39 @@ void CNpcRetractingPlatform::postInit()
m_timer = NPC_PLATFORM_TIMER_RETRACT;
m_extension = ONE;
m_initDelay = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRetractingPlatform::setSpeed( s16 newSpeed )
{
m_speed = newSpeed;
m_initDelay = ( m_speed * GameState::getOneSecondInFrames() ) >> 2;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRetractingPlatform::reinit()
{
CNpcPlatform::reinit();
m_initDelay = ( m_speed * GameState::getOneSecondInFrames() ) >> 2;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRetractingPlatform::processTimer( int _frames )
{
if ( m_initDelay > 0 )
{
m_initDelay -= _frames;
return;
}
switch( m_timerType )
{
case NPC_PLATFORM_TIMER_RETRACT:

View file

@ -23,9 +23,15 @@ class CNpcRetractingPlatform : public CNpcPlatform
public:
void postInit();
void render();
bool alwaysThink() {return(true);}
void setSpeed( s16 newSpeed );
protected:
void reinit();
void processTimer( int _frames );
s32 m_initDelay;
enum NPC_PLATFORM_TIMER_TYPE
{
NPC_PLATFORM_TIMER_RETRACT = 0,