FS2_Open
Open source remastering of the Freespace 2 engine
aigoals.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _AIGOALS_H
13 #define _AIGOALS_H
14 
15 #include "globalincs/globals.h"
16 #include "globalincs/pstypes.h"
17 
18 struct wing;
19 struct ai_info;
20 struct ai_goal;
21 
22 // macros for goals which get set via sexpressions in the mission code
23 
24 // IMPORTANT! If you add a new AI_GOAL_x define, be sure to update the functions
25 // ai_update_goal_references() and query_referenced_in_ai_goals() or else risk breaking
26 // Fred. If the goal you add doesn't have a target (such as chase_any), then you don't have
27 // to worry about doing this. Also add it to list in Fred\Management.cpp, and let Hoffoss know!
28 // WMC - Oh and add them to Ai_goal_names plz. TY! :)
29 #define AI_GOAL_CHASE (1<<1) // 0x00000002
30 #define AI_GOAL_DOCK (1<<2) // 0x00000004 // used for undocking as well
31 #define AI_GOAL_WAYPOINTS (1<<3) // 0x00000008
32 #define AI_GOAL_WAYPOINTS_ONCE (1<<4) // 0x00000010
33 #define AI_GOAL_WARP (1<<5) // 0x00000020
34 #define AI_GOAL_DESTROY_SUBSYSTEM (1<<6) // 0x00000040
35 #define AI_GOAL_FORM_ON_WING (1<<7) // 0x00000080
36 #define AI_GOAL_UNDOCK (1<<8) // 0x00000100
37 #define AI_GOAL_CHASE_WING (1<<9) // 0x00000200
38 #define AI_GOAL_GUARD (1<<10) // 0x00000400
39 #define AI_GOAL_DISABLE_SHIP (1<<11) // 0x00000800
40 #define AI_GOAL_DISARM_SHIP (1<<12) // 0x00001000
41 #define AI_GOAL_CHASE_ANY (1<<13) // 0x00002000
42 #define AI_GOAL_IGNORE (1<<14) // 0x00004000
43 #define AI_GOAL_GUARD_WING (1<<15) // 0x00008000
44 #define AI_GOAL_EVADE_SHIP (1<<16) // 0x00010000
45 
46 // the next goals are for support ships only
47 #define AI_GOAL_STAY_NEAR_SHIP (1<<17) // 0x00020000
48 #define AI_GOAL_KEEP_SAFE_DISTANCE (1<<18) // 0x00040000
49 #define AI_GOAL_REARM_REPAIR (1<<19) // 0x00080000
50 
51 // resume regular goals
52 #define AI_GOAL_STAY_STILL (1<<20) // 0x00100000
53 #define AI_GOAL_PLAY_DEAD (1<<21) // 0x00200000
54 #define AI_GOAL_CHASE_WEAPON (1<<22) // 0x00400000
55 
56 #define AI_GOAL_FLY_TO_SHIP (1<<23) // 0x00800000
57 #define AI_GOAL_IGNORE_NEW (1<<24) // 0x01000000
58 
59 // now the masks for ship types
60 
61 // Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
62 //WMC - Don't need these anymore. Whee!
63 /*
64 #define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_IGNORE_NEW | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE )
65 #define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
66 #define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
67 #define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD| AI_GOAL_STAY_NEAR_SHIP )
68 #define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT | AI_GOAL_STAY_NEAR_SHIP )
69 #define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FREIGHTER | AI_GOAL_STAY_NEAR_SHIP )
70 #define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
71 #define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
72 #define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
73 #define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) | AI_GOAL_STAY_NEAR_SHIP )
74 #define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
75 #define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
76 #define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
77 */
78 
79 #define MAX_AI_DOCK_NAMES 25
80 
82 
84 extern int Num_ai_goals;
85 
86 extern int Num_ai_dock_names;
88 
89 extern const char *Ai_goal_text(int goal);
90 
91 // extern function definitions
92 extern void ai_post_process_mission();
93 extern void ai_maybe_add_form_goal( wing *wingp );
94 extern void ai_process_mission_orders( int objnum, ai_info *aip );
95 
96 extern int ai_goal_num(ai_goal *goals);
97 
98 // adds goals to ships/wing through sexpressions
99 extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
100 extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
101 extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
102 extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp );
103 
104 extern int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp );
105 extern void ai_remove_wing_goal_sexp(int sexp, int wingnum);
106 
107 // adds goals to ships/sings through player orders
108 extern void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
109 extern void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum );
110 
111 extern void ai_remove_ship_goal( ai_info *aip, int index );
112 extern void ai_clear_ship_goals( ai_info *aip );
113 extern void ai_clear_wing_goals( int wingnum );
114 
115 extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
116 
117 extern void ai_mission_goal_complete( ai_info *aip );
118 extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
119 
120 extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name);
121 extern int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name);
122 extern char *ai_add_dock_name(const char *str);
123 
124 extern int ai_query_goal_valid( int ship, int ai_goal_type );
125 
126 extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
127 extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
128 
129 #endif
SCP_string sexp
Definition: sexp.cpp:25556
int Num_ai_goals
Definition: aigoals.cpp:90
int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
Definition: aigoals.cpp:2362
int ai_remove_goal_sexp_sub(int sexp, ai_goal *aigp)
Definition: aigoals.cpp:1037
const char * Ai_goal_text(int goal)
Definition: aigoals.cpp:96
GLuint index
Definition: Glext.h:5608
ai_goal_list Ai_goal_names[]
Definition: aigoals.cpp:62
void ai_remove_wing_goal_sexp(int sexp, int wingnum)
Definition: aigoals.cpp:1175
void ai_process_mission_orders(int objnum, ai_info *aip)
Definition: aigoals.cpp:1977
Definition: ship.h:1516
GLenum mode
Definition: Glext.h:5794
Definition: ai.h:329
char dockee_point[NAME_LENGTH]
void ai_mission_goal_complete(ai_info *aip)
Definition: aigoals.cpp:360
void ai_add_goal_ship_internal(ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate=1)
Definition: aigoals.cpp:1244
void ai_add_goal_wing_internal(wing *wingp, int goal_type, char *name, int immediate=1)
Definition: aigoals.cpp:1324
void ai_clear_wing_goals(int wingnum)
Definition: aigoals.cpp:270
GLenum type
Definition: Gl.h:1492
void ai_add_goal_sub_sexp(int sexp, int type, ai_goal *aigp)
void ai_maybe_add_form_goal(wing *wingp)
Definition: aigoals.cpp:134
void ai_mission_wing_goal_complete(int wingnum, ai_goal *remove_goalp)
Definition: aigoals.cpp:300
int priority
Definition: ai.h:141
void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name)
Definition: aigoals.cpp:2295
Definition: ship.h:534
void ai_add_ship_goal_player(int type, int mode, int submode, char *shipname, ai_info *aip)
Definition: aigoals.cpp:757
void ai_add_ship_goal_sexp(int sexp, int type, ai_info *aip)
Definition: aigoals.cpp:1201
int ai_query_goal_valid(int ship, int ai_goal_type)
Definition: aigoals.cpp:208
#define MAX_AI_DOCK_NAMES
Definition: aigoals.h:79
char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH]
Definition: aigoals.cpp:60
GLuint const GLchar * name
Definition: Glext.h:5608
int Num_ai_dock_names
Definition: aigoals.cpp:59
void ai_remove_ship_goal(ai_info *aip, int index)
Definition: aigoals.cpp:231
void ai_post_process_mission()
Definition: aigoals.cpp:159
#define NAME_LENGTH
Definition: globals.h:15
int ai_goal_num(ai_goal *goals)
Definition: aigoals.cpp:691
char * ai_add_dock_name(const char *str)
Definition: aigoals.cpp:2427
void ai_copy_mission_wing_goal(ai_goal *aigp, ai_info *aip)
Definition: aigoals.cpp:1340
void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
Definition: aigoals.cpp:1210
void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip)
Definition: aigoals.cpp:730
Definition: ai.h:134
void ai_clear_ship_goals(ai_info *aip)
Definition: aigoals.cpp:251
void ai_add_wing_goal_player(int type, int mode, int submode, char *shipname, int wingnum)
Definition: aigoals.cpp:783
char docker_point[NAME_LENGTH]
flag_def_list ai_goal_list
Definition: aigoals.h:81