From 6745c970e94ffdc1922d2150e989d4114119e914 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jun 2001 22:05:32 +0000 Subject: [PATCH] --- source/enemy/nmjfish.cpp | 32 ++++++++++++++++++++++---------- source/enemy/nmjfish.h | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index 8220baac9..cb33bf3f7 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -81,6 +81,7 @@ void CNpcMotherJellyfishEnemy::postInit() m_movementTimer = GameState::getOneSecondInFrames() * 5; m_pulsateTimer = GameState::getOneSecondInFrames(); + m_pauseTimer = m_maxPauseTimer = GameState::getOneSecondInFrames(); m_renderScale = 4096; } @@ -145,24 +146,33 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames ) { if ( m_pulsateTimer <= 0 ) { - // fire at player + if ( m_pauseTimer <= 0 ) + { + // fire at player - s16 heading = ratan2( playerYDist, playerXDist ) & 4095; + s16 heading = ratan2( playerYDist, playerXDist ) & 4095; - CProjectile *projectile; - projectile = CProjectile::Create(); - DVECTOR newPos = Pos; - projectile->init( newPos, heading ); - projectile->setGraphic( FRM__LIGHTNING2 ); + CProjectile *projectile; + projectile = CProjectile::Create(); + DVECTOR newPos = Pos; + projectile->init( newPos, heading ); + projectile->setGraphic( FRM__LIGHTNING2 ); - m_movementTimer = GameState::getOneSecondInFrames() * 5; - m_pulsateTimer = GameState::getOneSecondInFrames(); + m_movementTimer = GameState::getOneSecondInFrames() * 5; + m_pulsateTimer = GameState::getOneSecondInFrames(); + m_pauseTimer = m_maxPauseTimer; + } + else + { + m_pauseTimer -= _frames; + } } else { m_pulsateTimer -= _frames; - m_renderScale = 4096 + ( ( 256 * rsin( ( ( m_pulsateTimer << 14 ) / GameState::getOneSecondInFrames() ) & 4095 ) ) >> 12 ); + m_renderScale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth ); + m_renderScale += ( ( 256 * rsin( ( ( m_pulsateTimer << 14 ) / GameState::getOneSecondInFrames() ) & 4095 ) ) >> 12 ); } } else @@ -579,6 +589,8 @@ void CNpcMotherJellyfishEnemy::processShot( int _frames ) m_health -= 5; m_renderScale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth ); + m_speed = m_data[m_type].speed + ( ( 3 * ( m_data[m_type].initHealth - m_health ) ) / m_data[m_type].initHealth ); + m_maxPauseTimer = ( GameState::getOneSecondInFrames() * m_health ) / m_data[m_type].initHealth; } m_state = NPC_GENERIC_HIT_RECOIL; diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 6239ad8b7..4877d3a04 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -50,6 +50,8 @@ protected: int m_jellyfishCount; s32 m_spawnTimer; s32 m_pulsateTimer; + s32 m_pauseTimer; + s32 m_maxPauseTimer; s32 m_cycleWidth; s32 m_halfCycleWidth; bool m_meterOn;