]> icculus.org git repositories - taylor/freespace2.git/blob - include/aigoals.h
Initial revision
[taylor/freespace2.git] / include / aigoals.h
1 /*
2  * $Logfile: /Freespace2/code/Ship/AiGoals.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * <insert description of file here>
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 5     7/09/99 5:54p Dave
15  * Seperated cruiser types into individual types. Added tons of new
16  * briefing icons. Campaign screen.
17  * 
18  * 4     3/26/99 4:49p Dave
19  * Made cruisers able to dock with stuff. Made docking points and paths
20  * visible in fred.
21  * 
22  * 3     11/05/98 5:55p Dave
23  * Big pass at reducing #includes
24  * 
25  * 2     10/07/98 10:53a Dave
26  * Initial checkin.
27  * 
28  * 1     10/07/98 10:51a Dave
29  * 
30  * 46    2/26/98 10:08p Hoffoss
31  * Rewrote state saving and restoring to fix bugs and simplify the code.
32  * 
33  * 45    2/22/98 4:17p John
34  * More string externalization classification... 190 left to go!
35  * 
36  * 44    2/16/98 10:13p Allender
37  * initial work on being able to target weapons (bombs specifically).
38  * Work on getting rearm/repair working under multiplayer
39  * 
40  * 43    2/13/98 3:21p Lawrance
41  * Set up allowed goals for escape pods.
42  * 
43  * 42    1/30/98 10:01a Allender
44  * made large ships able to attack other ships.  Made goal code recognize
45  * when ships removed from wings during ship select
46  * 
47  * 41    12/15/97 5:25p Allender
48  * fix problem with docked ships receiving another dock goal.  They now
49  * properly undock
50  * 
51  * 40    11/17/97 6:39p Lawrance
52  * add AI_goal_text[] array, used by HUD code to show text description of
53  * order
54  * 
55  * 39    10/29/97 10:02p Allender
56  * be sure that player starting wings that arrive late also form on the
57  * players wing if there are no goals
58  * 
59  * 38    10/23/97 4:41p Allender
60  * lots of new rearm/repair code.  Rearm requests now queue as goals for
61  * support ship.  Warp in of new support ships functional.  Support for
62  * stay-still and play-dead.  
63  * 
64  * 37    10/22/97 1:44p Allender
65  * more work on stay-still and play-dead
66  * 
67  * 36    10/22/97 11:07a Allender
68  * Hooked in form on my wing into Mikes AI code
69  * 
70  * 35    10/22/97 10:33a Hoffoss
71  * Added AI_GOAL_PLAY_DEAD as a valid goal for all ships.
72  * 
73  * 34    10/22/97 9:54a Allender
74  * added ai_goal_play_dead
75  * 
76  * 33    10/10/97 5:03p Allender
77  * started work on ai-stay-still
78  * 
79  * 32    9/23/97 4:35p Allender
80  * added two function to add "internal" goals to ships and wings.  Used by
81  * AI when it needs to do something special
82  * 
83  * 31    8/15/97 11:07a Hoffoss
84  * Added warning to help eliminate problems later on down the road.
85  * 
86  * 30    8/15/97 9:59a Hoffoss
87  * Changed ai_query_goal_valid() again.  I can't think of any time you
88  * wouldn't find it easier just to pass in a ship instead of a ship_info
89  * flag structure filtered of all flags that aren't ship type bits.  Since
90  * I'll call this quite a few times, it will make my life easier.
91  * 
92  * 29    8/14/97 10:00p Allender
93  * made ai goals bitfields so that we can have set of orders that certain
94  * ship types are allowed to receive.  Added function for Hoffoss to check
95  * goal vs. ship type validity
96  * 
97  * 28    8/12/97 1:55a Hoffoss
98  * Made extensive changes to object reference checking and handling for
99  * object deletion call.
100  * 
101  * 27    8/08/97 1:30p Allender
102  * added commands (and ai goals) for support ships.  stay near ship (which
103  * could be player or current target), and keep safe distance
104  * 
105  * 26    8/06/97 9:41a Allender
106  * renamed from ai_goal function.  made a function to remove a goal from a
107  * wing (used strictly for waypoints now).  ai-chase-wing and
108  * ai-guard-wing now appear to user as ai-chase and ai-guard.  Tidied up
109  * function which deals with sexpression goals
110  * 
111  * 25    8/06/97 8:06a Lawrance
112  * add more stuff to save/restore
113  * 
114  * 24    7/24/97 4:55p Allender
115  * added ai-evade-ship to fred and to Freespace
116  * 
117  * 23    7/17/97 4:23p Allender
118  * ai-guard-wing now in both Fred and Freespace
119  * 
120  * 22    7/15/97 11:57a Hoffoss
121  * Added a general ai goal reference update mode.
122  * 
123  * 21    6/18/97 11:46a Hoffoss
124  * Fixed initial order object reference updating and added briefing dialog
125  * window tracking data.
126  *
127  * $NoKeywords: $
128  */
129
130 #ifndef _AIGOALS_H
131 #define _AIGOALS_H
132
133 #include "ai.h"
134 #include "cfile.h"
135
136 // macros for goals which get set via sexpressions in the mission code
137
138 // IMPORTANT!  If you add a new AI_GOAL_x define, be sure to update the functions
139 // ai_update_goal_references() and query_referenced_in_ai_goals() or else risk breaking
140 // Fred.  If the goal you add doesn't have a target (such as chase_any), then you don't have
141 // to worry about doing this.  Also add it to list in Fred\Management.cpp, and let Hoffoss know!
142 #define AI_GOAL_CHASE                                   (1<<1)
143 #define AI_GOAL_DOCK                                            (1<<2)          // used for undocking as well
144 #define AI_GOAL_WAYPOINTS                               (1<<3)
145 #define AI_GOAL_WAYPOINTS_ONCE          (1<<4)
146 #define AI_GOAL_WARP                                            (1<<5)
147 #define AI_GOAL_DESTROY_SUBSYSTEM       (1<<6)
148 #define AI_GOAL_FORM_ON_WING                    (1<<7)
149 #define AI_GOAL_UNDOCK                                  (1<<8)
150 #define AI_GOAL_CHASE_WING                              (1<<9)
151 #define AI_GOAL_GUARD                                   (1<<10)
152 #define AI_GOAL_DISABLE_SHIP                    (1<<11)
153 #define AI_GOAL_DISARM_SHIP                     (1<<12)
154 #define AI_GOAL_CHASE_ANY                               (1<<13)
155 #define AI_GOAL_IGNORE                                  (1<<14)
156 #define AI_GOAL_GUARD_WING                              (1<<15)
157 #define AI_GOAL_EVADE_SHIP                              (1<<16)
158
159 // the next goals are for support ships only
160 #define AI_GOAL_STAY_NEAR_SHIP          (1<<17)
161 #define AI_GOAL_KEEP_SAFE_DISTANCE      (1<<18)
162 #define AI_GOAL_REARM_REPAIR                    (1<<19)
163
164 #define AI_GOAL_STAY_STILL                              (1<<20)
165 #define AI_GOAL_PLAY_DEAD                               (1<<21)
166 #define AI_GOAL_CHASE_WEAPON                    (1<<22)
167
168 // now the masks for ship types
169
170 #define AI_GOAL_ACCEPT_FIGHTER          ( 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_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
171 #define AI_GOAL_ACCEPT_BOMBER                   ( AI_GOAL_ACCEPT_FIGHTER )
172 #define AI_GOAL_ACCEPT_STEALTH          ( AI_GOAL_ACCEPT_FIGHTER )
173 #define AI_GOAL_ACCEPT_TRANSPORT                ( 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)
174 #define AI_GOAL_ACCEPT_FREIGHTER                ( AI_GOAL_ACCEPT_TRANSPORT )
175 #define AI_GOAL_ACCEPT_CRUISER          ( AI_GOAL_ACCEPT_FREIGHTER )
176 #define AI_GOAL_ACCEPT_CORVETTE         ( AI_GOAL_ACCEPT_CRUISER )
177 #define AI_GOAL_ACCEPT_GAS_MINER                ( AI_GOAL_ACCEPT_CRUISER )
178 #define AI_GOAL_ACCEPT_AWACS                    ( AI_GOAL_ACCEPT_CRUISER )
179 #define AI_GOAL_ACCEPT_CAPITAL          ( AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) )
180 #define AI_GOAL_ACCEPT_SUPERCAP         ( AI_GOAL_ACCEPT_CAPITAL )
181 #define AI_GOAL_ACCEPT_SUPPORT          ( 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)
182 #define AI_GOAL_ACCEPT_ESCAPEPOD                ( AI_GOAL_ACCEPT_TRANSPORT )
183
184 #define MAX_AI_DOCK_NAMES                               25
185
186 extern int Num_ai_dock_names;
187 extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
188
189 extern char *Ai_goal_text(int goal);
190
191 // extern function definitions
192 extern void ai_post_process_mission();
193 extern void ai_maybe_add_form_goal( wing *wingp );
194 extern void ai_process_mission_orders( int objnum, ai_info *aip );
195
196 // adds goals to ships/wing through sexpressions
197 extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
198 extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
199 extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp );
200
201 // adds goals to ships/sings through player orders
202 extern void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
203 extern void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum );
204
205 extern void ai_remove_ship_goal( ai_info *aip, int index );
206 extern void ai_clear_ship_goals( ai_info *aip );
207 extern void ai_clear_wing_goals( int wingnum );
208
209 extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
210
211 extern void ai_mission_goal_complete( ai_info *aip );
212 extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
213
214 extern int ai_get_subsystem_type( char *subsystem );
215 extern char *ai_get_subsystem_type_name(int type);
216 extern void ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name);
217 extern int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name);
218 extern char *ai_add_dock_name(char *str);
219
220 extern int ai_query_goal_valid( int ship, int ai_goal );
221
222 extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
223 extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
224
225 #endif
226