This commit is contained in:
Charles 2001-08-01 18:35:17 +00:00
parent f30eea0de7
commit 63e9ad2f1c

View file

@ -98,7 +98,7 @@ bool CNpcAnemoneEnemy::processSensor()
default: default:
{ {
if ( playerXDistSqr + playerYDistSqr < 40000 ) if ( playerXDistSqr + playerYDistSqr < 50000 )
{ {
m_controlFunc = NPC_CONTROL_CLOSE; m_controlFunc = NPC_CONTROL_CLOSE;
@ -123,33 +123,6 @@ void CNpcAnemone1Enemy::processClose( int _frames )
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095; s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
decDir = m_fireHeading - headingToPlayer;
if ( decDir < 0 )
{
decDir += ONE;
}
incDir = headingToPlayer - m_fireHeading;
if ( incDir < 0 )
{
incDir += ONE;
}
if ( decDir < incDir )
{
moveDist = decDir;
}
else
{
moveDist = incDir;
}
// check user is within 45 degrees either way
if ( moveDist < 512 )
{
decDir = m_heading - headingToPlayer; decDir = m_heading - headingToPlayer;
if ( decDir < 0 ) if ( decDir < 0 )
@ -192,14 +165,52 @@ void CNpcAnemone1Enemy::processClose( int _frames )
m_heading &= 4095; m_heading &= 4095;
m_drawRotation = ( m_heading + 1024 ) & 4095; decDir = m_fireHeading - m_heading;
if ( decDir < 0 )
{
decDir += ONE;
}
incDir = m_heading - m_fireHeading;
if ( incDir < 0 )
{
incDir += ONE;
}
if ( decDir < incDir )
{
moveDist = -decDir;
}
else
{
moveDist = incDir;
}
// check user is within 45 degrees either way
if ( moveDist > 512 )
{
m_heading = m_fireHeading + 512;
m_heading &= 4095;
}
else if ( moveDist < -512 )
{
m_heading = m_fireHeading - 512;
m_heading &= 4095;
}
else
{
if ( m_soundId == NOT_PLAYING ) if ( m_soundId == NOT_PLAYING )
{ {
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_MOVE, true ); m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_MOVE, true );
} }
} }
m_drawRotation = ( m_heading + 1024 ) & 4095;
}
if ( withinRange ) if ( withinRange )
{ {
// can fire, start firing anim // can fire, start firing anim
@ -214,16 +225,6 @@ void CNpcAnemone1Enemy::processClose( int _frames )
} }
} }
} }
}
else
{
if ( !m_animPlaying || m_animNo != ANIM_ANENOME_FIRE )
{
m_animPlaying = true;
m_animNo = ANIM_ANENOME_FIRE;
m_frame = 0;
}
}
if ( withinRange ) if ( withinRange )
{ {