diff --git a/source/enemy/nclam.cpp b/source/enemy/nclam.cpp index eaac5e18e..72f19ea5e 100644 --- a/source/enemy/nclam.cpp +++ b/source/enemy/nclam.cpp @@ -75,4 +75,35 @@ void CNpc::processCloseClamAttack( int _frames ) m_sensorFunc = NPC_SENSOR_NONE; } } +} + +void CNpc::processClamRetract( int _frames ) +{ + s32 velocity; + + // retract + + if ( m_extension > 0 ) + { + velocity = -_frames; + + if ( m_extension < _frames ) + { + velocity = m_extension - _frames; + } + + m_extension += velocity; + + + Pos.vx += ( velocity * rcos( m_heading ) ) >> 12; + Pos.vy += ( velocity * rsin( m_heading ) ) >> 12; + } + else + { + // halt clam + + m_controlFunc = NPC_CONTROL_NONE; + m_timerFunc = NPC_TIMER_NONE; + m_sensorFunc = NPC_SENSOR_NONE; + } } \ No newline at end of file diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index c90794581..030f9dfa7 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -48,7 +48,7 @@ void CNpc::init() { - m_type = NPC_FLAMING_SKULL; + m_type = NPC_CLAM; m_heading = m_fireHeading = 0; m_movementTimer = 0; diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 59626672d..12a2279ab 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -163,6 +163,7 @@ protected: NPC_MOVEMENT_PENDULUM, NPC_MOVEMENT_FIREBALL, NPC_MOVEMENT_RETURNING_HAZARD, + NPC_MOVEMENT_CLAM_RETRACT, }; enum NPC_MOVEMENT_MODIFIER_FUNC @@ -272,6 +273,7 @@ protected: // clam functions void processCloseClamAttack( int _frames ); + void processClamRetract( int _frames ); // spider crab functions