This commit is contained in:
Charles 2001-07-06 14:55:58 +00:00
parent a4b3ec5d5f
commit c0038da590
7 changed files with 63 additions and 12 deletions

View File

@ -554,11 +554,16 @@ void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing )
void CNpcIronDogfishEnemy::shutdown() void CNpcIronDogfishEnemy::shutdown()
{ {
CLevel::setIsBossRespawn( true );
if ( m_state != NPC_GENERIC_HIT_DEATH_END ) if ( m_state != NPC_GENERIC_HIT_DEATH_END )
{ {
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health ); CLevel::setBossHealth( m_health );
} }
else
{
CLevel::setBossHealth( 0 );
}
CNpcBossEnemy::shutdown(); CNpcBossEnemy::shutdown();
} }

View File

@ -650,11 +650,16 @@ void CNpcFlyingDutchmanEnemy::processShotDeathEnd( int _frames )
void CNpcFlyingDutchmanEnemy::shutdown() void CNpcFlyingDutchmanEnemy::shutdown()
{ {
CLevel::setIsBossRespawn( true );
if ( m_state != NPC_GENERIC_HIT_DEATH_END ) if ( m_state != NPC_GENERIC_HIT_DEATH_END )
{ {
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health ); CLevel::setBossHealth( m_health );
} }
else
{
CLevel::setBossHealth( 0 );
}
CNpcBossEnemy::shutdown(); CNpcBossEnemy::shutdown();
} }

View File

@ -620,11 +620,16 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
void CNpcMotherJellyfishEnemy::shutdown() void CNpcMotherJellyfishEnemy::shutdown()
{ {
CLevel::setIsBossRespawn( true );
if ( m_isActive ) if ( m_isActive )
{ {
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health ); CLevel::setBossHealth( m_health );
} }
else
{
CLevel::setBossHealth( 0 );
}
for ( int i = 0 ; i < 4 ; i++ ) for ( int i = 0 ; i < 4 ; i++ )
{ {

View File

@ -216,6 +216,27 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::getTypeFromMapEdit( u16 newType )
CNpcEnemy *CNpcEnemy::Create(int enemyType) CNpcEnemy *CNpcEnemy::Create(int enemyType)
{ {
switch( enemyType )
{
case CNpcEnemy::NPC_MOTHER_JELLYFISH:
case CNpcEnemy::NPC_SUB_SHARK:
case CNpcEnemy::NPC_SEA_SNAKE:
case CNpcEnemy::NPC_FLYING_DUTCHMAN:
case CNpcEnemy::NPC_IRON_DOGFISH:
{
if ( CLevel::getIsBossRespawn() )
{
if ( !CLevel::getBossHealth() )
{
return( NULL );
}
}
}
default:
break;
}
CNpcEnemy *enemy; CNpcEnemy *enemy;
enemy = (CNpcEnemy*)CThingManager::GetThing(TYPE_ENEMY,enemyType); enemy = (CNpcEnemy*)CThingManager::GetThing(TYPE_ENEMY,enemyType);
@ -455,7 +476,6 @@ CNpcEnemy *enemy;
NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( ThisActor->Type ); NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( ThisActor->Type );
enemy = (CNpcEnemy*)Create(enemyType); enemy = (CNpcEnemy*)Create(enemyType);
ASSERT(enemy);
return(enemy); return(enemy);
} }

View File

@ -712,11 +712,16 @@ void CNpcSubSharkEnemy::processShot( int _frames )
void CNpcSubSharkEnemy::shutdown() void CNpcSubSharkEnemy::shutdown()
{ {
CLevel::setIsBossRespawn( true );
if ( m_state != NPC_GENERIC_HIT_DEATH_END ) if ( m_state != NPC_GENERIC_HIT_DEATH_END )
{ {
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health ); CLevel::setBossHealth( m_health );
} }
else
{
CLevel::setBossHealth( 0 );
}
CNpcBossEnemy::shutdown(); CNpcBossEnemy::shutdown();
} }

View File

@ -179,11 +179,16 @@ void CNpcSeaSnakeSegment::shutdown()
void CNpcSeaSnakeEnemy::shutdown() void CNpcSeaSnakeEnemy::shutdown()
{ {
CLevel::setIsBossRespawn( true );
if ( m_state != NPC_GENERIC_HIT_DEATH_END ) if ( m_state != NPC_GENERIC_HIT_DEATH_END )
{ {
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health ); CLevel::setBossHealth( m_health );
} }
else
{
CLevel::setBossHealth( 0 );
}
// delete snake segments // delete snake segments

View File

@ -492,6 +492,11 @@ void CLevel::initThings(int _respawningLevel)
{ {
CNpcEnemy *enemy; CNpcEnemy *enemy;
enemy=CNpcEnemy::Create(ThisActor); enemy=CNpcEnemy::Create(ThisActor);
if ( enemy )
{
// if boss is killed and user dies, boss will not initialise and will return NULL
enemy->setupWaypoints( ThisActor ); enemy->setupWaypoints( ThisActor );
enemy->postInit(); enemy->postInit();
@ -500,6 +505,7 @@ void CLevel::initThings(int _respawningLevel)
enemy->setSpeed( ThisActor->Speed ); enemy->setSpeed( ThisActor->Speed );
} }
} }
}
break; break;
case CGameScene::ACTOR_FRIEND_NPC: case CGameScene::ACTOR_FRIEND_NPC:
@ -563,8 +569,8 @@ void CLevel::initThings(int _respawningLevel)
/*****************************************************************************/ /*****************************************************************************/
void CLevel::respawnLevel() void CLevel::respawnLevel()
{ {
m_isBossRespawn = false; //m_isBossRespawn = false;
m_bossHealth = 0; //m_bossHealth = 0;
CThingManager::killAllThingsForRespawn(); CThingManager::killAllThingsForRespawn();
initThings(true); initThings(true);