This commit is contained in:
Charles 2001-02-22 16:56:27 +00:00
parent c8a3f3c9fc
commit 404975b407
8 changed files with 83 additions and 37 deletions

View file

@ -27,34 +27,35 @@
void CNpc::processCloseSpiderCrabAttack( int _frames )
{
s32 velocity;
DVECTOR newPos = Pos;
velocity = m_velocity * _frames;
if ( m_extendDir == EXTEND_RIGHT )
{
Pos.vx += velocity;
newPos.vx += velocity;
m_heading = 0;
}
else
{
Pos.vx -= velocity;
newPos.vx -= velocity;
m_heading = 2048;
}
s32 horizontalExtension = abs( Pos.vx - m_base.vx );
s32 horizontalExtension = abs( newPos.vx - m_base.vx );
if ( horizontalExtension > 128 )
{
if ( m_extendDir == EXTEND_RIGHT )
{
Pos.vx = m_base.vx + 128;
newPos.vx = m_base.vx + 128;
}
else
{
Pos.vx = m_base.vx - 128;
newPos.vx = m_base.vx - 128;
}
Pos.vy = m_base.vy;
newPos.vy = m_base.vy;
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
@ -63,6 +64,22 @@ void CNpc::processCloseSpiderCrabAttack( int _frames )
}
else
{
Pos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 );
newPos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 );
}
// check for collision with ground
if ( m_layerCollision->getHeightFromGround( newPos.vx, newPos.vy ) < 0 )
{
// abort jump
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
}
else
{
Pos = newPos;
}
}