diff --git a/code/ai/ai_flags.h b/code/ai/ai_flags.h index 432f0ade558..427ec5f8395 100644 --- a/code/ai/ai_flags.h +++ b/code/ai/ai_flags.h @@ -176,6 +176,7 @@ namespace AI { Dont_limit_change_in_speed_due_to_physics_whack, Guards_ignore_protected_attackers, Fix_standard_strafe, + Fix_target_updating_with_strafe, Standard_strafe_used_more, Unify_usage_ai_shield_manage_delay, Fix_AI_shield_management_bug, diff --git a/code/ai/ai_profiles.cpp b/code/ai/ai_profiles.cpp index a35a0bd0df4..d65ba45ecfc 100644 --- a/code/ai/ai_profiles.cpp +++ b/code/ai/ai_profiles.cpp @@ -677,6 +677,8 @@ void parse_ai_profiles_tbl(const char *filename) set_flag(profile, "$fix standard strafe:", AI::Profile_Flags::Fix_standard_strafe); + set_flag(profile, "$fix target updating with strafe:", AI::Profile_Flags::Fix_target_updating_with_strafe); + set_flag(profile, "$standard strafe used more:", AI::Profile_Flags::Standard_strafe_used_more); if (optional_string("$standard strafe triggers under this speed:")) { @@ -987,5 +989,7 @@ void ai_profile_t::reset() flags.set(AI::Profile_Flags::Fix_big_ship_waypoint_completion); flags.set(AI::Profile_Flags::Fix_shockwave_expire_before_do_damage); flags.set(AI::Profile_Flags::Fix_small_ai_recover_after_engines_repaired); + flags.set(AI::Profile_Flags::Fix_standard_strafe); + flags.set(AI::Profile_Flags::Fix_target_updating_with_strafe); } } diff --git a/code/ai/aicode.cpp b/code/ai/aicode.cpp index 04060cc2da8..ea7e0b29f86 100644 --- a/code/ai/aicode.cpp +++ b/code/ai/aicode.cpp @@ -15513,8 +15513,13 @@ void ai_frame(int objnum) En_objp = NULL; } - if (aip->mode == AIM_CHASE) { - if (En_objp == NULL) { + if (aip->mode == AIM_CHASE || ((The_mission.ai_profile->flags[AI::Profile_Flags::Fix_target_updating_with_strafe]) && aip->mode == AIM_STRAFE)) { + // If we're chasing or strafing against large ship but have lost our target, clear the active goal + // to ensure ai_process_mission_orders() re-evaluates our orders next frame. + // Without this fighter/bomber whose strafe target is destroyed drops to AIM_NONE (see ai_execute_behavior) + // with its active_goal still set, so a standing order like attack-any is never re-processed + // and the ship slows to zero and remains still until another order is issued. + if (En_objp == nullptr) { aip->active_goal = -1; } }