This commit is contained in:
Charles 2001-06-28 20:29:14 +00:00
parent d3062a046c
commit b19db66ed5
13 changed files with 177 additions and 649 deletions

View File

@ -285,119 +285,26 @@ void CNpcAnemone2Enemy::shutdown()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processShot( int _frames )
void CNpcAnemone2Enemy::processShotDeathStart( int _frames )
{
switch( m_data[m_type].shotFunc )
{
case NPC_SHOT_NONE:
{
// do nothing
break;
}
case NPC_SHOT_GENERIC:
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
}
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:
{
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
}
CNpcEnemy::processShotDeathStart( _frames );
deleteAllChild();
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
}
break;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case NPC_GENERIC_HIT_DEATH_END:
{
void CNpcAnemone2Enemy::processShotDeathEnd( int _frames )
{
m_heading += 64 * _frames;
m_heading &= 4095;
m_drawRotation = ( m_heading + 1024 ) & 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;
}
}
break;
}
}
CNpcEnemy::processShotDeathEnd( _frames );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -42,10 +42,11 @@ public:
virtual void postInit();
virtual void shutdown();
virtual void render();
virtual void processShot( int _frames );
protected:
virtual void processClose( int _frames );
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual void processShotDeathStart( int _frames );
virtual void processShotDeathEnd( int _frames );
u16 m_scaleX, m_scaleY;

View File

@ -428,6 +428,7 @@ void CNpcIronDogfishEnemy::hasBeenSteamed( DVECTOR &steamPos )
//hasBeenAttacked();
m_steamTimer = 4 * GameState::getOneSecondInFrames();
m_effect->killFX();
}
}
@ -445,121 +446,17 @@ void CNpcIronDogfishEnemy::processTimer(int _frames)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processShot( int _frames )
void CNpcIronDogfishEnemy::processShotDeathEnd( int _frames )
{
switch( m_data[m_type].shotFunc )
{
case NPC_SHOT_NONE:
{
// do nothing
break;
}
case NPC_SHOT_GENERIC:
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
m_isDying = true;
}
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;
}
CNpcEnemy::processShotDeathEnd( _frames );
break;
}
case NPC_GENERIC_HIT_DEATH_START:
if ( isSetToShutdown() )
{
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
m_isDying = true;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
}
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
if ( !m_animPlaying )
{
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();
CGameScene::setBossHasBeenKilled();
}
}
}
break;
}
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@ protected:
virtual void processCollision();
virtual void processAttackCollision();
virtual void hasBeenSteamed( DVECTOR &steamPos );
virtual void processShot( int _frames );
virtual void processShotDeathEnd( int _frames );
virtual void collidedWith(CThing *_thisThing);
enum NPC_IRON_DOGFISH_STATE

View File

@ -236,41 +236,9 @@ void CNpcEyeballEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEyeballEnemy::processShot( int _frames )
void CNpcEyeballEnemy::processShotDeathStart( int _frames )
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
}
else
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
CNpcEnemy::processShotDeathStart( _frames );
CThing *Next=getNext();
if ( Next )
@ -287,25 +255,17 @@ void CNpcEyeballEnemy::processShot( int _frames )
removeChild( Next );
}
}
}
break;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case NPC_GENERIC_HIT_DEATH_END:
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
void CNpcEyeballEnemy::processShotDeathEnd( int _frames )
{
CNpcEnemy::processShotDeathEnd( _frames );
m_heading = m_drawRotation - 1024;
m_heading &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
CThing *Next=getNext();
if ( Next )
{
@ -321,25 +281,4 @@ void CNpcEyeballEnemy::processShot( int _frames )
projectile->setPosition( eyeballPos );
projectile->setHeading( m_heading );
}
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

@ -26,7 +26,8 @@ protected:
virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor();
virtual void processClose( int _frames );
virtual void processShot( int _frames );
virtual void processShotDeathStart( int _frames );
virtual void processShotDeathEnd( int _frames );
s32 m_fireHeading;

View File

@ -313,123 +313,23 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFlyingDutchmanEnemy::processShot( int _frames )
void CNpcFlyingDutchmanEnemy::processShotRecoil( int _frames )
{
switch( m_data[m_type].shotFunc )
{
case NPC_SHOT_NONE:
{
// do nothing
break;
}
case NPC_SHOT_GENERIC:
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
m_isDying = true;
}
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:
{
m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
if ( !m_animPlaying )
CNpcEnemy::processShotRecoil( _frames );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFlyingDutchmanEnemy::processShotDeathEnd( int _frames )
{
CNpcEnemy::processShotDeathEnd( _frames );
if ( isSetToShutdown() )
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
//m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
m_isDying = true;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
}
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
//if ( !m_animPlaying )
{
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();
CGameScene::setBossHasBeenKilled();
}
}
}
break;
}
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -28,7 +28,8 @@ public:
protected:
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
virtual void processShot( int _frames );
virtual void processShotRecoil( int _frames );
virtual void processShotDeathEnd( int _frames );
virtual void collidedWith(CThing *_thisThing);
enum NPC_FLYING_DUTCHMAN_STATE

