diff --git a/Graphics/characters/SeaSnake/AnimList.Txt b/Graphics/characters/SeaSnake/AnimList.Txt index 8a29b5cbd..3b2d7e4c6 100644 --- a/Graphics/characters/SeaSnake/AnimList.Txt +++ b/Graphics/characters/SeaSnake/AnimList.Txt @@ -1,2 +1,3 @@ bodystatic -headstatic \ No newline at end of file +headstatic +headstaticmouthshut \ No newline at end of file diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index e81ffb9b3..a5a890a5f 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -428,15 +428,15 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SEA_SNAKE ACTORS_SEASNAKE_SBK, - ANIM_SEASNAKE_HEADSTATIC, - NPC_SENSOR_NONE, + ANIM_SEASNAKE_HEADSTATICMOUTHSHUT, + NPC_SENSOR_USER_CLOSE, NPC_MOVEMENT_FIXED_PATH, NPC_CLOSE_NONE, NPC_TIMER_NONE, false, 3, 256, - DETECT_ATTACK_COLLISION_GENERIC, + DETECT_ALL_COLLISION, DAMAGE__SHOCK_ENEMY, 1, 0, diff --git a/source/enemy/nssnake.cpp b/source/enemy/nssnake.cpp index 7c0013979..394ff5cee 100644 --- a/source/enemy/nssnake.cpp +++ b/source/enemy/nssnake.cpp @@ -222,7 +222,12 @@ void CNpcSeaSnakeEnemy::shutdown() bool CNpcSeaSnakeEnemy::processSensor() { - /*if ( playerXDistSqr + playerYDistSqr < 40000 ) + if ( m_sensorFunc == NPC_SENSOR_NONE ) + { + return( false ); + } + + if ( playerXDistSqr + playerYDistSqr < 40000 ) { m_controlFunc = NPC_CONTROL_CLOSE; @@ -231,9 +236,7 @@ bool CNpcSeaSnakeEnemy::processSensor() else { return( false ); - }*/ - - return( false ); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -246,6 +249,39 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames ) DVECTOR oldPos = Pos; u8 skipCounter; + if ( m_snapTimer > 0 ) + { + m_snapTimer -= _frames; + + if ( m_snapTimer <= 0 ) + { + m_animNo = ANIM_SEASNAKE_HEADSTATICMOUTHSHUT; + m_animPlaying = true; + m_frame = 0; + } + else + { + m_openTimer -= _frames; + + if ( m_openTimer <= 0 ) + { + if ( m_animNo == ANIM_SEASNAKE_HEADSTATIC ) + { + m_animNo = ANIM_SEASNAKE_HEADSTATICMOUTHSHUT; + } + else + { + m_animNo = ANIM_SEASNAKE_HEADSTATIC; + } + + m_animPlaying = true; + m_frame = 0; + + m_openTimer = GameState::getOneSecondInFrames() >> 2; + } + } + } + if ( m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS ) { CSoundMediator::playSfx( m_data[m_type].moveSfx ); @@ -477,6 +513,9 @@ void CNpcSeaSnakeEnemy::processClose( int _frames ) m_timerFunc = NPC_TIMER_ATTACK_DONE; m_timerTimer = GameState::getOneSecondInFrames(); m_sensorFunc = NPC_SENSOR_NONE; + + m_snapTimer = m_movementTimer; + m_openTimer = GameState::getOneSecondInFrames() >> 2; } @@ -729,4 +768,10 @@ const CRECT *CNpcSeaSnakeEnemy::getThinkBBox() objThinkBox.y2 = thinkBBox.YMax; return &objThinkBox; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSeaSnakeEnemy::processUserCollision( CThing *thisThing ) +{ } \ No newline at end of file diff --git a/source/enemy/nssnake.h b/source/enemy/nssnake.h index f0f8c27a5..f5ff932dc 100644 --- a/source/enemy/nssnake.h +++ b/source/enemy/nssnake.h @@ -60,6 +60,7 @@ protected: virtual void processMovement( int _frames ); virtual void processShot( int _frames ); virtual void processEnemyCollision( CThing *thisThing ); + virtual void processUserCollision( CThing *thisThing ); enum { @@ -80,6 +81,8 @@ protected: CNpcSeaSnakeSegment *m_segment; CNpcPositionHistory *m_positionHistory; s32 m_collTimer; + s32 m_snapTimer; + s32 m_openTimer; }; #endif \ No newline at end of file