This commit is contained in:
parent
2c084ae0fb
commit
f8df16c417
4 changed files with 141 additions and 123 deletions
|
@ -108,7 +108,7 @@ void CNpc::processCloseSmallJellyfishEvade( int _frames )
|
|||
|
||||
s32 moveVel = 0;
|
||||
|
||||
if ( playerXDistSqr + playerYDistSqr > 22500 )
|
||||
if ( playerXDistSqr + playerYDistSqr > 10000 )
|
||||
{
|
||||
this->m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
}
|
||||
|
@ -214,51 +214,9 @@ void CNpc::processCloseSmallJellyfishEvade( int _frames )
|
|||
moveY = ( _frames * 3 * rsin( m_heading ) ) >> 12;
|
||||
moveVel = ( _frames * 3 ) << 8;
|
||||
|
||||
// check for collision with ground
|
||||
|
||||
if ( m_layerCollision->Get( ( Pos.vx + moveX ) >> 4, ( Pos.vy + moveY ) >> 4 ) )
|
||||
if ( processGroundCollisionReverse( &moveX, &moveY ) )
|
||||
{
|
||||
bool xBlocked = false;
|
||||
bool yBlocked = false;
|
||||
|
||||
// destination point is below ground, check in individual directions
|
||||
|
||||
if ( m_layerCollision->Get( ( Pos.vx + moveX ) >> 4, Pos.vy >> 4 ) )
|
||||
{
|
||||
// X direction is blocked
|
||||
|
||||
xBlocked = true;
|
||||
}
|
||||
|
||||
if ( m_layerCollision->Get( Pos.vx >> 4, ( Pos.vy + moveY ) >> 4 ) )
|
||||
{
|
||||
yBlocked = true;
|
||||
}
|
||||
|
||||
if ( xBlocked && !yBlocked )
|
||||
{
|
||||
// invert X
|
||||
|
||||
moveX = -moveX;
|
||||
|
||||
m_heading = ratan2( moveY, moveX );
|
||||
}
|
||||
else if ( !xBlocked && yBlocked )
|
||||
{
|
||||
// invert Y
|
||||
|
||||
moveY = -moveY;
|
||||
|
||||
m_heading = ratan2( moveY, moveX );
|
||||
}
|
||||
else
|
||||
{
|
||||
moveX = -moveX;
|
||||
moveY = -moveY;
|
||||
|
||||
m_heading += 2048;
|
||||
m_heading &= 4096;
|
||||
}
|
||||
m_evadeClockwise = !m_evadeClockwise;
|
||||
}
|
||||
|
||||
processMovementModifier(_frames, moveX, moveY, moveVel, moveDist);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue