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