This commit is contained in:
Charles 2001-05-30 15:25:38 +00:00
parent 43f5dff506
commit 108577f6df
2 changed files with 31 additions and 4 deletions

View file

@ -19,6 +19,16 @@
#include "game\game.h" #include "game\game.h"
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBobbingPlatform::postInit()
{
CNpcPlatform::postInit();
m_vertPos = Pos.vy << 3;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBobbingPlatform::processMovement( int _frames ) void CNpcBobbingPlatform::processMovement( int _frames )
@ -36,7 +46,7 @@ void CNpcBobbingPlatform::processMovement( int _frames )
{ {
m_velocity = 0; m_velocity = 0;
} }
else if ( m_velocity < 4 ) else if ( m_velocity < ( 2 << 2 ) )
{ {
if ( height <= 0 ) if ( height <= 0 )
{ {
@ -56,7 +66,7 @@ void CNpcBobbingPlatform::processMovement( int _frames )
{ {
// otherwise drop velocity and ultimately reverse course // otherwise drop velocity and ultimately reverse course
if ( m_velocity > -2 ) if ( m_velocity > -( 2 << 2 ) )
{ {
m_velocity--; m_velocity--;
} }
@ -67,7 +77,20 @@ void CNpcBobbingPlatform::processMovement( int _frames )
{ {
s32 moveY = m_velocity * _frames; s32 moveY = m_velocity * _frames;
if ( Pos.vy + moveY < m_initPos.vy ) m_vertPos += moveY;
Pos.vy = m_vertPos >> 3;
if ( Pos.vy < m_initPos.vy )
{
Pos.vy = m_initPos.vy;
m_vertPos = Pos.vy << 3;
m_velocity = 0;
m_state = NPC_BOB_STOP;
moveY = 0;
}
/*if ( Pos.vy + moveY < m_initPos.vy )
{ {
Pos.vy = m_initPos.vy; Pos.vy = m_initPos.vy;
m_velocity = 0; m_velocity = 0;
@ -77,6 +100,6 @@ void CNpcBobbingPlatform::processMovement( int _frames )
else else
{ {
Pos.vy += moveY; Pos.vy += moveY;
} }*/
} }
} }

View file

@ -20,6 +20,8 @@
class CNpcBobbingPlatform : public CNpcPlatform class CNpcBobbingPlatform : public CNpcPlatform
{ {
public:
virtual void postInit();
protected: protected:
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
@ -28,6 +30,8 @@ protected:
NPC_BOB_STOP = 0, NPC_BOB_STOP = 0,
NPC_BOB_MOVE = 1, NPC_BOB_MOVE = 1,
}; };
s32 m_vertPos;
}; };
#endif #endif