diff --git a/makefile.gaz b/makefile.gaz index df4374752..b9ecc0ac4 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -88,7 +88,8 @@ enemy_src := npc \ nsj2back \ nbuttfly \ nshell \ - nssnake + nssnake \ + nboss friend_src := friend \ fdata \ diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index 9229b08d3..998928c77 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -49,7 +49,6 @@ void CNpcIronDogfishEnemy::postInit() m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_steamTimer = 0; m_vulnerableTimer = 0; - m_meterOn=false; if ( CLevel::getIsBossRespawn() ) { @@ -57,7 +56,7 @@ void CNpcIronDogfishEnemy::postInit() m_speed = m_data[m_type].speed + ( ( 3 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth ); } - m_energyBar = NULL; + CNpcBossEnemy::postInit(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -552,12 +551,7 @@ void CNpcIronDogfishEnemy::shutdown() CLevel::setBossHealth( m_health ); } - if ( m_energyBar ) - { - m_energyBar->setToShutdown(); - } - - CNpcEnemy::shutdown(); + CNpcBossEnemy::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -572,13 +566,6 @@ void CNpcIronDogfishEnemy::render() if (canRender()) { - if (!m_meterOn) - { - m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); - m_energyBar->SetMax(m_data[m_type].initHealth); - m_meterOn=true; - } - DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed); diff --git a/source/enemy/ndogfish.h b/source/enemy/ndogfish.h index 5ff924f69..6ae63aa77 100644 --- a/source/enemy/ndogfish.h +++ b/source/enemy/ndogfish.h @@ -16,10 +16,13 @@ #include "fx\fx.h" #include "fx\fxlaser.h" -#include "fx\fxnrgbar.h" + +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif -class CNpcIronDogfishEnemy : public CNpcEnemy +class CNpcIronDogfishEnemy : public CNpcBossEnemy { public: virtual void postInit(); @@ -52,10 +55,8 @@ protected: s32 m_steamTimer; s32 m_vulnerableTimer; s32 m_laserTimer; - bool m_meterOn; CFXLaser *m_effect; - CFXNRGBar *m_energyBar; }; #endif \ No newline at end of file diff --git a/source/enemy/neyeball.cpp b/source/enemy/neyeball.cpp index c7e761fd4..daacba0f2 100644 --- a/source/enemy/neyeball.cpp +++ b/source/enemy/neyeball.cpp @@ -231,6 +231,9 @@ void CNpcEyeballEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing ) break; } + + default: + break; } } diff --git a/source/enemy/nfdutch.cpp b/source/enemy/nfdutch.cpp index 057b34941..2cf314633 100644 --- a/source/enemy/nfdutch.cpp +++ b/source/enemy/nfdutch.cpp @@ -56,7 +56,6 @@ void CNpcFlyingDutchmanEnemy::postInit() m_npcPath.getPathYExtents( &m_minY, &m_maxY ); m_extension = minX; - m_meterOn=false; m_inRange = false; if ( CLevel::getIsBossRespawn() ) @@ -68,7 +67,7 @@ void CNpcFlyingDutchmanEnemy::postInit() m_invulnerableTimer = 0; - m_energyBar = NULL; + CNpcBossEnemy::postInit(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -342,12 +341,7 @@ void CNpcFlyingDutchmanEnemy::shutdown() CLevel::setBossHealth( m_health ); } - if ( m_energyBar ) - { - m_energyBar->setToShutdown(); - } - - CNpcEnemy::shutdown(); + CNpcBossEnemy::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -362,13 +356,6 @@ void CNpcFlyingDutchmanEnemy::render() if (canRender()) { - if (!m_meterOn) - { - m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); - m_energyBar->SetMax(m_data[m_type].initHealth); - m_meterOn=true; - } - DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed); diff --git a/source/enemy/nfdutch.h b/source/enemy/nfdutch.h index ab313cb92..ca8e5e681 100644 --- a/source/enemy/nfdutch.h +++ b/source/enemy/nfdutch.h @@ -14,11 +14,12 @@ #ifndef __ENEMY_NFDUTCH_H__ #define __ENEMY_NFDUTCH_H__ -#include "fx\fx.h" -#include "fx\fxnrgbar.h" +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif -class CNpcFlyingDutchmanEnemy : public CNpcEnemy +class CNpcFlyingDutchmanEnemy : public CNpcBossEnemy { public: virtual void think( int _frames ); @@ -40,11 +41,9 @@ protected: }; s32 m_minY, m_maxY; - bool m_meterOn; u8 m_inRange; u8 m_fireCount; s32 m_invulnerableTimer; - CFXNRGBar *m_energyBar; }; #endif \ No newline at end of file diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index d2013d2ea..ce34ea52d 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -50,7 +50,6 @@ void CNpcMotherJellyfishEnemy::postInit() { m_state = MOTHER_JELLYFISH_CYCLE; m_spawnTimer = 0; - m_meterOn=false; if ( CLevel::getIsBossRespawn() ) { @@ -93,7 +92,7 @@ void CNpcMotherJellyfishEnemy::postInit() m_attackCounter = 0; - m_energyBar = NULL; + CNpcBossEnemy::postInit(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -584,12 +583,7 @@ void CNpcMotherJellyfishEnemy::shutdown() CLevel::setBossHealth( m_health ); } - if ( m_energyBar ) - { - m_energyBar->setToShutdown(); - } - - CNpcEnemy::shutdown(); + CNpcBossEnemy::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -633,13 +627,6 @@ void CNpcMotherJellyfishEnemy::render() if (canRender()) { - if (!m_meterOn) - { - m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); - m_energyBar->SetMax(m_data[m_type].initHealth); - m_meterOn=true; - } - DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false); diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 70f0e1c97..fac72ac58 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -14,14 +14,17 @@ #ifndef __ENEMY_NMJFISH_H__ #define __ENEMY_NMJFISH_H__ +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif + #include "fx\fx.h" #include "fx\fxjfish.h" -#include "fx\fxnrgbar.h" #define MJ_PINK ( 255 + ( 128 << 8 ) + ( 255 << 16 ) ) #define MJ_WHITE ( 255 + ( 255 << 8 ) + ( 255 << 16 ) ) -class CNpcMotherJellyfishEnemy : public CNpcEnemy +class CNpcMotherJellyfishEnemy : public CNpcBossEnemy { public: virtual void postInit(); @@ -62,7 +65,6 @@ protected: s32 m_maxPauseTimer; s32 m_cycleWidth; s32 m_halfCycleWidth; - bool m_meterOn; s16 m_renderScale; s32 m_invulnerableTimer; u8 m_attackCounter; @@ -71,7 +73,6 @@ protected: DVECTOR legsPos[4]; DVECTOR targetPos; - CFXNRGBar *m_energyBar; }; #endif \ No newline at end of file diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index bd4045b07..6da24065e 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -207,6 +207,10 @@ #include "enemy\nprojjf.h" #endif +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Enemy NPCs @@ -1443,6 +1447,13 @@ void CNpcEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing ) break; } + + case BOSS_FOUND_EVENT: + { + addHealthMeter(); + + break; + } } } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 82efcf94d..46412f19d 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -262,6 +262,7 @@ protected: virtual void processAnimFrames( int _frames ); virtual void processTimer( int _frames ); bool isCollisionWithGround(); + virtual void addHealthMeter() {} void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ); void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ); diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index 3082d3279..e7076d7bd 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -56,7 +56,6 @@ void CNpcSubSharkEnemy::postInit() m_extendDir = EXTEND_RIGHT; m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_salvoCount = 0; - m_meterOn=false; if ( CLevel::getIsBossRespawn() ) { @@ -70,7 +69,7 @@ void CNpcSubSharkEnemy::postInit() m_salvoCount = 5; m_movementTimer = GameState::getOneSecondInFrames() * ( 1 + ( ( 7 * m_health ) / m_data[m_type].initHealth ) ); - m_energyBar = NULL; + CNpcBossEnemy::postInit(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -663,12 +662,7 @@ void CNpcSubSharkEnemy::shutdown() CLevel::setBossHealth( m_health ); } - if ( m_energyBar ) - { - m_energyBar->setToShutdown(); - } - - CNpcEnemy::shutdown(); + CNpcBossEnemy::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -683,13 +677,6 @@ void CNpcSubSharkEnemy::render() if (canRender()) { - if (!m_meterOn) - { - m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); - m_energyBar->SetMax(m_data[m_type].initHealth); - m_meterOn=true; - } - DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed); diff --git a/source/enemy/nsshark.h b/source/enemy/nsshark.h index 7037d853d..c3dbcefc5 100644 --- a/source/enemy/nsshark.h +++ b/source/enemy/nsshark.h @@ -14,11 +14,12 @@ #ifndef __ENEMY_NSSHARK_H__ #define __ENEMY_NSSHARK_H__ -#include "fx\fx.h" -#include "fx\fxnrgbar.h" +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif -class CNpcSubSharkEnemy : public CNpcEnemy +class CNpcSubSharkEnemy : public CNpcBossEnemy { public: virtual void think( int _frames ); @@ -50,10 +51,8 @@ protected: }; u8 m_salvoCount; - bool m_meterOn; s32 m_invulnerableTimer; DVECTOR m_targetPos; - CFXNRGBar *m_energyBar; }; #endif \ No newline at end of file diff --git a/source/enemy/nssnake.cpp b/source/enemy/nssnake.cpp index bad24234b..acaec1355 100644 --- a/source/enemy/nssnake.cpp +++ b/source/enemy/nssnake.cpp @@ -162,11 +162,10 @@ void CNpcSeaSnakeEnemy::postInit() m_movementTimer = 2 * GameState::getOneSecondInFrames(); m_collTimer = 0; - m_meterOn=false; m_turnDir = 0; m_waitTimer = 0; - m_energyBar = NULL; + CNpcBossEnemy::postInit(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -193,12 +192,7 @@ void CNpcSeaSnakeEnemy::shutdown() m_segmentArray[segCount].shutdown(); } - if ( m_energyBar ) - { - m_energyBar->setToShutdown(); - } - - CNpcEnemy::shutdown(); + CNpcBossEnemy::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -821,13 +815,6 @@ void CNpcSeaSnakeEnemy::render() if (canRender()) { - if (!m_meterOn) - { - m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); - m_energyBar->SetMax( NPC_SEA_SNAKE_LENGTH + 1 ); - m_meterOn=true; - } - DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),0); @@ -1071,3 +1058,15 @@ void CNpcSeaSnakeEnemy::moveEntireSnake( DVECTOR newPos ) m_positionHistoryArray[histLength].pos = Pos; } } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSeaSnakeEnemy::addHealthMeter() +{ + if (!m_meterOn) + { + m_energyBar=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); + m_energyBar->SetMax( NPC_SEA_SNAKE_LENGTH + 1 ); + m_meterOn=true; + } +} diff --git a/source/enemy/nssnake.h b/source/enemy/nssnake.h index ac285d581..f01f16d38 100644 --- a/source/enemy/nssnake.h +++ b/source/enemy/nssnake.h @@ -14,8 +14,9 @@ #ifndef __ENEMY_NSSNAKE_H__ #define __ENEMY_NSSNAKE_H__ -#include "fx\fx.h" -#include "fx\fxnrgbar.h" +#ifndef __ENEMY_NBOSS_H__ +#include "enemy\nboss.h" +#endif class CNpcSeaSnakeSegment @@ -52,7 +53,7 @@ protected: int m_collisionRadius; }; -class CNpcSeaSnakeEnemy : public CNpcEnemy +class CNpcSeaSnakeEnemy : public CNpcBossEnemy { public: virtual void postInit(); @@ -70,6 +71,7 @@ protected: u8 processPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist ); u8 isSnakeStopped(); void moveEntireSnake( DVECTOR newPos ); + virtual void addHealthMeter(); enum { @@ -97,12 +99,10 @@ protected: s32 m_collTimer; s32 m_snapTimer; //s32 m_openTimer; - bool m_meterOn; u8 m_turnDir; s16 m_circleHeading; s16 m_origHeading; s32 m_waitTimer; - CFXNRGBar *m_energyBar; }; #endif \ No newline at end of file diff --git a/source/game/event.h b/source/game/event.h index f357a9103..75be514ce 100644 --- a/source/game/event.h +++ b/source/game/event.h @@ -8,6 +8,7 @@ enum GAME_EVENT { PROJECTILE_RETURNED_TO_SOURCE_EVENT, + BOSS_FOUND_EVENT, }; #endif \ No newline at end of file diff --git a/source/game/game.cpp b/source/game/game.cpp index ce978a2ea..29fb24d2b 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -598,6 +598,7 @@ void CGameScene::think_boss_intro(int _frames) { m_gamestate=GAMESTATE_FADING_OUT_OF_BOSS_INTRO; CFader::setFadingOut(); + sendEvent( BOSS_FOUND_EVENT, NULL ); } } }