34 #define AICODE_TURRET_DUMBFIRE_ANGLE (0.8f)
35 #define AICODE_TURRET_HEATSEEK_ANGLE (0.7f)
36 #define AICODE_TURRET_MAX_TIME_IN_RANGE (5.0f)
37 #define BEAM_NEBULA_RANGE_REDUCE_FACTOR (0.8f)
40 DCF(lethality_range,
"N for modifying range: 1 / (1+N) at 100")
47 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
56 #define EEOF_BIG_ONLY (1<<0) // turret fires only at big and huge ships
57 #define EEOF_SMALL_ONLY (1<<1) // turret fires only at small ships
58 #define EEOF_TAGGED_ONLY (1<<2) // turret fires only at tagged ships
59 #define EEOF_BEAM (1<<3) // turret is a beam
60 #define EEOF_FLAK (1<<4) // turret is flak
61 #define EEOF_LASER (1<<5) // turret is a laser
62 #define EEOF_MISSILE (1<<6) // turret is a missile
121 float target_dist = distance;
122 if (distance == 0.0
f)
129 float multiplier = 0;
149 bool fix_elevation =
false;
150 bool fix_base_rot =
false;
152 if (dot < tp->turret_fov) {
154 fix_elevation =
true;
158 fix_elevation =
true;
167 if (!((temp_vec2.
xyz.x == 0) && (temp_vec2.
xyz.y == 0))) {
168 float temp_z = temp_vec2.
xyz.z;
169 temp_vec2.
xyz.z = 0.0f;
179 if (temp_vec2.
xyz.x < 0)
181 temp_vec2.
xyz.x = check_pos * sqrtf(1 - (temp_vec2.
xyz.y*temp_vec2.
xyz.y));
184 float scaler = sqrtf(1 - (temp_z*temp_z));
186 temp_vec2.
xyz.z = temp_z;
194 if (fix_elevation || fix_base_rot) {
196 multiplier = sqrtf(1 - (dot*dot));
206 mprintf((
"Warning: Function 'is_object_radius_in_turret_fov' was called\nwithout need to fix turret alignments\n"));
225 vec3d bomb_to_ship_vector;
388 int i = 0, flags2 = 0;
468 float longest_range_so_far = 0.0f;
481 if(weapon_range > longest_range_so_far)
482 longest_range_so_far = weapon_range;
492 if(weapon_range > longest_range_so_far)
493 longest_range_so_far = weapon_range;
496 return longest_range_so_far;
509 if ( objp == turret_parent ) {
580 float dist, dist_comp;
581 bool turret_has_no_target =
false;
669 int try_anyway =
FALSE;
671 float turret_stealth_find_chance = 0.5f;
673 if (
frand() > (turret_stealth_find_chance + speed_mod)) {
699 if (optimum_range > 0.0
f) {
700 if (dist < optimum_range) {
701 dist_comp = (2*optimum_range) - dist;
707 if (favor_one_side >= 1.0
f) {
710 dot_to_target = 1.0f - (dot_to_target / favor_one_side);
711 dist_comp *= dot_to_target;
716 bool check_weapon =
true;
719 check_weapon =
false;
732 if ( dist_comp < eeo->nearest_homing_bomb_dist ) {
734 turret_has_no_target =
true;
743 if ( dist_comp < eeo->nearest_bomb_dist ) {
745 turret_has_no_target =
true;
762 if ( (shipp) && (dist < eeo->weapon_travel_dist) ) {
768 dist_comp *= (1.0f + 0.1f*num_att_turrets);
780 if (num_att_turrets > max_turrets) {
806 if ( dist_comp < eeo->nearest_attacker_dist ) {
808 turret_has_no_target =
true;
824 if (dist_comp < eeo->nearest_dist ) {
826 turret_has_no_target =
true;
877 int get_nearest_turret_objnum(
int turret_parent_objnum,
ship_subsys *turret_subsys,
int enemy_team_mask,
vec3d *tpos,
vec3d *tvec,
int current_enemy,
bool big_only_flag,
bool small_only_flag,
bool tagged_only_flag,
bool beam_flag,
bool flak_flag,
bool laser_flag,
bool missile_flag)
880 int weapon_system_ok;
896 weapon_system_ok = 0;
898 weapon_system_ok = 1;
912 if (tagged_only_flag)
922 else if (missile_flag)
944 int n_tgt_priorities;
945 int priority_weapon_idx = -1;
951 if (n_tgt_priorities <= 0) {
959 if (priority_weapon_idx > -1)
963 if (n_tgt_priorities > 0) {
965 for(
int i = 0;
i < n_tgt_priorities;
i++) {
968 if (priority_weapon_idx == -1)
977 bool found_something;
981 found_something =
false;
984 found_something =
true;
988 for (
int j = 0; j < n_types; j++) {
990 found_something =
true;
995 if( ( n_s_classes > 0 ) && ( ptr->
type ==
OBJ_SHIP ) ) {
996 for (
int j = 0; j < n_s_classes; j++) {
998 found_something =
true;
1004 for (
int j = 0; j < n_w_classes; j++) {
1006 found_something =
true;
1014 found_something =
true;
1021 found_something =
true;
1026 found_something =
true;
1029 if(!(found_something)) {
1086 return return_objnum;
1107 objp = &Objects[mo->
objnum];
1128 objp = &Objects[so->
objnum];
1156 objp = &Objects[ao->
objnum];
1189 int enemy_team_mask, enemy_objnum;
1214 return target_objnum;
1257 if (in_fov ==
false)
1273 enemy_objnum =
get_nearest_turret_objnum(objnum, turret_subsys, enemy_team_mask, tpos, tvec, current_enemy, big_only_flag, small_only_flag, tagged_only_flag, beam_flag, flak_flag, laser_flag, missile_flag);
1274 if ( enemy_objnum >= 0 ) {
1286 return enemy_objnum;
1342 vec3d avg, tmp_pos, tmp_target, enemy_point, turret_norm;
1347 if (targetp ==
nullptr) {
1354 if (best_weapon_tidx < 0)
1385 tmp_target = *targetp;
1434 vec3d gun_pos, gun_vec, target_moving_direction;
1436 float weapon_system_strength;
1443 if (best_weapon_tidx < 0)
1482 if (weapon_system_strength < 0.7
f) {
1500 if (in_fov ==
false)
1537 vec3d subobj_pos, vector_out;
1546 float dot_return =
vm_vec_dot(&turret_norm, &vector_out);
1571 #define MAX_AIFFT_TURRETS 60
1577 DCF(mf,
"Adjusts the maximum number of tries an AI may do when trying to pick a subsystem to attack (Default is 5)")
1582 dc_printf(
"Value must be a non-negative, non-zero integer\n");
1583 dc_printf(
"aifft_max_checks set to default value of 5\n");
1610 float best_dot = 0.0f;
1611 *dot_out = best_dot;
1620 return best_subsysp;
1624 return best_subsysp;
1643 switch (psub->
type) {
1665 return best_subsysp;
1675 float dot_fov_modifier = 0.0f;
1685 if ((dot - dot_fov_modifier)*
aifft_rank[idx] > best_dot) {
1686 best_dot = (dot - dot_fov_modifier)*
aifft_rank[idx];
1687 best_subsysp = aifft_list[
idx];
1693 *dot_out = best_dot;
1694 return best_subsysp;
1728 float wait = 1000.0f;
1838 float flak_range = 0.0f;
1842 bool last_shot_in_salvo =
true;
1848 last_shot_in_salvo =
true;
1852 last_shot_in_salvo =
false;
1861 parent_ship = &
Ships[Objects[parent_objnum].instance];
1898 if (last_shot_in_salvo)
1914 fire_info.
shooter = &Objects[parent_objnum];
1920 fire_info.
turret = turret;
1925 if (weapon_objnum != -1) {
1926 objp = &Objects[weapon_objnum];
1965 for (
int i = 0;
i < wip->
shots;
i++) {
1983 Assert(num_primary_banks > 0);
1984 if (num_primary_banks < 1){
2020 int start_slot, end_slot;
2023 end_slot = start_slot;
2025 for (
int j = start_slot; j <= end_slot; j++) {
2050 weapon_objnum =
weapon_create( turret_pos, &turret_orient, turret_weapon_class, parent_objnum, -1, 1, 0,0.0
f, turret);
2054 if (weapon_objnum != -1) {
2055 objp = &Objects[weapon_objnum];
2075 if(predicted_pos != NULL)
2098 Assert( subsys_index != -1 );
2141 vec3d turret_pos, turret_fvec;
2176 if (weapon_objnum > -1) {
2205 Assert( subsys_index != -1 );
2221 float weapon_firing_range;
2224 float WeaponMinRange;
2258 bool valid_weap =
false;
2259 for (weap_check = 0; (weap_check < swp->
num_primary_banks) && !valid_weap; weap_check++) {
2293 objp = &
Objects[parent_objnum];
2330 int use_angles =
aifft_rotate_turret(shipp, parent_objnum, ss, objp, lep, &predicted_enemy_pos, &gvec);
2348 float dist_to_enemy = 0.0f;
2400 if (( num_ships_nearby >= 3 ) || ((num_ships_nearby >= 2) && (
frand() < 0.1f))) {
2414 WeaponMinRange = 0.0f;
2425 if (Nebula_sec_range)
2439 if( (dist_to_enemy <= weapon_firing_range) && (dist_to_enemy >= WeaponMinRange) )
2505 valid_weapons[num_valid++] =
i;
2516 Num_find_turret_enemy++;
2581 mprintf((
"last enemy is null\n"));
2593 bool ok_to_fire =
false;
2594 bool something_was_ok_to_fire=
false;
2600 int number_of_firings;
2608 number_of_firings = num_valid;
2611 for(i = 0; i < number_of_firings; i++)
2618 ffp_bank = valid_weapons[
i];
2635 vm_vec_sub(&v2e, &predicted_enemy_pos, &gpos);
2664 bool in_sight =
false;
2683 if ((dist_to_enemy < 75.0
f) || in_sight)
2691 if ((dist_to_enemy < 50.0
f) || in_sight)
2699 if ((dist_to_enemy < 50.0
f) || in_sight)
2710 if ((dist_to_enemy < 50.0
f) || in_sight)
2733 hull_check.
pos = &objp->
pos;
2734 hull_check.
p0 = &gpos;
2735 hull_check.
p1 = &
end;
2762 something_was_ok_to_fire =
true;
2763 Num_turrets_fired++;
2767 turret_fire_weapon(valid_weapons[0], ss, parent_objnum, &gpos, &tv2e, &predicted_enemy_pos);
2769 turret_fire_weapon(valid_weapons[i], ss, parent_objnum, &gpos, &tv2e, &predicted_enemy_pos);
2780 if(!something_was_ok_to_fire)
2782 mprintf((
"nothing ok to fire\n"));
2858 if ((of_dst.
xyz.x == 0) && (of_dst.
xyz.y == 0)) {
2875 bool in_fov =
false;
ship_subsys * target_subsys
void mc_info_init(mc_info *mc)
asteroid_obj Asteroid_obj_list
struct eval_enemy_obj_struct eval_enemy_obj_struct
int model_collide(mc_info *mc_info_obj)
bool model_anim_start_type(ship_subsys *pss, int animation_type, int subtype, int direction, bool instant)
void send_turret_fired_packet(int ship_objnum, int subsys_index, int weapon_objnum)
int timestamp(int delta_ms)
int turret_weapon_aggregate_flags2(ship_weapon *swp)
#define STI_AI_TURRETS_ATTACK
int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy)
model_subsystem * system_info
weapon Weapons[MAX_WEAPONS]
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
#define MAX_SHIP_PRIMARY_BANKS
EModelAnimationPosition turret_animation_position
float vm_vec_mag_quick(const vec3d *v)
matrix * vm_matrix_x_matrix(matrix *dest, const matrix *src0, const matrix *src1)
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS
#define SSF_FOV_EDGE_CHECK
void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
int num_target_priorities
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
#define OF_LASER_PROTECTED
float frand_range(float min, float max)
Return a floating point number in the range min..max.
#define MSS_FLAG2_TURRET_USE_AMMO
int obj_team(object *objp)
weapon_info Weapon_info[MAX_WEAPON_TYPES]
SCP_vector< game_snd > Snds
#define MAX_AIFFT_TURRETS
float Lethality_range_const
submodel_instance_info submodel_info_1
#define SSF_PLAY_SOUND_FOR_PLAYER
bool dock_check_find_docked_object(object *objp, object *other_objp)
int weapon_create(vec3d *pos, matrix *orient, int weapon_type, int parent_obj, int group_id=-1, int is_locked=0, int is_spawned=0, float fof_cooldown=0.0f, ship_subsys *src_turret=NULL)
int model_rotate_gun(int model_num, model_subsystem *turret, matrix *orient, angles *base_angles, angles *gun_angles, vec3d *pos, vec3d *dst, int obj_idx, bool reset=false)
GLsizei const GLfloat * points
int turret_max_target_ownage
void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, int use_angles, vec3d *targetp)
int next_primary_fire_stamp[MAX_SHIP_PRIMARY_BANKS]
void mflash_create(vec3d *gun_pos, vec3d *gun_dir, physics_info *pip, int mflash_type, object *local)
int next_secondary_fire_stamp[MAX_SHIP_SECONDARY_BANKS]
void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, float weapon_speed, float time_enemy_in_range)
int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object *objp, object *lep, vec3d *predicted_enemy_pos, vec3d *gvec)
submodel_instance_info submodel_info_2
char sub_name[NAME_LENGTH]
bool turret_weapon_has_subtype(ship_weapon *swp, int subtype)
#define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS
int turret_next_enemy_check_stamp
int nearest_homing_bomb_objnum
struct vec3d::@225::@227 xyz
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING
void static_randvec(int num, vec3d *vp)
[To be described]
ship_subsys * target_subsys
vec3d * vm_vec_avg_n(vec3d *dest, int n, const vec3d src[])
#define MSS_FLAG_TURRET_ANIM_WAIT
int ship_subsystem_in_sight(object *objp, ship_subsys *subsys, vec3d *eye_pos, vec3d *subsys_pos, int do_facing_check, float *dot_out, vec3d *vec_out)
weapon_info * get_turret_weapon_wip(ship_weapon *swp, int weapon_num)
#define WIF2_SAME_TURRET_COOLDOWN
int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
#define NUM_TURRET_ORDER_TYPES
void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss)
ai_info Ai_info[MAX_AI_INFO]
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
#define Assertion(expr, msg,...)
#define WEAPON_INFO_INDEX(wip)
#define END_OF_LIST(head)
#define AICODE_TURRET_MAX_TIME_IN_RANGE
void turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, weapon_info *wip, int weapon_num)
ship_subsys * targeted_subsys
int valid_turret_enemy(object *objp, object *turret_parent)
int ship_is_tagged(object *objp)
float ai_turret_max_aim_update_delay
void vm_vec_scale_add2(vec3d *dest, const vec3d *src, float k)
int turret_next_fire_stamp
#define WIF_HOMING_ASPECT
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY
ship_subsys * aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *enemy_objp, float *dot_out)
int current_secondary_bank
#define CHA_ONTURRETFIRED
float aifft_compute_turret_dot(object *objp, object *enemy_objp, vec3d *abs_gunposp, ship_subsys *turret_subsysp, ship_subsys *enemy_subsysp)
float flak_get_range(object *objp)
vec3d turret_firing_point[MAX_TFP]
void ship_get_global_turret_info(object *objp, model_subsystem *tp, vec3d *gpos, vec3d *gvec)
void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip)
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos=NULL, float flak_range_override=100.0f)
script_state Script_system("FS2_Open Scripting")
float base_rotation_rate_pct
ship_subsys * last_fired_turret
#define DCF(function_name, help_text)
The potent DCF macro, used to define new debug commands for the console.
#define IS_VEC_NULL_SQ_SAFE(v)
#define AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS
int turret_max_bomb_ownage
int iff_get_attackee_mask(int attacker_team)
int turret_select_best_weapon(ship_subsys *turret, object *target)
float aifft_rank[MAX_AIFFT_TURRETS]
void model_make_turret_matrix(int model_num, model_subsystem *turret)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define MAX_SHIP_SECONDARY_BANKS
void model_instance_find_world_point(vec3d *outpnt, vec3d *mpnt, int model_instance_num, int submodel_num, const matrix *objorient, const vec3d *objpos)
void turret_update_enemy_in_range(ship_subsys *turret, float seconds)
matrix * vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, const vec3d *rvec)
float ship_get_subsystem_strength(ship *shipp, int type)
void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_objnum, int target_is_locked=0, ship_subsys *target_subsys=NULL)
void vm_vec_add2(vec3d *dest, const vec3d *src)
#define MSS_FLAG_TURRET_FIXED_FP
void flak_muzzle_flash(vec3d *pos, vec3d *dir, physics_info *pip, int turret_weapon_class)
ship_subsys * turret_subsys
struct matrix::@228::@230 vec
#define ANIMATION_SUBTYPE_ALL
#define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE
void vm_vec_scale(vec3d *dest, float s)
int timestamp_until(int stamp)
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip)
#define AICODE_TURRET_HEATSEEK_ANGLE
#define MSS_FLAG_TURRET_RESET_IDLE
int primary_bank_ammo[MAX_SHIP_PRIMARY_BANKS]
float Player_lethality_bump[NUM_SKILL_LEVELS]
bool turret_weapon_has_flags(ship_weapon *swp, int flags)
#define SW_FLAG_TURRET_LOCK
int ship_subsys_disrupted(ship_subsys *ss)
ai_profile_t * ai_profile
int ship_get_index_from_subsys(ship_subsys *ssp, int objnum, int error_bypass)
int snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, float radius, vec3d *source_vel, int looping, float vol_scale, int priority, vec3d *sound_fvec, float range_factor, int force, bool is_ambient)
int Player_attacking_enabled
float ai_ship_fire_delay_scale_friendly
#define WIF3_TURRET_INTERCEPTABLE
#define AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY
int object_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos, float dist)
int turret_should_pick_new_target(ship_subsys *turret)
float nearest_homing_bomb_dist
bool turret_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
int model_anim_get_time_type(ship_subsys *pss, int animation_type, int subtype)
float vm_vec_normalized_dir(vec3d *dest, const vec3d *end, const vec3d *start)
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
char * Turret_target_order_names[NUM_TURRET_ORDER_TYPES]
#define BEAM_NEBULA_RANGE_REDUCE_FACTOR
int Num_find_turret_enemy
int turret_targeting_order[NUM_TURRET_ORDER_TYPES]
bool scripting_target_override
ship_subsys * aifft_list[MAX_AIFFT_TURRETS]
#define MSS_FLAG_TURRET_ALT_MATH
int beam_fire(beam_fire_info *fire_info)
void flak_set_range(object *objp, float range)
int turret_num_firing_points
int secondary_bank_ammo[MAX_SHIP_SECONDARY_BANKS]
beam_info * beam_info_override
#define SUBSYSTEM_WEAPONS
#define MSS_FLAG_FIRE_ON_TARGET
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
int num_targeting_priorities
int iff_x_attacks_y(int team_x, int team_y)
#define MSS_FLAG2_TURRET_ONLY_TARGET_IF_CAN_FIRE
object Objects[MAX_OBJECTS]
int turret_max_bomb_ownage
#define MSS_FLAG2_SHARE_FIRE_DIRECTION
bool is_object_radius_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos, vec3d *v2e, vec3d *predicted_pos, float distance)
int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag, bool flak_flag, bool laser_flag, bool missile_flag)
float asteroid_time_to_impact(object *asteroid_objp)
void dc_stuff_float(float *f)
Stuffs a float to the given variable.
#define WBF_RANDOM_LENGTH
int turret_animation_done_time
#define OF_MISSILE_PROTECTED
ship_subsys * turret_subsys
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
int RunCondition(int condition, char format='\0', void *data=NULL, class object *objp=NULL, int more_data=0)
#define SW_FLAG_TAGGED_ONLY
vec3d turret_last_fire_direction
void SetHookObjects(int num,...)
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
float gun_rotation_rate_pct
int get_turret_weapon_next_fire_stamp(ship_weapon *swp, int weapon_num)
#define MSS_FLAG_TURRET_HULL_CHECK
#define AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY
void model_instance_find_world_dir(vec3d *out_dir, vec3d *in_dir, int model_instance_num, int submodel_num, const matrix *objorient)
int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold)
int nearest_attacker_objnum
float turret_time_enemy_in_range
float longest_turret_weapon_range(ship_weapon *swp)
void send_flak_fired_packet(int ship_objnum, int subsys_index, int weapon_objnum, float flak_range)
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
#define DCF_BOOL(function_name, bool_variable)
int secondary_next_slot[MAX_SHIP_SECONDARY_BANKS]
int turret_max_target_ownage
float favor_current_facing
float frand()
Return random value in range 0.0..1.0- (1.0- means the closest number less than 1.0)
void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
int set_target_objnum(ai_info *aip, int objnum)
float ai_ship_fire_delay_scale_hostile
#define STI_TURRET_TGT_SHIP_TGT
#define SUBSYSTEM_SENSORS
bool all_turret_weapons_have_flags(ship_weapon *swp, int flags)
bool turret_adv_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
ship_subsys * ship_get_closest_subsys_in_sight(ship *sp, int subsys_type, vec3d *attacker_pos)
int asteroid_collide_objnum(object *asteroid_objp)
ship_subsys * targeted_subsys
float model_get_radius(int modelnum)
void RemHookVars(unsigned int num,...)
bool all_turret_weapons_have_flags2(ship_weapon *swp, int flags)
#define MULTIPLAYER_MASTER
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
SCP_vector< ship_info > Ship_info
float get_adjusted_turret_rof(ship_subsys *ss)
#define OF_FLAK_PROTECTED
#define MSS_FLAG_TURRET_SALVO
#define AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY
int num_turrets_attacking(object *turret_parent, int target_objnum)
int is_target_beam_valid(ship_weapon *swp, object *objp)
#define timestamp_elapsed(stamp)
#define AICODE_TURRET_DUMBFIRE_ANGLE
#define TRIGGER_TYPE_TURRET_FIRED
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
bool is_object_stealth_ship(object *objp)
void vm_vec_scale_sub2(vec3d *dest, const vec3d *src, float k)
SCP_vector< int > weapon_class
#define TRIGGER_TYPE_TURRET_FIRING
SCP_vector< int > ship_type
matrix world_to_turret_matrix
void flak_pick_range(object *objp, vec3d *firing_pos, vec3d *predicted_target_pos, float weapon_subsys_strength)
#define WIF_HOMING_JAVELIN
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
int turret_weapon_aggregate_flags(ship_weapon *swp)
#define WIF2_ANTISUBSYSBEAM
int iff_matches_mask(int team, int mask)
int object_is_targetable(object *target, ship *viewer)
missile_obj Missile_obj_list
int max_turret_ownage_target[NUM_SKILL_LEVELS]
#define MSS_FLAG_USE_MULTIPLE_GUNS
int max_turret_ownage_player[NUM_SKILL_LEVELS]
#define MSS_FLAG_TURRET_MATRIX
int targeting_priorities[32]
SCP_vector< ai_target_priority > Ai_tp_list
int burst_counter[MAX_SHIP_PRIMARY_BANKS+MAX_SHIP_SECONDARY_BANKS]
float nearest_attacker_dist
SCP_vector< ship_type_info > Ship_types
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
int last_fired_weapon_info_index
#define AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS
#define SW_FLAG_BEAM_FREE
#define SSF_NO_SS_TARGETING
#define MSS_FLAG_FIRE_ON_NORMAL
float vm_vec_normalize(vec3d *v)
#define OF_BEAM_PROTECTED
bool turret_std_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
void flak_jitter_aim(vec3d *dir, float dist_to_target, float weapon_subsys_strength, weapon_info *wip)
int turret_should_fire_aspect(ship_subsys *turret, weapon_info *wip, bool in_sight)
SCP_vector< int > ship_class