FS2_Open
Open source remastering of the Freespace 2 engine
|
#include "ai/ai_profiles.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "object/waypoint.h"
#include "physics/physics.h"
Go to the source code of this file.
Classes | |
struct | ai_flag_name |
struct | ai_goal |
struct | ai_class |
struct | pnode |
struct | ai_info |
struct | rotating_dockpoint_info |
Typedefs | |
typedef struct ai_flag_name | ai_flag_name |
typedef struct ai_goal | ai_goal |
typedef struct ai_class | ai_class |
typedef struct pnode | pnode |
typedef struct ai_info | ai_info |
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON) |
#define AIF_FORMATION (AIF_FORMATION_WING | AIF_FORMATION_OBJECT) |
#define AIGF_DOCK_INDEXES_VALID (AIGF_DOCKER_INDEX_VALID|AIGF_DOCKEE_INDEX_VALID) |
typedef struct ai_flag_name ai_flag_name |
Definition at line 1370 of file aicode.cpp.
Definition at line 15338 of file aicode.cpp.
Definition at line 12883 of file aicode.cpp.
int ai_acquire_emerge_path | ( | object * | pl_objp, |
int | parent_objnum, | ||
int | path_mask, | ||
vec3d * | pos, | ||
vec3d * | fvec | ||
) |
Definition at line 12632 of file aicode.cpp.
Definition at line 15421 of file aicode.cpp.
Definition at line 13506 of file aicode.cpp.
void ai_attack_object | ( | object * | attacker, |
object * | attacked, | ||
ship_subsys * | ssp | ||
) |
Set *attacked as object to attack for object *attacker
If attacked == NULL, then attack any enemy object. Attack point *rel_pos on object. This is for supporting attacking subsystems.
Definition at line 2257 of file aicode.cpp.
Set *attacked as object to attack for object *attacker Attack point *rel_pos on object. This is for supporting attacking subsystems.
Definition at line 2326 of file aicode.cpp.
void ai_chase_ct | ( | ) |
Handler of submode for Chase. Go into a continuous turn for awhile.
Definition at line 6505 of file aicode.cpp.
Do stuff at start of deathroll.
Definition at line 15299 of file aicode.cpp.
Definition at line 11556 of file aicode.cpp.
Definition at line 14564 of file aicode.cpp.
void ai_do_objects_docked_stuff | ( | object * | docker, |
int | docker_point, | ||
object * | dockee, | ||
int | dockee_point, | ||
bool | update_clients = true |
||
) |
Definition at line 3008 of file aicode.cpp.
Definition at line 10186 of file aicode.cpp.
Definition at line 3054 of file aicode.cpp.
If object *objp is being repaired, deal with it!
Definition at line 11996 of file aicode.cpp.
Definition at line 3273 of file aicode.cpp.
Make *objp stay within dist units of *other_objp
Definition at line 3254 of file aicode.cpp.
void ai_dock_with_object | ( | object * | docker, |
int | docker_index, | ||
object * | dockee, | ||
int | dockee_index, | ||
int | dock_type | ||
) |
Definition at line 3098 of file aicode.cpp.
Definition at line 6584 of file aicode.cpp.
Set *evaded as object for *evader to evade.
Definition at line 2362 of file aicode.cpp.
Definition at line 1017 of file aigoals.cpp.
void ai_find_path | ( | object * | pl_objp, |
int | objnum, | ||
int | path_num, | ||
int | exit_flag, | ||
int | subsys_path = 0 |
||
) |
Definition at line 2875 of file aicode.cpp.
Definition at line 5626 of file aicode.cpp.
Definition at line 6050 of file aicode.cpp.
Definition at line 11532 of file aicode.cpp.
void ai_fly_to_ship | ( | ) |
Definition at line 4607 of file aicode.cpp.
Make object *objp form on wing of object *goal_objp
Definition at line 3290 of file aicode.cpp.
char* ai_get_goal_target_name | ( | const char * | name, |
int * | index | ||
) |
float ai_get_weapon_dist | ( | ship_weapon * | swp | ) |
Return the distance that the current AI weapon will travel
Definition at line 6288 of file aicode.cpp.
float ai_get_weapon_speed | ( | ship_weapon * | swp | ) |
Definition at line 6304 of file aicode.cpp.
Entry point from sexpression code to set internal data for use by AI code.
Definition at line 326 of file aicode.cpp.
Ignore some object without changing mode.
Definition at line 2440 of file aicode.cpp.
Ignore some object without changing mode.
Definition at line 2485 of file aicode.cpp.
Called once at game start-up
Definition at line 828 of file aicode.cpp.
Definition at line 15446 of file aicode.cpp.
This inits the AI. You should be able to call this between levels to reset everything.
Definition at line 853 of file aicode.cpp.
Maybe fire afterburner based on AI class
Definition at line 4825 of file aicode.cpp.
Called to init the data for single ai object.
At this point, the ship and the object and the ai_info are are correctly linked together. Ai_info[ai_index].shipnum is the only valid field in ai_info.
This is called right when the object is parsed, so you can't assume much has been initialized. For example, wings, waypoints, goals are probably not yet loaded. --MK, 10/8/96
Definition at line 1330 of file aicode.cpp.
float ai_path | ( | ) |
Definition at line 4087 of file aicode.cpp.
Definition at line 14232 of file aicode.cpp.
Make objp rearm and repair goal_objp
Definition at line 15493 of file aicode.cpp.
Definition at line 7359 of file aicode.cpp.
Definition at line 7505 of file aicode.cpp.
Definition at line 7532 of file aicode.cpp.
Definition at line 7450 of file aicode.cpp.
Definition at line 13301 of file aicode.cpp.
void ai_set_positions | ( | object * | pl_objp, |
object * | en_objp, | ||
ai_info * | aip, | ||
vec3d * | player_pos, | ||
vec3d * | enemy_pos | ||
) |
Definition at line 3469 of file aicode.cpp.
Sets the timestamp used to tell is it is a good time for this team to rearm. Once the timestamp is no longer valid, then rearming is not a "good time"
team | Team (friendly, hostile, neutral) |
time | Time to rearm |
Definition at line 300 of file aicode.cpp.
Definition at line 15234 of file aicode.cpp.
void ai_ship_hit | ( | object * | objp_ship, |
object * | hit_objp, | ||
vec3d * | hitpos, | ||
int | shield_quadrant, | ||
vec3d * | hit_normal | ||
) |
Object *objp_ship was hit by either weapon *objp_weapon or collided into by ship hit_objp at point *hitpos.
Definition at line 14934 of file aicode.cpp.
Definition at line 3186 of file aicode.cpp.
void ai_start_waypoints | ( | object * | objp, |
waypoint_list * | wp_list, | ||
int | wp_flags | ||
) |
Definition at line 3215 of file aicode.cpp.
Definition at line 2982 of file aicode.cpp.
void ai_turn_towards_vector | ( | vec3d * | dest, |
object * | objp, | ||
float | frametime, | ||
float | turn_time, | ||
vec3d * | slide_vec, | ||
vec3d * | rel_pos, | ||
float | bank_override, | ||
int | flags, | ||
vec3d * | rvec = NULL , |
||
int | sexp_flags = 0 |
||
) |
Definition at line 1131 of file aicode.cpp.
Updates AI aim automatically based on targetted enemy.
aip | Pointer to AI info |
Definition at line 3490 of file aicode.cpp.
Update danger_weapon_objnum and signature in ai_info to say this weapon is to be avoided.
Definition at line 1056 of file aicode.cpp.
For pl_objp, create a path along path path_num into mobjp. The tricky part of this problem is creating the entry to the first point on the predefined path. The points on this entry path are based on the location of Pl_objp relative to the start of the path.
pl_objp | Player object |
mobjp | Model object |
path_num | Number of path |
subsys_path | Optional param (default 0), indicating this is a path to a subsystem |
Definition at line 2706 of file aicode.cpp.
Definition at line 6609 of file aicode.cpp.
float dock_orient_and_approach | ( | object * | docker_objp, |
int | docker_index, | ||
object * | dockee_objp, | ||
int | dockee_index, | ||
int | dock_mode, | ||
rotating_dockpoint_info * | rdinfo = NULL |
||
) |
Definition at line 9070 of file aicode.cpp.
void evade_weapon | ( | ) |
Definition at line 4904 of file aicode.cpp.
Return objnum if enemy found, else return -1;
objnum | Object number |
range | Range within which to look |
max_attackers | Don't attack a ship that already has at least max_attackers attacking it. |
Definition at line 2186 of file aicode.cpp.
void get_absolute_wing_pos | ( | vec3d * | result_pos, |
object * | leader_objp, | ||
int | wing_index, | ||
int | formation_object_flag | ||
) |
Given a wing leader and a position in the wing formation, return the desired absolute location to fly to.
Definition at line 11409 of file aicode.cpp.
void get_absolute_wing_pos_autopilot | ( | vec3d * | result_pos, |
object * | leader_objp, | ||
int | wing_index, | ||
int | formation_object_flag | ||
) |
Definition at line 11432 of file aicode.cpp.
int get_nearest_objnum | ( | int | objnum, |
int | enemy_team_mask, | ||
int | enemy_wing, | ||
float | range, | ||
int | max_attackers | ||
) |
Given an object and an enemy team, return the index of the nearest enemy object. Unless aip->targeted_subsys != NULL, don't allow to attack objects with OF_PROTECTED bit set.
objnum | Object number |
enemy_team_mask | Mask to apply to enemy team |
enemy_wing | Enemy wing chosen |
range | Ship must be within range "range". |
max_attackers | Don't attack a ship that already has at least max_attackers attacking it. |
Definition at line 2029 of file aicode.cpp.
Initialize ai_info struct of object objnum.
Definition at line 14300 of file aicode.cpp.
Definition at line 14458 of file aicode.cpp.
void init_aip_from_class_and_profile | ( | ai_info * | aip, |
ai_class * | aicp, | ||
ai_profile_t * | profile | ||
) |
Definition at line 14490 of file aicode.cpp.
Is an instructor if name begins INSTRUCTOR_SHIP_NAME else not.
Definition at line 4895 of file aicode.cpp.
int might_collide_with_ship | ( | object * | obj1, |
object * | obj2, | ||
float | dot_to_enemy, | ||
float | dist_to_enemy, | ||
float | duration | ||
) |
Return true if it looks like obj1, if continuing to move along current vector, will collide with obj2.
Definition at line 6108 of file aicode.cpp.
Definition at line 11120 of file aicode.cpp.
void set_predicted_enemy_pos | ( | vec3d * | predicted_enemy_pos, |
object * | pobjp, | ||
vec3d * | enemy_pos, | ||
vec3d * | enemy_vel, | ||
ai_info * | aip | ||
) |
Definition at line 6397 of file aicode.cpp.
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 | ||
) |
Definition at line 6344 of file aicode.cpp.
Definition at line 1250 of file aicode.cpp.
ship_subsys* set_targeted_subsys | ( | ai_info * | aip, |
ship_subsys * | new_subsys, | ||
int | parent_objnum | ||
) |
Make new_subsys the targeted subsystem of ship *aip.
Definition at line 1289 of file aicode.cpp.
Definition at line 208 of file aicode.cpp.
Given an object and a point, turn away from the point, resulting in avoidance behavior. Note: Turn away at full speed, not scaled down by skill level.
Definition at line 1513 of file aicode.cpp.
Given an object and a point, turn towards the point, resulting in approach behavior.
Definition at line 1491 of file aicode.cpp.
void update_aspect_lock_information | ( | ai_info * | aip, |
vec3d * | vec_to_enemy, | ||
float | dist_to_enemy, | ||
float | enemy_radius | ||
) |
Definition at line 7576 of file aicode.cpp.
char** Ai_class_names |
Definition at line 268 of file aicode.cpp.
ai_class* Ai_classes |
Definition at line 193 of file aicode.cpp.
int Ai_firing_enabled |
Definition at line 194 of file aicode.cpp.
ai_flag_name Ai_flag_names[] |
Definition at line 203 of file aicode.cpp.
float AI_frametime |
Definition at line 266 of file aicode.cpp.
int Ai_goal_signature |
Definition at line 58 of file aigoals.cpp.
object* En_objp |
Definition at line 170 of file aicode.cpp.
char Goal_target_names[MAX_GOAL_TARGET_NAMES][NAME_LENGTH] |
int Mission_all_attack |
Definition at line 200 of file aicode.cpp.
int Num_ai_classes |
Definition at line 195 of file aicode.cpp.
pnode Path_points[MAX_PATH_POINTS] |
Definition at line 263 of file aicode.cpp.
object* Pl_objp |
Definition at line 169 of file aicode.cpp.
pnode* Ppfp |
Definition at line 264 of file aicode.cpp.