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