From fc81449d2e10552f9f5bacc928cde0e64cb09eb7 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 16 May 2001 18:07:38 +0000 Subject: [PATCH] --- source/enemy/nworm.cpp | 65 +++++++++++++++++++++++++++++++++++++++++- source/enemy/nworm.h | 3 ++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/source/enemy/nworm.cpp b/source/enemy/nworm.cpp index 32f65dc3a..5ca386252 100644 --- a/source/enemy/nworm.cpp +++ b/source/enemy/nworm.cpp @@ -177,6 +177,7 @@ void CNpcParasiticWormEnemy::postInit() } m_movementTimer = 2 * GameState::getOneSecondInFrames(); + m_collTimer = 0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -360,6 +361,11 @@ void CNpcParasiticWormEnemy::processMovement( int _frames ) oldList->setHeading( heading ); oldList->updateCollisionArea(); } + + if ( m_collTimer > 0 ) + { + m_collTimer -= _frames; + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -627,4 +633,61 @@ int CNpcParasiticWormSegment::checkCollisionAgainst( CThing *_thisThing, int _fr } return collided; -} \ No newline at end of file +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcParasiticWormEnemy::processShot( int _frames ) +{ + if ( !m_segment ) + { + m_drawRotation += 64 * _frames; + m_drawRotation &= 4095; + + Pos.vy += m_speed * _frames; + + if ( m_speed < 5 ) + { + m_speed++; + } + + DVECTOR offset = CLevel::getCameraPos(); + + if ( Pos.vy - offset.vy > VidGetScrH() ) + { + setToShutdown(); + } + } + else + { + if ( m_collTimer <= 0 ) + { + // knock segment off end of list + + CNpcParasiticWormSegment *segment = m_segment; + CNpcParasiticWormSegment *oldSegment = segment; + + while( segment->m_nextSegment ) + { + oldSegment = segment; + + segment = segment->m_nextSegment; + } + + delete segment; + + if ( segment == m_segment ) + { + m_segment = NULL; + } + else + { + oldSegment->m_nextSegment = NULL; + } + + m_collTimer = GameState::getOneSecondInFrames(); + } + + m_controlFunc = NPC_CONTROL_MOVEMENT; + } +} diff --git a/source/enemy/nworm.h b/source/enemy/nworm.h index a0d88631e..95eb1b641 100644 --- a/source/enemy/nworm.h +++ b/source/enemy/nworm.h @@ -56,6 +56,7 @@ protected: virtual bool processSensor(); virtual void processClose( int _frames ); virtual void processMovement( int _frames ); + virtual void processShot( int _frames ); //void resetParasiticWormHeadToTail(); virtual void processEnemyCollision( CThing *thisThing ); @@ -66,6 +67,8 @@ protected: }; CNpcParasiticWormSegment *m_segment; + + s32 m_collTimer; }; #endif \ No newline at end of file