diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index 8698bd42f..a208c9e49 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -39,6 +39,9 @@ #include "system\vid.h" #endif +#include "fx\fx.h" +#include "fx\fxnrgbar.h" + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -49,6 +52,13 @@ void CNpcIronDogfishEnemy::postInit() m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_steamTimer = 0; m_vulnerableTimer = 0; + m_meterOn=false; + + if ( CLevel::getIsBossRespawn() ) + { + m_health = CLevel::getBossHealth(); + m_speed = m_data[m_type].speed + ( ( 3 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth ); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -555,3 +565,47 @@ void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing ) } } } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcIronDogfishEnemy::shutdown() +{ + if ( m_state != NPC_GENERIC_HIT_DEATH_END ) + { + CLevel::setIsBossRespawn( true ); + CLevel::setBossHealth( m_health ); + } + + CNpcEnemy::shutdown(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcIronDogfishEnemy::render() +{ + SprFrame = NULL; + + if ( m_isActive ) + { + CEnemyThing::render(); + + if (canRender()) + { + if (!m_meterOn) + { + CFXNRGBar *T=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); + T->SetMax(m_health); + m_meterOn=true; + } + + DVECTOR &renderPos=getRenderPos(); + + SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed); + m_actorGfx->RotateScale( SprFrame, renderPos, 0, 4096, 4096 ); + + sBBox boundingBox = m_actorGfx->GetBBox(); + setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); + setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 ); + } + } +} diff --git a/source/enemy/ndogfish.h b/source/enemy/ndogfish.h index 46610c249..4dc49f15b 100644 --- a/source/enemy/ndogfish.h +++ b/source/enemy/ndogfish.h @@ -18,6 +18,8 @@ class CNpcIronDogfishEnemy : public CNpcEnemy { public: virtual void postInit(); + void render(); + virtual void shutdown(); protected: virtual void processTimer( int _frames ); virtual bool processSensor(); @@ -41,6 +43,7 @@ protected: s32 m_steamTimer; s32 m_vulnerableTimer; + bool m_meterOn; }; #endif \ No newline at end of file