Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,20 @@ void MissileAIUpdate::doAttackState(Bool turnOK)
if(curLoco && curLoco->getPreferredHeight() > 0)
{
// Am I close enough to the target to ignore my preferred height setting?
Real distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalPosition(), FROM_CENTER_2D );
#if RETAIL_COMPATIBLE_CRC
Real distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalPosition(), FROM_CENTER_2D);
#else
// TheSuperHackers @bugfix Stubbjax 23/08/2026 Diving missiles now use their target's position to determine distance
// when applicable rather than the goal position. This allows them to properly determine when to dive on moving targets.
Real distanceToTargetSquared;
if (m_isTrackingTarget && (getGoalObject() != nullptr)) {
distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalObject(), FROM_CENTER_2D);
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
}
else {
distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalPosition(), FROM_CENTER_2D);
}
#endif

Real diveDistanceSquared = d->m_diveDistance;
if (curLoco && curLoco->getPreferredHeight()) {
diveDistanceSquared *= diveDistanceSquared;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,20 @@ void MissileAIUpdate::doAttackState(Bool turnOK)
if(curLoco && curLoco->getPreferredHeight() > 0)
{
// Am I close enough to the target to ignore my preferred height setting?
Real distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalPosition(), FROM_CENTER_2D );
#if RETAIL_COMPATIBLE_CRC
Real distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalPosition(), FROM_CENTER_2D);
#else
// TheSuperHackers @bugfix Stubbjax 23/08/2026 Diving missiles now use their target's position to determine distance
// when applicable rather than the goal position. This allows them to properly determine when to dive on moving targets.
Real distanceToTargetSquared;
if (m_isTrackingTarget && (getGoalObject() != nullptr)) {
distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalObject(), FROM_CENTER_2D);
}
else {
distanceToTargetSquared = ThePartitionManager->getDistanceSquared(getObject(), getGoalPosition(), FROM_CENTER_2D);
}
#endif

Real diveDistanceSquared = d->m_diveDistance;
if (curLoco && curLoco->getPreferredHeight()) {
diveDistanceSquared *= diveDistanceSquared;
Expand Down
Loading