diff --git a/Graphics/characters/IronDogFish/AnimList.Txt b/Graphics/characters/IronDogFish/AnimList.Txt index 06e737d73..65098a291 100644 --- a/Graphics/characters/IronDogFish/AnimList.Txt +++ b/Graphics/characters/IronDogFish/AnimList.Txt @@ -2,4 +2,5 @@ gethit idle punch tailsmash -walk \ No newline at end of file +walk +die \ No newline at end of file diff --git a/Graphics/characters/SharkSub/AnimList.txt b/Graphics/characters/SharkSub/AnimList.txt index dffd10751..933e6bc67 100644 --- a/Graphics/characters/SharkSub/AnimList.txt +++ b/Graphics/characters/SharkSub/AnimList.txt @@ -1,5 +1,5 @@ chomp -# death +death # gethit # sprintclosed sprintopen diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index d6c303148..ae631bd31 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -35,6 +35,10 @@ #include #endif +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -333,3 +337,116 @@ void CNpcIronDogfishEnemy::processTimer(int _frames) CNpcEnemy::processTimer( _frames ); } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcIronDogfishEnemy::processShot( int _frames ) +{ + switch( m_data[m_type].shotFunc ) + { + case NPC_SHOT_NONE: + { + // do nothing + + break; + } + + case NPC_SHOT_GENERIC: + { + switch ( m_state ) + { + case NPC_GENERIC_HIT_CHECK_HEALTH: + { + m_health -= 5; + + if ( m_health < 0 ) + { + m_state = NPC_GENERIC_HIT_DEATH_START; + m_isDying = true; + } + else + { + m_state = NPC_GENERIC_HIT_RECOIL; + + m_animPlaying = true; + m_animNo = m_data[m_type].recoilAnim; + m_frame = 0; + } + + break; + } + + case NPC_GENERIC_HIT_RECOIL: + { + if ( !m_animPlaying ) + { + m_state = 0; + m_controlFunc = NPC_CONTROL_MOVEMENT; + } + + break; + } + + case NPC_GENERIC_HIT_DEATH_START: + { + m_animPlaying = true; + m_animNo = m_data[m_type].dieAnim; + m_frame = 0; + m_state = NPC_GENERIC_HIT_DEATH_END; + m_isDying = true; + + if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS ) + { + CSoundMediator::playSfx( m_data[m_type].deathSfx ); + } + + m_speed = -5; + + if (m_data[m_type].skelType) + { + m_actorGfx->SetOtPos( 0 ); + } + + break; + } + + case NPC_GENERIC_HIT_DEATH_END: + { + if ( !m_animPlaying ) + { + 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() ) + { + if ( m_data[m_type].respawning ) + { + m_isActive = false; + + m_timerFunc = NPC_TIMER_RESPAWN; + m_timerTimer = 4 * GameState::getOneSecondInFrames(); + } + else + { + setToShutdown(); + } + } + } + + break; + } + } + + break; + } + } +} diff --git a/source/enemy/ndogfish.h b/source/enemy/ndogfish.h index 99fb374b1..f790ddbfc 100644 --- a/source/enemy/ndogfish.h +++ b/source/enemy/ndogfish.h @@ -27,6 +27,7 @@ protected: void processWalkToUser( int _frames, int speed ); virtual void processAttackCollision(); virtual void hasBeenSteamed( DVECTOR &steamPos ); + virtual void processShot( int _frames ); enum NPC_IRON_DOGFISH_STATE { diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 4cf5a2410..e81ffb9b3 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -935,7 +935,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = 50, 0, NPC_SHOT_GENERIC, - 0, + ANIM_SHARKSUB_DEATH, 0, false, false, @@ -943,7 +943,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = false, CSoundMediator::NUM_SFXIDS, CSoundMediator::NUM_SFXIDS, - false, + true, }, { // NPC_PARASITIC_WORM @@ -1013,7 +1013,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = 50, ANIM_IRONDOGFISH_WALK, NPC_SHOT_GENERIC, - 0, + ANIM_IRONDOGFISH_DIE, ANIM_IRONDOGFISH_GETHIT, false, false, @@ -1021,7 +1021,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = false, CSoundMediator::NUM_SFXIDS, CSoundMediator::NUM_SFXIDS, - false, + true, }, { // NPC_PARASITIC_WORM_SEGMENT diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index c40dafd12..c70511bbf 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -35,6 +35,12 @@ #include #endif +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcSubSharkEnemy::postInit() { @@ -44,6 +50,8 @@ void CNpcSubSharkEnemy::postInit() m_salvoCount = 0; } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcSubSharkEnemy::processMovement( int _frames ) { if ( !m_animPlaying ) @@ -152,6 +160,8 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) }*/ } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcSubSharkEnemy::processClose( int _frames ) { if ( m_state != SUB_SHARK_SWALLOW ) @@ -276,4 +286,117 @@ void CNpcSubSharkEnemy::processClose( int _frames ) break; } } -} \ No newline at end of file +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSubSharkEnemy::processShot( int _frames ) +{ + switch( m_data[m_type].shotFunc ) + { + case NPC_SHOT_NONE: + { + // do nothing + + break; + } + + case NPC_SHOT_GENERIC: + { + switch ( m_state ) + { + case NPC_GENERIC_HIT_CHECK_HEALTH: + { + m_health -= 5; + + if ( m_health < 0 ) + { + m_state = NPC_GENERIC_HIT_DEATH_START; + m_isDying = true; + } + else + { + m_state = NPC_GENERIC_HIT_RECOIL; + + m_animPlaying = true; + m_animNo = m_data[m_type].recoilAnim; + m_frame = 0; + } + + break; + } + + case NPC_GENERIC_HIT_RECOIL: + { + if ( !m_animPlaying ) + { + m_state = 0; + m_controlFunc = NPC_CONTROL_MOVEMENT; + } + + break; + } + + case NPC_GENERIC_HIT_DEATH_START: + { + m_animPlaying = true; + m_animNo = m_data[m_type].dieAnim; + m_frame = 0; + m_state = NPC_GENERIC_HIT_DEATH_END; + m_isDying = true; + + if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS ) + { + CSoundMediator::playSfx( m_data[m_type].deathSfx ); + } + + m_speed = -5; + + if (m_data[m_type].skelType) + { + m_actorGfx->SetOtPos( 0 ); + } + + break; + } + + case NPC_GENERIC_HIT_DEATH_END: + { + if ( !m_animPlaying ) + { + 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() ) + { + if ( m_data[m_type].respawning ) + { + m_isActive = false; + + m_timerFunc = NPC_TIMER_RESPAWN; + m_timerTimer = 4 * GameState::getOneSecondInFrames(); + } + else + { + setToShutdown(); + } + } + } + + break; + } + } + + break; + } + } +} diff --git a/source/enemy/nsshark.h b/source/enemy/nsshark.h index 6f9db7a9c..b74b7597a 100644 --- a/source/enemy/nsshark.h +++ b/source/enemy/nsshark.h @@ -21,6 +21,7 @@ public: protected: virtual void processClose( int _frames ); virtual void processMovement( int _frames ); + virtual void processShot( int _frames ); enum NPC_SUB_SHARK_STATE {