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()
{
CLevel::setIsBossRespawn( true );
if ( m_state != NPC_GENERIC_HIT_DEATH_END )
{
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health );
}
else
{
CLevel::setBossHealth( 0 );
}
CNpcBossEnemy::shutdown();
}

View File

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

View File

@ -620,11 +620,16 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
void CNpcMotherJellyfishEnemy::shutdown()
{
CLevel::setIsBossRespawn( true );
if ( m_isActive )
{
CLevel::setIsBossRespawn( true );
CLevel::setBossHealth( m_health );
}
else
{
CLevel::setBossHealth( 0 );
}
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)
{
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;
enemy = (CNpcEnemy*)CThingManager::GetThing(TYPE_ENEMY,enemyType);
@ -455,7 +476,6 @@ CNpcEnemy *enemy;
NPC_UNIT_TYPE enemyType = CNpcEnemy::getTypeFromMapEdit( ThisActor->Type );
enemy = (CNpcEnemy*)Create(enemyType);
ASSERT(enemy);
return(enemy);
}

View File

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

View File

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

View File

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