This commit is contained in:
Charles 2001-05-29 15:56:44 +00:00
parent 3f4d387a25
commit 525b7f56fd
7 changed files with 234 additions and 31 deletions

View File

@ -1 +1,2 @@
crawl
die

View File

@ -31,6 +31,13 @@
#include <ACTOR_HERMITCRAB_ANIM.h>
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHermitCrabEnemy::postInit()
{
m_npcPath.setPathType( CNpcPath::PONG_PATH );
@ -38,6 +45,8 @@ void CNpcHermitCrabEnemy::postInit()
m_state = HERMIT_CRAB_NO_ATTACK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcHermitCrabEnemy::processSensor()
{
switch( m_sensorFunc )
@ -61,6 +70,8 @@ bool CNpcHermitCrabEnemy::processSensor()
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHermitCrabEnemy::processClose( int _frames )
{
if ( m_state == HERMIT_CRAB_NO_ATTACK )
@ -234,6 +245,8 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
Pos.vx += distX;
@ -261,3 +274,108 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_MOVE );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHermitCrabEnemy::processShot( int _frames )
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
if ( CLevel::getCurrentChapter() == 1 && CLevel::getCurrentChapterLevel() == 1 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
}
else
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 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:
{
if ( !m_animPlaying )
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
if ( !m_animPlaying )
{
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
CSoundMediator::playSfx( m_data[m_type].deathSfx );
}
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
DVECTOR offset = CLevel::getCameraPos();
if ( Pos.vy - offset.vy > VidGetScrH() )
{
if ( m_data[m_type].respawning )
{
m_isActive = false;
m_timerFunc = NPC_TIMER_RESPAWN;
m_timerTimer = 4 * GameState::getOneSecondInFrames();
}
else
{
setToShutdown();
}
}
break;
}
}
}

View File

@ -25,6 +25,7 @@ public:
protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual bool processSensor();
virtual void processShot( int _frames );
virtual void processClose( int _frames );
s32 m_jumpBase;

View File

@ -19,8 +19,15 @@
#include "level\layercollision.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
#include "game/game.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
Pos.vx += distX;
@ -48,3 +55,108 @@ void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 d
CSoundMediator::playSfx( CSoundMediator::SFX_PRICKLY_BUG_MOVE );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPricklyBugEnemy::processShot( int _frames )
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
if ( CLevel::getCurrentChapter() == 1 && CLevel::getCurrentChapterLevel() == 1 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
}
else
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 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:
{
if ( !m_animPlaying )
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
if ( !m_animPlaying )
{
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
CSoundMediator::playSfx( m_data[m_type].deathSfx );
}
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
DVECTOR offset = CLevel::getCameraPos();
if ( Pos.vy - offset.vy > VidGetScrH() )
{
if ( m_data[m_type].respawning )
{
m_isActive = false;
m_timerFunc = NPC_TIMER_RESPAWN;
m_timerTimer = 4 * GameState::getOneSecondInFrames();
}
else
{
setToShutdown();
}
}
break;
}
}
}

View File

@ -22,6 +22,7 @@ class CNpcPricklyBugEnemy : public CNpcEnemy
{
protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual void processShot( int _frames );
};
#endif

View File

@ -368,36 +368,6 @@ CNpcEnemy *CNpcEnemy::Create(int enemyType)
break;
}
/*case CNpcEnemy::NPC_FALLING_ITEM:
{
enemy = new ("falling item") CNpcFallingItemHazard;
break;
}*/
/*case CNpcEnemy::NPC_FISH_HOOK:
{
enemy = new ("fish hook") CNpcFishHookHazard;
break;
}*/
/*case CNpcEnemy::NPC_PENDULUM:
{
enemy = new ("pendulum") CNpcPendulumHazard;
break;
}*/
/*case CNpcEnemy::NPC_FIREBALL:
{
enemy = new ("fireball") CNpcFireballHazard;
break;
}*/
/*case CNpcEnemy::NPC_SAW_BLADE:
{
enemy = new ("saw blade") CNpcReturningHazard;
break;
}*/
case CNpcEnemy::NPC_DUST_DEVIL:
{
enemy = new ("dust devil") CNpcDustDevilEnemy;

View File

@ -403,7 +403,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
9,
ANIM_CATERPILLAR_CRAWL,
NPC_SHOT_GENERIC,
0,
ANIM_CATERPILLAR_DIE,
0,
false,
false,