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 ) CNpcEnemy::processShotDeathStart( _frames );
{
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 );
}
deleteAllChild(); deleteAllChild();
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType) if (m_data[m_type].skelType)
{ {
m_actorGfx->SetOtPos( 0 ); m_actorGfx->SetOtPos( 0 );
} }
break;
} }
case NPC_GENERIC_HIT_DEATH_END: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processShotDeathEnd( int _frames )
{ {
m_heading += 64 * _frames; m_heading += 64 * _frames;
m_heading &= 4095; m_heading &= 4095;
m_drawRotation = ( m_heading + 1024 ) & 4095; CNpcEnemy::processShotDeathEnd( _frames );
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;
}
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -42,10 +42,11 @@ public:
virtual void postInit(); virtual void postInit();
virtual void shutdown(); virtual void shutdown();
virtual void render(); virtual void render();
virtual void processShot( int _frames );
protected: protected:
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); 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; u16 m_scaleX, m_scaleY;

View File

@ -428,6 +428,7 @@ void CNpcIronDogfishEnemy::hasBeenSteamed( DVECTOR &steamPos )
//hasBeenAttacked(); //hasBeenAttacked();
m_steamTimer = 4 * GameState::getOneSecondInFrames(); m_steamTimer = 4 * GameState::getOneSecondInFrames();
m_effect->killFX();
} }
} }
@ -445,123 +446,19 @@ 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 ) if ( !m_animPlaying )
{ {
m_state = 0; CNpcEnemy::processShotDeathEnd( _frames );
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break; if ( isSetToShutdown() )
}
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(); CGameScene::setBossHasBeenKilled();
} }
} }
} }
break;
}
}
break;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing ) void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing )

View File

@ -35,7 +35,7 @@ protected:
virtual void processCollision(); virtual void processCollision();
virtual void processAttackCollision(); virtual void processAttackCollision();
virtual void hasBeenSteamed( DVECTOR &steamPos ); virtual void hasBeenSteamed( DVECTOR &steamPos );
virtual void processShot( int _frames ); virtual void processShotDeathEnd( int _frames );
virtual void collidedWith(CThing *_thisThing); virtual void collidedWith(CThing *_thisThing);
enum NPC_IRON_DOGFISH_STATE 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 ) CNpcEnemy::processShotDeathStart( _frames );
{
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 );
}
CThing *Next=getNext(); CThing *Next=getNext();
if ( Next ) if ( Next )
@ -287,25 +255,17 @@ void CNpcEyeballEnemy::processShot( int _frames )
removeChild( Next ); removeChild( Next );
} }
} }
break;
} }
case NPC_GENERIC_HIT_DEATH_END: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEyeballEnemy::processShotDeathEnd( int _frames )
{ {
m_drawRotation += 64 * _frames; CNpcEnemy::processShotDeathEnd( _frames );
m_drawRotation &= 4095;
m_heading = m_drawRotation - 1024; m_heading = m_drawRotation - 1024;
m_heading &= 4095; m_heading &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
CThing *Next=getNext(); CThing *Next=getNext();
if ( Next ) if ( Next )
{ {
@ -321,25 +281,4 @@ void CNpcEyeballEnemy::processShot( int _frames )
projectile->setPosition( eyeballPos ); projectile->setPosition( eyeballPos );
projectile->setHeading( m_heading ); 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 void processEnemyCollision( CThing *thisThing );
virtual bool processSensor(); virtual bool processSensor();
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processShot( int _frames ); virtual void processShotDeathStart( int _frames );
virtual void processShotDeathEnd( int _frames );
s32 m_fireHeading; s32 m_fireHeading;

View File

@ -313,124 +313,24 @@ 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(); m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
if ( !m_animPlaying ) CNpcEnemy::processShotRecoil( _frames );
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
} }
break; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
case NPC_GENERIC_HIT_DEATH_START: void CNpcFlyingDutchmanEnemy::processShotDeathEnd( int _frames )
{ {
//m_animPlaying = true; CNpcEnemy::processShotDeathEnd( _frames );
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 ( isSetToShutdown() )
{ {
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(); CGameScene::setBossHasBeenKilled();
} }
} }
}
break;
}
}
break;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -28,7 +28,8 @@ public:
protected: protected:
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovement( 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); virtual void collidedWith(CThing *_thisThing);
enum NPC_FLYING_DUTCHMAN_STATE enum NPC_FLYING_DUTCHMAN_STATE

View File

@ -1243,16 +1243,45 @@ void CNpcEnemy::processShot( int _frames )
case NPC_GENERIC_HIT_RECOIL: case NPC_GENERIC_HIT_RECOIL:
{ {
if ( !m_animPlaying ) processShotRecoil( _frames );
{
m_state = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
}
break; break;
} }
case NPC_GENERIC_HIT_DEATH_START: 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_animPlaying = true;
m_animNo = m_data[m_type].dieAnim; m_animNo = m_data[m_type].dieAnim;
@ -1276,11 +1305,11 @@ void CNpcEnemy::processShot( int _frames )
{ {
m_actorGfx->SetOtPos( 0 ); m_actorGfx->SetOtPos( 0 );
} }
break;
} }
case NPC_GENERIC_HIT_DEATH_END: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processShotDeathEnd( int _frames )
{ {
m_drawRotation += 64 * _frames; m_drawRotation += 64 * _frames;
m_drawRotation &= 4095; m_drawRotation &= 4095;
@ -1308,14 +1337,6 @@ void CNpcEnemy::processShot( int _frames )
setToShutdown(); setToShutdown();
} }
} }
break;
}
}
break;
}
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -252,6 +252,9 @@ protected:
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual void processShot( int _frames ); 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 processClose( int _frames );
virtual void processCollision(); virtual void processCollision();
virtual void processAttackCollision(); virtual void processAttackCollision();

View File

@ -627,28 +627,7 @@ void CNpcSubSharkEnemy::processShot( int _frames )
case NPC_GENERIC_HIT_DEATH_START: case NPC_GENERIC_HIT_DEATH_START:
{ {
m_animPlaying = true; CNpcEnemy::processShotDeathStart( _frames );
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; break;
} }
@ -657,34 +636,13 @@ void CNpcSubSharkEnemy::processShot( int _frames )
{ {
if ( !m_animPlaying ) if ( !m_animPlaying )
{ {
m_drawRotation += 64 * _frames; CNpcEnemy::processShotDeathEnd( _frames );
m_drawRotation &= 4095;
Pos.vy += m_speed * _frames; if ( isSetToShutdown() )
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(); CGameScene::setBossHasBeenKilled();
} }
} }
}
break; 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 ) CNpcEnemy::processShotDeathEnd( _frames );
{
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;
// go through segments // go through segments
@ -679,34 +608,5 @@ void CNpcParasiticWormEnemy::processShot( int _frames )
m_segmentArray[segCount].setPos( segPos ); m_segmentArray[segCount].setPos( segPos );
m_segmentArray[segCount].updateCollisionArea(); 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 bool processSensor();
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
virtual void processShot( int _frames ); virtual void processShotDeathEnd( int _frames );
//void resetParasiticWormHeadToTail(); //void resetParasiticWormHeadToTail();
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );