From 2922d6e9be30f7209d5655dd47bcdc0a287073f2 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 16 Jun 2001 18:25:07 +0000 Subject: [PATCH] --- source/enemy/nssnake.cpp | 49 +++++++++++++++++++++++++++++++++++++++- source/enemy/nssnake.h | 1 + 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/source/enemy/nssnake.cpp b/source/enemy/nssnake.cpp index 30af0b0ee..289a0ba37 100644 --- a/source/enemy/nssnake.cpp +++ b/source/enemy/nssnake.cpp @@ -39,6 +39,18 @@ #include #endif +#ifndef __PROJECTL_PROJECTL_H__ +#include "projectl\projectl.h" +#endif + +#ifndef __SPR_SPRITES_H__ +#include +#endif + +#include "fx\fx.h" +#include "fx\fxnrgbar.h" + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcSeaSnakeSegment::init() @@ -110,6 +122,14 @@ void CNpcSeaSnakeEnemy::postInit() int initLength = NPC_SEA_SNAKE_LENGTH / 3; int remLength = NPC_SEA_SNAKE_LENGTH - initLength; + m_health = NPC_SEA_SNAKE_LENGTH; + + if ( CLevel::getIsBossRespawn() ) + { + m_health = CLevel::getBossHealth(); + m_speed = m_data[m_type].speed + ( ( 3 * ( NPC_SEA_SNAKE_LENGTH - m_health ) ) / NPC_SEA_SNAKE_LENGTH ); + } + for ( int segCount = 0 ; segCount < NPC_SEA_SNAKE_LENGTH ; segCount++ ) { m_segmentArray[segCount].init(); @@ -141,10 +161,11 @@ void CNpcSeaSnakeEnemy::postInit() } } - m_segmentCount = NPC_SEA_SNAKE_LENGTH; + m_segmentCount = m_health; m_movementTimer = 2 * GameState::getOneSecondInFrames(); m_collTimer = 0; + m_meterOn=false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -158,6 +179,12 @@ void CNpcSeaSnakeSegment::shutdown() void CNpcSeaSnakeEnemy::shutdown() { + if ( m_state != NPC_GENERIC_HIT_DEATH_END ) + { + CLevel::setIsBossRespawn( true ); + CLevel::setBossHealth( m_health ); + } + // delete snake segments for ( int segCount = 0 ; segCount < NPC_SEA_SNAKE_LENGTH ; segCount++ ) @@ -444,6 +471,16 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames ) void CNpcSeaSnakeEnemy::processClose( int _frames ) { + // fire at player + + s16 heading = ratan2( playerYDist, playerXDist ) & 4095; + + CProjectile *projectile; + projectile = CProjectile::Create(); + DVECTOR newPos = Pos; + projectile->init( newPos, heading ); + projectile->setGraphic( FRM__LIGHTNING1 ); + //resetSeaSnakeHeadToTail(); m_movementTimer = 2 * GameState::getOneSecondInFrames(); @@ -484,6 +521,13 @@ void CNpcSeaSnakeEnemy::render() if (canRender()) { + if (!m_meterOn) + { + CFXNRGBar *T=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); + T->SetMax( NPC_SEA_SNAKE_LENGTH ); + m_meterOn=true; + } + DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),0); @@ -651,6 +695,7 @@ void CNpcSeaSnakeEnemy::processShot( int _frames ) { setToShutdown(); CGameScene::setBossHasBeenKilled(); + m_state = NPC_GENERIC_HIT_DEATH_END; } } else @@ -660,6 +705,8 @@ void CNpcSeaSnakeEnemy::processShot( int _frames ) // knock segment off end of list m_segmentCount--; + m_health--; + m_speed = m_data[m_type].speed + ( ( 3 * ( NPC_SEA_SNAKE_LENGTH - m_health ) ) / NPC_SEA_SNAKE_LENGTH ); m_collTimer = GameState::getOneSecondInFrames(); } diff --git a/source/enemy/nssnake.h b/source/enemy/nssnake.h index c2ede7bf6..649b3655c 100644 --- a/source/enemy/nssnake.h +++ b/source/enemy/nssnake.h @@ -86,6 +86,7 @@ protected: s32 m_collTimer; s32 m_snapTimer; s32 m_openTimer; + bool m_meterOn; }; #endif \ No newline at end of file