]> icculus.org git repositories - taylor/freespace2.git/blob - include/missionmessage.h
Initial revision
[taylor/freespace2.git] / include / missionmessage.h
1 /*
2  * $Logfile: /Freespace2/code/Mission/MissionMessage.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for mission messaging
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 8     9/06/99 10:13a Jasons
15  * Bump up MAX_PERSONAS from 10 to 13
16  * 
17  * 7     8/26/99 8:51p Dave
18  * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
19  * 
20  * 6     8/19/99 10:12a Alanl
21  * preload mission-specific messages on machines greater than 48MB
22  * 
23  * 5     7/31/99 2:30p Dave
24  * Added nifty mission message debug viewing keys.
25  * 
26  * 4     7/06/99 10:41a Andsager
27  * Add AWACS need help messages
28  * 
29  * 3     6/16/99 10:20a Dave
30  * Added send-message-list sexpression.
31  * 
32  * 2     10/07/98 10:53a Dave
33  * Initial checkin.
34  * 
35  * 1     10/07/98 10:49a Dave
36  * 
37  * 46    4/25/98 11:49p Lawrance
38  * Add Terran Command stray messages
39  * 
40  * 45    4/15/98 4:18p Allender
41  * Make Terran Command who_from be just Command
42  * 
43  * 44    4/08/98 3:45p Allender
44  * mission message overhaul.  Make message from any wingman mean any
45  * wingman with that persona.  Terran command wave and ani's for dead
46  * ships now play correctly.
47  * 
48  * 43    4/07/98 12:04a Mike
49  * New system for instructor chastising player if he fires at instructor.
50  * 
51  * 42    4/02/98 10:07a Allender
52  * wing arrival message for delta and epsilon wings
53  * 
54  * 41    4/01/98 10:47p Lawrance
55  * Supporting builtin messages for rearm and repair requests
56  * 
57  * 40    2/20/98 8:33p Lawrance
58  * Add the 'All Alone' message
59  * 
60  * 39    2/12/98 4:58p Lawrance
61  * Add support for 'All Clear' radio message
62  * 
63  * 38    2/11/98 9:44p Allender
64  * rearm repair code fixes.  hud support view shows abort status.  New
65  * support ship killed message.  More network stats
66  * 
67  * 37    1/29/98 11:38a Allender
68  * support for Vasudan personas
69  * 
70  * 36    1/28/98 11:38a Dan
71  * AL: bump up MAX_MISSION_MESSAGES to 300 from 200.
72  * 
73  * 35    1/21/98 7:20p Lawrance
74  * Make subsystem locking only work with line-of-sight, cleaned up locking
75  * code, moved globals to player struct.
76  * 
77  * 34    1/18/98 9:51p Lawrance
78  * Add support for 'Player Died' messages.
79  * 
80  * 33    1/14/98 9:49p Allender
81  * removed 3'oclock and 9'oclock messages
82  * 
83  * 32    1/13/98 3:11p Allender
84  * new messages for disable/disarm
85  * 
86  * 31    1/07/98 4:41p Allender
87  * minor modification to special messages.  Fixed cargo_revealed problem
88  * for multiplayer and problem with is-cargo-known sexpression
89  * 
90  * 30    12/01/97 5:10p Lawrance
91  * 
92  * 29    11/25/97 5:00p Allender
93  * big changed in the messaging code -- implemented "timouts" -- windows
94  * in which messages need to be played, or they are pitched
95  * 
96  * 28    11/21/97 4:09p Allender
97  * added "Command" persona
98  * 
99  * 27    11/20/97 5:06p Allender
100  * personas have types.  personas should now correctly get assigned to the
101  * appropriate ship type.
102  * 
103  * 26    11/17/97 6:38p Lawrance
104  * added message_anim_is_playing()
105  * 
106  * 25    11/17/97 4:57p Allender
107  * persona support in FreeSpace
108  * 
109  * 24    11/14/97 3:52p Allender
110  * removed '#' from TERRAN_COMMAND define
111  * 
112  * 23    11/11/97 4:57p Dave
113  * Put in support for single vs. multiplayer pilots. Began work on
114  * multiplayer campaign saving. Put in initial player select screen
115  * 
116  * 22    11/07/97 11:50a Allender
117  * fixed ai_destroy_ship to know whether ship was actually destroyed or
118  * just departed.  Fixed messages for making player hammer of light
119  * 
120  * 21    11/05/97 7:11p Hoffoss
121  * Made changed to the hud message system.  Hud messages can now have
122  * sources so they can be color coded.
123  * 
124  * 20    10/29/97 9:31p Allender
125  * more rearm stuff.  Give player more apprioriate message when ship
126  * already on way.  Don't count arriving ship as in the mission yet (for
127  * find_support_ship() ).  
128  * 
129  * 19    10/23/97 9:40p Allender
130  * more repari/rearm stuff.  Warped in support ships now go directly to
131  * ship who they warped in for.  Player gets (hud only) message when
132  * support ship warping in
133  * 
134  * 18    10/16/97 8:52p Duncan
135  * Raised limit on messages to 100.
136  * 
137  * 17    10/13/97 7:40p Lawrance
138  * have received messages get distorted if comm subsystem is severely
139  * damaged
140  * 
141  * 16    10/10/97 5:02p Allender
142  * started rudimentary work on personas
143  * 
144  * 15    10/09/97 4:44p Hoffoss
145  * Dimmed training window glass and made it less transparent, added flags
146  * to events, set he stage for detecting current events.
147  * 
148  * 14    10/02/97 9:53p Hoffoss
149  * Added event evaluation analysis debug screen so we can determine the
150  * state of events and their sexp trees to track down logic problems and
151  * such.
152  * 
153  * 13    9/29/97 4:17p Duncan
154  * Raised limit on number of waves and avis a single mission can utilize.
155  * 
156  * 12    9/22/97 4:55p Hoffoss
157  * Added a training message window display thingy.
158  * 
159  * 11    8/04/97 11:17a Mike
160  * Make rearm process abort if speed gets too high.
161  * 
162  * 10    5/15/97 11:46a Lawrance
163  * play wingmen heads as anim's
164  * 
165  * 9     4/23/97 2:37p Lawrance
166  * added message_is_playing() function
167  * 
168  * 8     4/08/97 10:55a Allender
169  * draw purple brackets on ship sending a message
170  * 
171  * 7     3/13/97 10:57a Allender
172  * new mission messages
173  * 
174  * 6     3/11/97 10:14a Allender
175  * added unions for wave/avi files in messages to make things easier for
176  * Fred.  Freespace will use the avi/wave indexing system.   Fred will use
177  * only names
178  * 
179  * 5     3/10/97 4:16p Allender
180  * new messaging system.  builtin5 fixed to support it.  made new sound
181  * function to determine if sound is still playing.
182  * 
183  * 4     3/09/97 2:23p Allender
184  * Major changes to player messaging system.  Added messages.tbl.  Made
185  * all currently player messages go through new system.  Not done yet.
186  * 
187  * 3     1/08/97 11:45p Lawrance
188  * moved some typedefs and defines to header file so visible for
189  * save/restore
190  * 
191  * 2     12/17/96 1:02p Allender
192  * rudimentary messaging working
193  * 
194  * 1     12/12/96 4:37p Allender
195  *
196  * $NoKeywords: $
197  */
198
199 #ifndef _MISSIONMESSAGE_H
200 #define _MISSIONMESSAGE_H
201
202 #include "ship.h"
203 #include "parselo.h"                    // include so that we can gets defs for lengths of tokens
204 #include "animplay.h"
205
206
207 #define MAX_MISSION_MESSAGES    300
208
209 // keep seperate lists of AVI's and wav files.  I suspect that many messages will have
210 // duplicate avi's for different messages.  Seperate list for wave files since some messages
211 // might not have wave file information.
212
213 typedef struct message_avi {
214         char                            name[MAX_FILENAME_LEN];
215         int                             num;
216         anim                            *anim_data;
217 } message_extra;
218
219 #define MAX_MESSAGE_AVIS                MAX_MISSION_MESSAGES
220 extern int              Num_message_avis;
221 extern message_extra    Message_avis[MAX_MESSAGE_AVIS];
222
223 #define MAX_MESSAGE_WAVES               MAX_MISSION_MESSAGES
224 extern int              Num_message_waves;
225 extern message_extra            Message_waves[MAX_MESSAGE_WAVES];
226
227 // defines for message priorities
228 #define MESSAGE_PRIORITY_LOW            1
229 #define MESSAGE_PRIORITY_NORMAL 2
230 #define MESSAGE_PRIORITY_HIGH           3
231
232 // defines for how quickly we should send a message
233 #define MESSAGE_TIME_IMMEDIATE  1
234 #define MESSAGE_TIME_SOON                       2
235 #define MESSAGE_TIME_ANYTIME            3
236
237 // sources for messages
238 #define MESSAGE_SOURCE_SHIP             1
239 #define MESSAGE_SOURCE_WINGMAN  2
240 #define MESSAGE_SOURCE_COMMAND  3
241 #define MESSAGE_SOURCE_SPECIAL  4
242
243 // define used for sender of a message when you want it to be Terran Command
244 #define TERRAN_COMMAND                  "Command"
245
246 // defines for message id's used in Freespace code.  Callers to message_send_to_player() should
247 // probably use these defines.
248
249 // this number in this define should match the number of elements in the next array
250 #define MAX_BUILTIN_MESSAGE_TYPES       41
251
252 extern char *Builtin_message_types[MAX_BUILTIN_MESSAGE_TYPES];
253
254 #define MESSAGE_ARRIVE_ENEMY            0
255 #define MESSAGE_ATTACK_TARGET           1
256 #define MESSAGE_BETA_ARRIVED            2
257 #define MESSAGE_CHECK_6                         3
258 #define MESSAGE_ENGAGE                          4
259 #define MESSAGE_GAMMA_ARRIVED           5
260 #define MESSAGE_HELP                                    6
261 #define MESSAGE_PRAISE                          7
262 #define MESSAGE_REINFORCEMENTS  8
263 #define MESSAGE_IGNORE                          9
264 #define MESSAGE_NOSIR                           10
265 #define MESSAGE_OOPS                                    11
266 #define MESSAGE_PERMISSION                      12
267 #define MESSAGE_STRAY                           13
268 #define MESSAGE_WARP_OUT                        14
269 #define MESSAGE_YESSIR                          15
270 #define MESSAGE_REARM_ON_WAY            16
271 #define MESSAGE_ON_WAY                          17
272 #define MESSAGE_REARM_WARP                      18
273 #define MESSAGE_NO_TARGET                       19
274 #define MESSAGE_DOCK_YES                        20
275 #define MESSAGE_REPAIR_DONE             21
276 #define MESSAGE_REPAIR_ABORTED  22
277 #define MESSAGE_HAMMER_SWINE            23
278 #define MESSAGE_REARM_REQUEST           24              // wingman messages player when he calls a support ship
279 #define MESSAGE_DISABLE_TARGET  25
280 #define MESSAGE_DISARM_TARGET           26
281 #define MESSAGE_PLAYED_DIED             27              // message sent when player starts death roll
282 #define MESSAGE_WINGMAN_SCREAM  28
283 #define MESSAGE_SUPPORT_KILLED  29
284 #define MESSAGE_ALL_CLEAR                       30
285 #define MESSAGE_ALL_ALONE                       31              // message sent when player is last ship left and primary objectives still exist
286 #define MESSAGE_REPAIR_REQUEST  32
287 #define MESSAGE_DELTA_ARRIVED           33
288 #define MESSAGE_EPSILON_ARRIVED 34
289 #define MESSAGE_INSTRUCTOR_HIT  35
290 #define MESSAGE_INSTRUCTOR_ATTACK 36
291 #define MESSAGE_STRAY_WARNING                           37
292 #define MESSAGE_STRAY_WARNING_FINAL             38
293 #define MESSAGE_AWACS_75                        39
294 #define MESSAGE_AWACS_25                        40
295
296 typedef struct MissionMessage {
297         char    name[NAME_LENGTH];                                      // used to identify this message
298         char    message[MESSAGE_LENGTH];                        // actual message
299         int     persona_index;                                                  // which persona says this message
300         int     multi_team;                                                             // multiplayer team filter (important for TvT only)
301
302         // unions for avi/wave information.  Because of issues with Fred, we are using
303         // the union to specify either the index into the avi or wave arrays above,
304         // or refernce the name directly.  The currently plan is to only have Fred reference
305         // the name field!!!
306         union {
307                 int     index;                                                          // index of avi file to play
308                 char    *name;
309         } avi_info;
310
311         union {
312                 int     index;
313                 char    *name;
314         } wave_info;
315
316 } MMessage;
317
318 extern MMessage Messages[MAX_MISSION_MESSAGES];
319
320 extern int Num_messages;
321 extern int Num_builtin_messages;                                // from messages.tbl -- index of message location to load mission specific messages into
322 extern int Message_shipnum;                                     // used to display info on hud when message is sent
323
324 // variable, etc for persona information
325 #define MAX_PERSONAS            13
326 #define MAX_PERSONA_TYPES               4
327
328 // flags for personas.  the type flags must be sequential starting from 0, and must match
329 // the persona_type_names defined in missionmessage.cpp
330 #define PERSONA_FLAG_WINGMAN    (1<<0)
331 #define PERSONA_FLAG_SUPPORT    (1<<1)
332 #define PERSONA_FLAG_LARGE              (1<<2)          // for large ships
333 #define PERSONA_FLAG_COMMAND    (1<<3)          // for terran command
334 // be sure that MAX_PERSONA_TYPES is always 1 greater than the last type bitfield above!!!
335
336 #define PERSONA_FLAG_VASUDAN    (1<<30)
337 #define PERSONA_FLAG_USED               (1<<31)
338
339 typedef struct persona_s {
340         char    name[NAME_LENGTH];
341         int     flags;
342 } Persona;
343
344 extern Persona Personas[MAX_PERSONAS];
345 extern int Num_personas;
346
347 // function to parse a message from either messages.tbl or the mission file.  Both files have the
348 // exact same format, so this function just gets reused in both instances.
349 void    message_parse();
350 void    persona_parse();
351
352 void    messages_init();
353 void    message_mission_shutdown();
354 void    message_queue_process();
355 int     message_is_playing();
356 void    message_maybe_distort();
357 int     message_anim_is_playing();
358 void    message_kill_all( int kill_all );
359
360 void    message_queue_message( int message_num, int priority, int timing, char *who_from, int source, int group, int delay, int builtin_type=-1 );
361
362 // functions which send messages to player -- called externally
363 void    message_send_unique_to_player( char *id, void *data, int source, int priority, int group, int delay);
364 void    message_send_builtin_to_player( int type, ship *shipp, int priority, int timing, int group, int delay, int multi_target, int multi_team_filter );
365
366 // functions to deal with personas
367 int     message_persona_name_lookup( char *name );
368
369 // preload mission messages (this is called by the level paging code when running with low memory)
370 void message_pagein_mission_messages();
371
372 // given a message id#, should it be filtered for me?
373 int message_filter_multi(int id);
374
375 #endif
376