View File

@ -1243,17 +1243,46 @@ void CNpcEnemy::processShot( int _frames )
case NPC_GENERIC_HIT_RECOIL:
{
if ( !m_animPlaying )
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
processShotRecoil( _frames );
break;
}
case NPC_GENERIC_HIT_DEATH_START:
{
processShotDeathStart( _frames );
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
processShotDeathEnd( _frames );
break;
}
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processShotRecoil( int _frames )
{
if ( !m_animPlaying )
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processShotDeathStart( int _frames )
{
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
@ -1276,12 +1305,12 @@ void CNpcEnemy::processShot( int _frames )
{
m_actorGfx->SetOtPos( 0 );
}
}
break;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case NPC_GENERIC_HIT_DEATH_END:
{
void CNpcEnemy::processShotDeathEnd( int _frames )
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
@ -1308,14 +1337,6 @@ void CNpcEnemy::processShot( int _frames )
setToShutdown();
}
}
break;
}
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -252,6 +252,9 @@ protected:
virtual void processMovement( int _frames );
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual void processShot( int _frames );
virtual void processShotRecoil( int _frames );
virtual void processShotDeathStart( int _frames );
virtual void processShotDeathEnd( int _frames );
virtual void processClose( int _frames );
virtual void processCollision();
virtual void processAttackCollision();

View File

@ -627,28 +627,7 @@ void CNpcSubSharkEnemy::processShot( int _frames )
case NPC_GENERIC_HIT_DEATH_START:
{
m_animPlaying = true;
m_animNo = m_data[m_type].dieAnim;
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
m_isDying = true;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
}
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
CNpcEnemy::processShotDeathStart( _frames );
break;
}
@ -657,34 +636,13 @@ void CNpcSubSharkEnemy::processShot( int _frames )
{
if ( !m_animPlaying )
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
CNpcEnemy::processShotDeathEnd( _frames );
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
if ( isSetToShutdown() )
{
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();
CGameScene::setBossHasBeenKilled();
}
}
}
break;
}

View File

@ -595,80 +595,9 @@ int CNpcParasiticWormSegment::checkCollisionAgainst( CThing *_thisThing, int _fr
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::processShot( int _frames )
void CNpcParasiticWormEnemy::processShotDeathEnd( int _frames )
{
switch( m_data[m_type].shotFunc )
{
case NPC_SHOT_NONE:
{
// do nothing
break;
}
case NPC_SHOT_GENERIC:
{
switch ( m_state )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
{
m_health -= 5;
if ( m_health < 0 )
{
m_state = NPC_GENERIC_HIT_DEATH_START;
}
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:
{
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
}
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
Pos.vy += m_speed * _frames;
CNpcEnemy::processShotDeathEnd( _frames );
// go through segments
@ -679,34 +608,5 @@ void CNpcParasiticWormEnemy::processShot( int _frames )
m_segmentArray[segCount].setPos( segPos );
m_segmentArray[segCount].updateCollisionArea();
}
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;
}
}
break;
}
}
}

View File

@ -59,7 +59,7 @@ protected:
virtual bool processSensor();
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
virtual void processShot( int _frames );
virtual void processShotDeathEnd( int _frames );
//void resetParasiticWormHeadToTail();
virtual void processEnemyCollision( CThing *thisThing );