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,123 +285,30 @@ void CNpcAnemone2Enemy::shutdown()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processShot( int _frames )
void CNpcAnemone2Enemy::processShotDeathStart( int _frames )
{
switch( m_data[m_type].shotFunc )
CNpcEnemy::processShotDeathStart( _frames );
deleteAllChild();
if (m_data[m_type].skelType)
{
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();
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
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;
}
m_actorGfx->SetOtPos( 0 );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processShotDeathEnd( int _frames )
{
m_heading += 64 * _frames;
m_heading &= 4095;
CNpcEnemy::processShotDeathEnd( _frames );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processClose( int _frames )
{
int fireLoop;

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,119 +446,15 @@ void CNpcIronDogfishEnemy::processTimer(int _frames)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processShot( int _frames )
void CNpcIronDogfishEnemy::processShotDeathEnd( int _frames )
{
switch( m_data[m_type].shotFunc )
if ( !m_animPlaying )
{
case NPC_SHOT_NONE:
CNpcEnemy::processShotDeathEnd( _frames );
if ( isSetToShutdown() )
{
// 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;
}
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;
CGameScene::setBossHasBeenKilled();
}
}
}

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,110 +236,49 @@ void CNpcEyeballEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEyeballEnemy::processShot( int _frames )
void CNpcEyeballEnemy::processShotDeathStart( int _frames )
{
switch ( m_state )
CNpcEnemy::processShotDeathStart( _frames );
CThing *Next=getNext();
if ( Next )
{
case NPC_GENERIC_HIT_CHECK_HEALTH:
CProjectile *projectile;
projectile = (CProjectile *) Next;
if ( projectile->getMovementType() != CProjectile::PROJECTILE_FIXED )
{
m_health -= 5;
projectile->setMovementType( CProjectile::PROJECTILE_DUMBFIRE );
projectile->setLifeTime( CProjectile::PROJECTILE_FINITE_LIFE );
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();
if ( Next )
{
CProjectile *projectile;
projectile = (CProjectile *) Next;
if ( projectile->getMovementType() != CProjectile::PROJECTILE_FIXED )
{
projectile->setMovementType( CProjectile::PROJECTILE_DUMBFIRE );
projectile->setLifeTime( CProjectile::PROJECTILE_FINITE_LIFE );
removeChild( Next );
}
}
break;
}
case NPC_GENERIC_HIT_DEATH_END:
{
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
m_heading = m_drawRotation - 1024;
m_heading &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
CThing *Next=getNext();
if ( Next )
{
CProjectile *projectile;
projectile = (CProjectile *) Next;
DVECTOR eyeballPos = Pos;
eyeballPos.vx += ( EYEBALL_DIST * rcos( m_heading ) ) >> 12;
eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12;
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;
removeChild( Next );
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEyeballEnemy::processShotDeathEnd( int _frames )
{
CNpcEnemy::processShotDeathEnd( _frames );
m_heading = m_drawRotation - 1024;
m_heading &= 4095;
CThing *Next=getNext();
if ( Next )
{
CProjectile *projectile;
projectile = (CProjectile *) Next;
DVECTOR eyeballPos = Pos;
eyeballPos.vx += ( EYEBALL_DIST * rcos( m_heading ) ) >> 12;
eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12;
projectile->setPosition( eyeballPos );
projectile->setHeading( m_heading );
}
}

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,122 +313,22 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFlyingDutchmanEnemy::processShot( int _frames )
void CNpcFlyingDutchmanEnemy::processShotRecoil( int _frames )
{
switch( m_data[m_type].shotFunc )
m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
CNpcEnemy::processShotRecoil( _frames );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFlyingDutchmanEnemy::processShotDeathEnd( int _frames )
{
CNpcEnemy::processShotDeathEnd( _frames );
if ( isSetToShutdown() )
{
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 )
{
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;
}
CGameScene::setBossHasBeenKilled();
}
}

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,71 +1243,21 @@ 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:
{
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 );
}
processShotDeathStart( _frames );
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();
}
}
processShotDeathEnd( _frames );
break;
}
@ -1320,6 +1270,77 @@ void CNpcEnemy::processShot( int _frames )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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;
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 );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processShotDeathEnd( int _frames )
{
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();
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processClose(int _frames)
{
switch( m_data[this->m_type].closeFunc )

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,32 +636,11 @@ 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();
}
CGameScene::setBossHasBeenKilled();
}
}

View File

@ -595,118 +595,18 @@ 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 );
// go through segments
for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
{
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
for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
{
DVECTOR segPos = m_segmentArray[segCount].getPos();
segPos.vy += m_speed * _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;
}
DVECTOR segPos = m_segmentArray[segCount].getPos();
segPos.vy += m_speed * _frames;
m_segmentArray[segCount].setPos( segPos );
m_segmentArray[segCount].updateCollisionArea();
}
}

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 );