SBSPSS/source/enemy/nboss.cpp

117 lines
2.1 KiB
C++
Raw Normal View History

2001-06-30 17:57:22 +02:00
/*=========================================================================
nboss.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __ENEMY_NBOSS_H__
#include "enemy\nboss.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBossEnemy::postInit()
{
m_meterOn=false;
m_energyBar = NULL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBossEnemy::shutdown()
{
if ( m_energyBar )
{
2001-07-05 16:39:00 +02:00
m_energyBar->killFX();
2001-06-30 17:57:22 +02:00
}
CNpcEnemy::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBossEnemy::addHealthMeter()
{
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;
}
}
2001-08-02 17:26:38 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBossEnemy::processShot( int _frames )
{
switch( m_data[m_type].shotFunc )
{
case NPC_SHOT_NONE:
{
// do nothing
m_controlFunc = m_oldControlFunc;
break;
}
case NPC_SHOT_GENERIC:
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health--;
if ( m_health <= 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
m_isDying = true;
m_health = 0;
}
else
{
m_state = NPC_GENERIC_HIT_RECOIL;
m_animPlaying = true;
m_animNo = m_data[m_type].recoilAnim;
m_frame = 0;
}
break;
}
case NPC_GENERIC_HIT_RECOIL:
{
processShotRecoil( _frames );
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
processShotDeathStart( _frames );
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
processShotDeathEnd( _frames );
break;
}
}
break;
}
}
}