This commit is contained in:
parent
29aff513ef
commit
56bbd22107
3 changed files with 35 additions and 2 deletions
|
@ -132,7 +132,7 @@ public:
|
||||||
static CNpcPlatform *Create(int Type);
|
static CNpcPlatform *Create(int Type);
|
||||||
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
|
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
|
||||||
|
|
||||||
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
virtual void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// NPC data structure definitions //
|
// NPC data structure definitions //
|
||||||
|
@ -177,7 +177,7 @@ protected:
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
void reinit();
|
virtual void reinit();
|
||||||
bool processSensor();
|
bool processSensor();
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
virtual void processLifetime( int _frames );
|
virtual void processLifetime( int _frames );
|
||||||
|
|
|
@ -36,12 +36,39 @@ void CNpcRetractingPlatform::postInit()
|
||||||
m_timer = NPC_PLATFORM_TIMER_RETRACT;
|
m_timer = NPC_PLATFORM_TIMER_RETRACT;
|
||||||
|
|
||||||
m_extension = ONE;
|
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 )
|
void CNpcRetractingPlatform::processTimer( int _frames )
|
||||||
{
|
{
|
||||||
|
if ( m_initDelay > 0 )
|
||||||
|
{
|
||||||
|
m_initDelay -= _frames;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch( m_timerType )
|
switch( m_timerType )
|
||||||
{
|
{
|
||||||
case NPC_PLATFORM_TIMER_RETRACT:
|
case NPC_PLATFORM_TIMER_RETRACT:
|
||||||
|
|
|
@ -23,9 +23,15 @@ class CNpcRetractingPlatform : public CNpcPlatform
|
||||||
public:
|
public:
|
||||||
void postInit();
|
void postInit();
|
||||||
void render();
|
void render();
|
||||||
|
bool alwaysThink() {return(true);}
|
||||||
|
|
||||||
|
void setSpeed( s16 newSpeed );
|
||||||
protected:
|
protected:
|
||||||
|
void reinit();
|
||||||
void processTimer( int _frames );
|
void processTimer( int _frames );
|
||||||
|
|
||||||
|
s32 m_initDelay;
|
||||||
|
|
||||||
enum NPC_PLATFORM_TIMER_TYPE
|
enum NPC_PLATFORM_TIMER_TYPE
|
||||||
{
|
{
|
||||||
NPC_PLATFORM_TIMER_RETRACT = 0,
|
NPC_PLATFORM_TIMER_RETRACT = 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue