This commit is contained in:
parent
3a05eb9884
commit
035d72263d
Binary file not shown.
Binary file not shown.
@ -62,9 +62,9 @@ void CNpcAnemoneEnemy::postInit()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcAnemoneEnemy::setHeading( s32 xPos, s32 yPos )
|
void CNpcAnemoneEnemy::setHeading( s32 xPos, s32 yPos, s32 xOrig, s32 yOrig )
|
||||||
{
|
{
|
||||||
m_heading = ( ratan2( ( ( yPos << 4 ) + 16 ) - Pos.vy, ( ( xPos << 4 ) + 8 ) - Pos.vx ) ) & 4095;
|
m_heading = ( ratan2( yPos - yOrig, xPos - xOrig ) ) & 4095;
|
||||||
|
|
||||||
int newHeading = ( m_heading - 1024 ) & 4095;
|
int newHeading = ( m_heading - 1024 ) & 4095;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ void CNpcAnemone1Enemy::processClose( int _frames )
|
|||||||
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
||||||
bool withinRange = false;
|
bool withinRange = false;
|
||||||
|
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
||||||
|
|
||||||
decDir = m_fireHeading - headingToPlayer;
|
decDir = m_fireHeading - headingToPlayer;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class CNpcAnemoneEnemy : public CNpcEnemy
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
void setHeading( s32 xPos, s32 yPos );
|
void setHeading( s32 xPos, s32 yPos, s32 xOrig, s32 yOrig );
|
||||||
protected:
|
protected:
|
||||||
void processEnemyCollision( CThing *thisThing );
|
void processEnemyCollision( CThing *thisThing );
|
||||||
bool processSensor();
|
bool processSensor();
|
||||||
|
@ -130,7 +130,7 @@ void CNpcJumpingClamEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
endXPos = newXPos;
|
endXPos = newXPos;
|
||||||
endYPos = newYPos;
|
endYPos = newYPos;
|
||||||
|
|
||||||
setHeading( newXPos, newYPos );
|
setHeading( newXPos, newYPos, startXPos, startYPos );
|
||||||
|
|
||||||
s32 xDist = ( endXPos - startXPos ) << 4;
|
s32 xDist = ( endXPos - startXPos ) << 4;
|
||||||
s32 yDist = ( endYPos - startYPos ) << 4;
|
s32 yDist = ( endYPos - startYPos ) << 4;
|
||||||
|
@ -196,7 +196,7 @@ void CNpcDustDevilEnemy::processMovementModifier( int _frames, s32 distX, s32 di
|
|||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
m_drawRotation = heading;
|
m_drawRotation = heading;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ void CNpcEnemy::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32
|
|||||||
{
|
{
|
||||||
s16 decDir, incDir, moveDist;
|
s16 decDir, incDir, moveDist;
|
||||||
s32 moveX, moveY;
|
s32 moveX, moveY;
|
||||||
s16 headingToTarget = ratan2( yDist, xDist );
|
s16 headingToTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
||||||
|
|
||||||
decDir = m_heading - headingToTarget;
|
decDir = m_heading - headingToTarget;
|
||||||
@ -166,7 +166,7 @@ bool CNpcEnemy::processGroundCollisionReverse( s32 *moveX, s32 *moveY )
|
|||||||
|
|
||||||
*moveX = -(*moveX);
|
*moveX = -(*moveX);
|
||||||
|
|
||||||
m_heading = ratan2( *moveY, *moveX );
|
m_heading = ratan2( *moveY, *moveX ) & 4095;
|
||||||
}
|
}
|
||||||
else if ( !xBlocked && yBlocked )
|
else if ( !xBlocked && yBlocked )
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ bool CNpcEnemy::processGroundCollisionReverse( s32 *moveX, s32 *moveY )
|
|||||||
|
|
||||||
*moveY = -(*moveY);
|
*moveY = -(*moveY);
|
||||||
|
|
||||||
m_heading = ratan2( *moveY, *moveX );
|
m_heading = ratan2( *moveY, *moveX ) & 4095;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -234,7 +234,7 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
|||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
m_drawRotation = heading;
|
m_drawRotation = heading;
|
||||||
|
|
||||||
|
@ -104,15 +104,16 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
||||||
|
|
||||||
u16 newXPos, newYPos;
|
u16 newXPos, newYPos;
|
||||||
|
u16 origXPos, origYPos;
|
||||||
|
|
||||||
s32 startX = 0;
|
s32 startX = 0;
|
||||||
|
|
||||||
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
||||||
|
|
||||||
newXPos = (u16) *PntList;
|
origXPos = newXPos = (u16) *PntList;
|
||||||
setWaypointPtr( PntList );
|
setWaypointPtr( PntList );
|
||||||
PntList++;
|
PntList++;
|
||||||
newYPos = (u16) *PntList;
|
origYPos = newYPos = (u16) *PntList;
|
||||||
PntList++;
|
PntList++;
|
||||||
|
|
||||||
setStartPos( newXPos, newYPos );
|
setStartPos( newXPos, newYPos );
|
||||||
@ -130,7 +131,7 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
|
|
||||||
if ( pointNum == 1 )
|
if ( pointNum == 1 )
|
||||||
{
|
{
|
||||||
setHeading( newXPos, newYPos );
|
setHeading( newXPos, newYPos, origXPos, origYPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pointNum == ThisActor->PointCount - 2 )
|
if ( pointNum == ThisActor->PointCount - 2 )
|
||||||
|
@ -47,7 +47,7 @@ void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
|||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
m_drawRotation = heading;
|
m_drawRotation = heading;
|
||||||
}
|
}
|
||||||
|
@ -487,13 +487,14 @@ void CNpcEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
||||||
|
|
||||||
u16 newXPos, newYPos;
|
u16 newXPos, newYPos;
|
||||||
|
u16 origXPos, origYPos;
|
||||||
|
|
||||||
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
||||||
|
|
||||||
newXPos = (u16) *PntList;
|
origXPos = newXPos = (u16) *PntList;
|
||||||
setWaypointPtr( PntList );
|
setWaypointPtr( PntList );
|
||||||
PntList++;
|
PntList++;
|
||||||
newYPos = (u16) *PntList;
|
origYPos = newYPos = (u16) *PntList;
|
||||||
PntList++;
|
PntList++;
|
||||||
|
|
||||||
setStartPos( newXPos, newYPos );
|
setStartPos( newXPos, newYPos );
|
||||||
@ -505,7 +506,7 @@ void CNpcEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
newYPos = (u16) *PntList;
|
newYPos = (u16) *PntList;
|
||||||
PntList++;
|
PntList++;
|
||||||
|
|
||||||
setHeading( newXPos, newYPos );
|
setHeading( newXPos, newYPos, origXPos, origYPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
setThinkArea();
|
setThinkArea();
|
||||||
@ -548,9 +549,9 @@ void CNpcEnemy::setStartPosHighRes( s32 xPos, s32 yPos )
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcEnemy::setHeading( s32 xPos, s32 yPos )
|
void CNpcEnemy::setHeading( s32 xPos, s32 yPos, s32 xOrig, s32 yOrig )
|
||||||
{
|
{
|
||||||
m_heading = ( ratan2( ( ( yPos << 4 ) + 16 ) - Pos.vy, ( ( xPos << 4 ) + 8 ) - Pos.vx ) ) & 4095;
|
m_heading = ( ratan2( yPos - yOrig, xPos - xOrig ) ) & 4095;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1016,11 +1017,11 @@ bool CNpcEnemy::processSensor()
|
|||||||
|
|
||||||
if ( abs( playerXDist ) < abs( xDistWaypoint ) )
|
if ( abs( playerXDist ) < abs( xDistWaypoint ) )
|
||||||
{
|
{
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
||||||
|
|
||||||
s16 decDir, incDir, moveDist;
|
s16 decDir, incDir, moveDist;
|
||||||
|
|
||||||
s32 headingToWaypoint = ratan2( yDistWaypoint, xDistWaypoint );
|
s32 headingToWaypoint = ratan2( yDistWaypoint, xDistWaypoint ) & 4095;
|
||||||
|
|
||||||
// check waypoint is in the same direction as the user
|
// check waypoint is in the same direction as the user
|
||||||
|
|
||||||
@ -1511,7 +1512,7 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
|||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
s32 yDist = Pos.vy - otherPos.vy;
|
s32 yDist = Pos.vy - otherPos.vy;
|
||||||
|
|
||||||
s16 headingFromTarget = ratan2( yDist, xDist );
|
s16 headingFromTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
||||||
{
|
{
|
||||||
@ -1576,7 +1577,7 @@ void CNpcEnemy::processUserCollision( CThing *thisThing )
|
|||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
s32 yDist = Pos.vy - otherPos.vy;
|
s32 yDist = Pos.vy - otherPos.vy;
|
||||||
|
|
||||||
s16 headingFromTarget = ratan2( yDist, xDist );
|
s16 headingFromTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
/*if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
/*if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
||||||
{
|
{
|
||||||
@ -1623,7 +1624,7 @@ bool CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist, u
|
|||||||
s32 moveX, moveY;
|
s32 moveX, moveY;
|
||||||
s16 headingToTarget;
|
s16 headingToTarget;
|
||||||
|
|
||||||
headingToTarget = ratan2( yDist, xDist );
|
headingToTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
s32 preShiftX = _frames * 5 * rcos( headingToTarget );
|
s32 preShiftX = _frames * 5 * rcos( headingToTarget );
|
||||||
s32 preShiftY = _frames * 5 * rsin( headingToTarget );
|
s32 preShiftY = _frames * 5 * rsin( headingToTarget );
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
NPC_UNIT_TYPE getType() {return( m_type );}
|
NPC_UNIT_TYPE getType() {return( m_type );}
|
||||||
static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||||
void setHeading( s32 newHeading ) {m_heading = newHeading;}
|
void setHeading( s32 newHeading ) {m_heading = newHeading;}
|
||||||
virtual void setHeading( s32 xPos, s32 yPos );
|
virtual void setHeading( s32 xPos, s32 yPos, s32 xOrig, s32 yOrig );
|
||||||
void setWaypointPtr( u16 *newPtr ) {m_npcPath.setWaypointPtr( newPtr );}
|
void setWaypointPtr( u16 *newPtr ) {m_npcPath.setWaypointPtr( newPtr );}
|
||||||
void setWaypointCount( u8 newCount ) {m_npcPath.setWaypointCount( newCount );}
|
void setWaypointCount( u8 newCount ) {m_npcPath.setWaypointCount( newCount );}
|
||||||
void setPathType( u8 newType ) {m_npcPath.setPathType( newType );}
|
void setPathType( u8 newType ) {m_npcPath.setPathType( newType );}
|
||||||
|
@ -298,7 +298,7 @@ s32 CNpcPath::think( DVECTOR const ¤tPos, bool *pathComplete, bool *waypoi
|
|||||||
*distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy;
|
*distY = ( ( *waypoint << 4 ) + 16 ) - currentPos.vy;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 headingToTarget = ratan2( *distY, *distX );
|
s32 headingToTarget = ratan2( *distY, *distX ) & 4095;
|
||||||
|
|
||||||
return( headingToTarget );
|
return( headingToTarget );
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
|||||||
s32 xDist = testPos2.vx - testPos1.vx;
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
m_drawRotation = heading;
|
m_drawRotation = heading;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,8 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
|
|||||||
{
|
{
|
||||||
m_targetHeading += -1024 + ( getRnd() % 2049 );
|
m_targetHeading += -1024 + ( getRnd() % 2049 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_targetHeading &= 4095;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +183,7 @@ void CNpcSmallJellyfishBackgroundEnemy::processUserCollision( CThing *thisThing
|
|||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
s32 yDist = Pos.vy - otherPos.vy;
|
s32 yDist = Pos.vy - otherPos.vy;
|
||||||
|
|
||||||
s16 headingFromTarget = ratan2( yDist, xDist );
|
s16 headingFromTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
if ( ( xDist > 0 && otherDelta.vx < 0 ) || ( xDist < 0 && otherDelta.vx > 0 ) )
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ void CNpcSmallJellyfishEnemy::processClose( int _frames )
|
|||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
||||||
|
|
||||||
if ( m_evadeClockwise )
|
if ( m_evadeClockwise )
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ void CNpcSkeletalFishEnemy::processClose( int _frames )
|
|||||||
m_chargeTime += _frames;
|
m_chargeTime += _frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
||||||
|
|
||||||
if ( !m_animPlaying )
|
if ( !m_animPlaying )
|
||||||
{
|
{
|
||||||
|
@ -876,13 +876,14 @@ void CNpcSubSharkEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
||||||
|
|
||||||
u16 newXPos, newYPos;
|
u16 newXPos, newYPos;
|
||||||
|
u16 startXPos, startYPos;
|
||||||
|
|
||||||
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
m_npcPath.setWaypointCount( ThisActor->PointCount - 1 );
|
||||||
|
|
||||||
newXPos = (u16) *PntList;
|
startXPos = newXPos = (u16) *PntList;
|
||||||
setWaypointPtr( PntList );
|
setWaypointPtr( PntList );
|
||||||
PntList++;
|
PntList++;
|
||||||
newYPos = (u16) *PntList;
|
startYPos = newYPos = (u16) *PntList;
|
||||||
PntList++;
|
PntList++;
|
||||||
|
|
||||||
setStartPos( newXPos, newYPos );
|
setStartPos( newXPos, newYPos );
|
||||||
@ -894,7 +895,7 @@ void CNpcSubSharkEnemy::setupWaypoints( sThingActor *ThisActor )
|
|||||||
newYPos = (u16) *PntList;
|
newYPos = (u16) *PntList;
|
||||||
PntList++;
|
PntList++;
|
||||||
|
|
||||||
setHeading( newXPos, newYPos );
|
setHeading( newXPos, newYPos, startXPos, startYPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 minX, maxX, minY, maxY;
|
s32 minX, maxX, minY, maxY;
|
||||||
|
@ -626,7 +626,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
|
|||||||
s32 xDist = oldPos.vx - newPos->pos.vx;
|
s32 xDist = oldPos.vx - newPos->pos.vx;
|
||||||
s32 yDist = oldPos.vy - newPos->pos.vy;
|
s32 yDist = oldPos.vy - newPos->pos.vy;
|
||||||
|
|
||||||
s16 headingToTarget = ratan2( yDist, xDist );
|
s16 headingToTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
DVECTOR sinPos;
|
DVECTOR sinPos;
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
|
|||||||
s32 xDist = oldPos.vx - currentPos.vx;
|
s32 xDist = oldPos.vx - currentPos.vx;
|
||||||
s32 yDist = oldPos.vy - currentPos.vy;
|
s32 yDist = oldPos.vy - currentPos.vy;
|
||||||
|
|
||||||
s16 headingToPrev = ratan2( yDist, xDist );
|
s16 headingToPrev = ratan2( yDist, xDist ) & 4095;
|
||||||
s16 headingFromNext;
|
s16 headingFromNext;
|
||||||
s16 heading = headingToPrev;
|
s16 heading = headingToPrev;
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
|
|||||||
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
||||||
xDist = currentPos.vx - nextPos.vx;
|
xDist = currentPos.vx - nextPos.vx;
|
||||||
yDist = currentPos.vy - nextPos.vy;
|
yDist = currentPos.vy - nextPos.vy;
|
||||||
headingFromNext = ratan2( yDist, xDist );
|
headingFromNext = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
s16 decDir, incDir, moveDist;
|
s16 decDir, incDir, moveDist;
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
|
|||||||
s32 xDist = oldPos.vx - newPos->pos.vx;
|
s32 xDist = oldPos.vx - newPos->pos.vx;
|
||||||
s32 yDist = oldPos.vy - newPos->pos.vy;
|
s32 yDist = oldPos.vy - newPos->pos.vy;
|
||||||
|
|
||||||
s16 headingToTarget = ratan2( yDist, xDist );
|
s16 headingToTarget = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
DVECTOR sinPos;
|
DVECTOR sinPos;
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
|
|||||||
s32 xDist = oldPos.vx - currentPos.vx;
|
s32 xDist = oldPos.vx - currentPos.vx;
|
||||||
s32 yDist = oldPos.vy - currentPos.vy;
|
s32 yDist = oldPos.vy - currentPos.vy;
|
||||||
|
|
||||||
s16 headingToPrev = ratan2( yDist, xDist );
|
s16 headingToPrev = ratan2( yDist, xDist ) & 4095;
|
||||||
s16 headingFromNext;
|
s16 headingFromNext;
|
||||||
s16 heading = headingToPrev;
|
s16 heading = headingToPrev;
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
|
|||||||
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
||||||
xDist = currentPos.vx - nextPos.vx;
|
xDist = currentPos.vx - nextPos.vx;
|
||||||
yDist = currentPos.vy - nextPos.vy;
|
yDist = currentPos.vy - nextPos.vy;
|
||||||
headingFromNext = ratan2( yDist, xDist );
|
headingFromNext = ratan2( yDist, xDist ) & 4095;
|
||||||
|
|
||||||
s16 decDir, incDir, moveDist;
|
s16 decDir, incDir, moveDist;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user