From b81f49a1cd6b465ccc71b6c9e645199517801f3c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 4 May 2001 21:58:41 +0000 Subject: [PATCH] --- source/enemy/nmjfish.cpp | 18 ++++++++++++++++++ source/enemy/nmjfish.h | 1 + source/level/level.cpp | 8 ++++++++ source/level/level.h | 8 ++++++++ 4 files changed, 35 insertions(+) diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index a0ae0765f..ff7f9e3ff 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -45,6 +45,11 @@ void CNpcMotherJellyfishEnemy::postInit() { m_state = MOTHER_JELLYFISH_RETURN_TO_START_1; m_spawnTimer = 0; + + if ( CLevel::getIsBossRespawn() ) + { + m_health = CLevel::getBossHealth(); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -242,6 +247,19 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames ) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcMotherJellyfishEnemy::shutdown() +{ + if ( m_isActive ) + { + CLevel::setIsBossRespawn( true ); + CLevel::setBossHealth( m_health ); + } + + CNpcEnemy::shutdown(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames ) { if ( m_jellyfishCount ) diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 8cf52316b..950256095 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -19,6 +19,7 @@ class CNpcMotherJellyfishEnemy : public CNpcEnemy public: virtual void postInit(); void render(); + virtual void shutdown(); protected: virtual void processClose( int _frames ); virtual void processMovement( int _frames ); diff --git a/source/level/level.cpp b/source/level/level.cpp index 69b846cd8..958330537 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -128,6 +128,8 @@ const FileEquate loadingScreens[6]= DVECTOR CLevel::MapPos; DVECTOR CLevel::s_playerSpawnPos; +u8 CLevel::m_isBossRespawn; +s32 CLevel::m_bossHealth; /*****************************************************************************/ CLevel::CLevel() { @@ -178,6 +180,9 @@ sLvlTab *lvlTab=&LvlTable[LevelNo]; MapPos.vx=MapPos.vy=0; initLayers(); + + m_isBossRespawn = false; + m_bossHealth = 0; } /*****************************************************************************/ @@ -486,6 +491,9 @@ void CLevel::initThings(int _respawningLevel) /*****************************************************************************/ void CLevel::respawnLevel() { + m_isBossRespawn = false; + m_bossHealth = 0; + CThingManager::killAllThingsForRespawn(); initThings(true); } diff --git a/source/level/level.h b/source/level/level.h index 316de305e..eceb96bd3 100644 --- a/source/level/level.h +++ b/source/level/level.h @@ -52,6 +52,11 @@ public: void respawnLevel(); + static u8 getIsBossRespawn() {return m_isBossRespawn;} + static s32 getBossHealth() {return m_bossHealth;} + static void setIsBossRespawn( u8 newIsBossRespawn ) {m_isBossRespawn=newIsBossRespawn;} + static void setBossHealth( s32 newBossHealth ) {m_bossHealth=newBossHealth;} + private: void initLayers(); @@ -86,6 +91,9 @@ private: int HazardCount; sThingHazard **HazardList; + static u8 m_isBossRespawn; + static s32 m_bossHealth; + }; /*****************************************************************************/