diff --git a/source/hazard/hfalling.cpp b/source/hazard/hfalling.cpp index 2c5d802ba..74f7e5867 100644 --- a/source/hazard/hfalling.cpp +++ b/source/hazard/hfalling.cpp @@ -60,20 +60,16 @@ void CNpcFallingHazard::processMovement( int _frames ) Pos.vy += m_speed * _frames; - if ( m_speed < 5 ) + if ( Pos.vy > ( m_bouncePos.vy + 32 ) ) { - m_speed++; + m_bounceFinish = false; } - - DVECTOR offset = CLevel::getCameraPos(); - - s32 yPos = Pos.vy - offset.vy; - - if ( yPos > VidGetScrH() || yPos < 0 ) + else { - m_isActive = false; - m_timerActive = true; - m_timer = ( m_respawnRate - 1 ) * GameState::getOneSecondInFrames(); + if ( m_speed < 3 ) + { + m_speed++; + } } } else @@ -107,6 +103,8 @@ void CNpcFallingHazard::processMovement( int _frames ) m_bounceFinish = true; m_speed = -5; m_bounceDir = getRnd() % 2; + + m_bouncePos = Pos; } 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 ) { 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; +} \ No newline at end of file diff --git a/source/hazard/hfalling.h b/source/hazard/hfalling.h index 4d2e9ab5f..5e1a0ebe0 100644 --- a/source/hazard/hfalling.h +++ b/source/hazard/hfalling.h @@ -22,6 +22,7 @@ class CNpcFallingHazard : public CNpcHazard { public: void init(); + virtual CRECT const *getThinkBBox(); protected: void processMovement( int _frames ); void processTimer( int _frames ); @@ -31,6 +32,7 @@ protected: u8 m_bounceFinish; s32 m_speed; u8 m_bounceDir; + DVECTOR m_bouncePos; }; #endif \ No newline at end of file