diff --git a/source/platform/pfishhk.cpp b/source/platform/pfishhk.cpp index f855c7000..56cad2cea 100644 --- a/source/platform/pfishhk.cpp +++ b/source/platform/pfishhk.cpp @@ -45,6 +45,7 @@ void CNpcFishHookPlatform::postInit() m_isShuttingDown = false; m_lineBase.vx = Pos.vx; m_lineBase.vy = 0; + m_bobTimer = 0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -87,6 +88,21 @@ void CNpcFishHookPlatform::processMovement( int _frames ) } } } + else + { + int second = GameState::getOneSecondInFrames(); + + m_bobTimer += _frames; + + if ( m_bobTimer > ( 3 * second ) ) + { + m_bobTimer -= 3 * second; + } + + s16 sineVal = ( m_bobTimer << 12 ) / ( 3 * second ); + + Pos.vy = m_base.vy + ( ( 5 * rsin( sineVal ) ) >> 12 ); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/platform/pfishhk.h b/source/platform/pfishhk.h index b0870bdd4..8283b542c 100644 --- a/source/platform/pfishhk.h +++ b/source/platform/pfishhk.h @@ -31,6 +31,7 @@ protected: u8 m_isMoving; u8 m_isResetting; DVECTOR m_lineBase; + s32 m_bobTimer; }; #endif \ No newline at end of file