This commit is contained in:
parent
09742436e2
commit
0c9f751ab1
2 changed files with 35 additions and 11 deletions
|
@ -60,20 +60,16 @@ void CNpcFallingHazard::processMovement( int _frames )
|
||||||
|
|
||||||
Pos.vy += m_speed * _frames;
|
Pos.vy += m_speed * _frames;
|
||||||
|
|
||||||
if ( m_speed < 5 )
|
if ( Pos.vy > ( m_bouncePos.vy + 32 ) )
|
||||||
|
{
|
||||||
|
m_bounceFinish = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_speed < 3 )
|
||||||
{
|
{
|
||||||
m_speed++;
|
m_speed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
if ( yPos > VidGetScrH() || yPos < 0 )
|
|
||||||
{
|
|
||||||
m_isActive = false;
|
|
||||||
m_timerActive = true;
|
|
||||||
m_timer = ( m_respawnRate - 1 ) * GameState::getOneSecondInFrames();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -107,6 +103,8 @@ void CNpcFallingHazard::processMovement( int _frames )
|
||||||
m_bounceFinish = true;
|
m_bounceFinish = true;
|
||||||
m_speed = -5;
|
m_speed = -5;
|
||||||
m_bounceDir = getRnd() % 2;
|
m_bounceDir = getRnd() % 2;
|
||||||
|
|
||||||
|
m_bouncePos = Pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -116,6 +114,17 @@ void CNpcFallingHazard::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DVECTOR offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
if ( yPos > VidGetScrH() )
|
||||||
|
{
|
||||||
|
m_isActive = false;
|
||||||
|
m_timerActive = true;
|
||||||
|
m_timer = ( m_respawnRate - 1 ) * GameState::getOneSecondInFrames();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -135,7 +144,20 @@ void CNpcFallingHazard::processTimer( int _frames )
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcFallingHazard::collidedWith( CThing *_thisThing )
|
void CNpcFallingHazard::collidedWith( CThing *_thisThing )
|
||||||
{
|
{
|
||||||
if (!m_bounceFinish && m_movementTimer<=0) CNpcHazard::collidedWith(_thisThing);
|
if (!m_bounceFinish && m_movementTimer<=0) CNpcHazard::collidedWith(_thisThing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const CRECT *CNpcFallingHazard::getThinkBBox()
|
||||||
|
{
|
||||||
|
CRECT objThinkBox = getCollisionArea();
|
||||||
|
|
||||||
|
sBBox &thinkBBox = CThingManager::getThinkBBox();
|
||||||
|
objThinkBox.y2 = thinkBBox.YMin + 1;
|
||||||
|
|
||||||
|
return &objThinkBox;
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ class CNpcFallingHazard : public CNpcHazard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
virtual CRECT const *getThinkBBox();
|
||||||
protected:
|
protected:
|
||||||
void processMovement( int _frames );
|
void processMovement( int _frames );
|
||||||
void processTimer( int _frames );
|
void processTimer( int _frames );
|
||||||
|
@ -31,6 +32,7 @@ protected:
|
||||||
u8 m_bounceFinish;
|
u8 m_bounceFinish;
|
||||||
s32 m_speed;
|
s32 m_speed;
|
||||||
u8 m_bounceDir;
|
u8 m_bounceDir;
|
||||||
|
DVECTOR m_bouncePos;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue