]> icculus.org git repositories - taylor/freespace2.git/blob - include/hudsquadmsg.h
fix issue with looping audio streams
[taylor/freespace2.git] / include / hudsquadmsg.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/Hud/HUDsquadmsg.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * header file for squadmate messaging
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:13  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  * 3     3/30/99 5:40p Dave
26  * Fixed reinforcements for TvT in multiplayer.
27  * 
28  * 2     10/07/98 10:53a Dave
29  * Initial checkin.
30  * 
31  * 1     10/07/98 10:49a Dave
32  * 
33  * 26    9/11/98 2:05p Allender
34  * make reinforcements work correctly in multiplayer games.  There still
35  * may be a team vs team issue that I haven't thought of yet :-(
36  * 
37  * 25    5/19/98 12:19p Mike
38  * Cheat codes!
39  * 
40  * 24    5/13/98 5:09p Allender
41  * Make send_command functions return whether message was sent or not
42  * 
43  * 23    5/04/98 8:58a Allender
44  * new key saving routine
45  * 
46  * 22    4/22/98 4:59p Allender
47  * new multiplayer dead popup.  big changes to the comm menu system for
48  * team vs. team.  Start of debriefing stuff for team vs. team  Make form
49  * on my wing work with individual ships who have high priority orders
50  * 
51  * 21    4/13/98 12:51p Allender
52  * made countermeasure succeed indicator work in multiplayer.  Make rearm
53  * shortcut work more appropriately.
54  * 
55  * 20    2/26/98 4:21p John
56  * Changed comm_orders around so I could externalize the strings
57  * 
58  * 19    2/20/98 8:34p Lawrance
59  * added hud_squadmsg_reinforcements_available(), since this information
60  * is required outside of hudsquadmsg
61  * 
62  * 18    2/11/98 9:44p Allender
63  * rearm repair code fixes.  hud support view shows abort status.  New
64  * support ship killed message.  More network stats
65  * 
66  * 17    11/20/97 12:08a Allender
67  * added 'all fighters' option at top level menu.  cleaned up messaging to
68  * player a little bit
69  * 
70  * 16    11/07/97 4:35p Dave
71  * Fixed multiplayer support ship bug. Put in player kill/assists client
72  * side stats update.
73  * 
74  * 15    11/03/97 10:09a Allender
75  * fixed up graying out of comm menu options
76  * 
77  * 14    10/31/97 4:59p Allender
78  * remove protect_ship from list of filtered orders
79  * 
80  * 13    10/31/97 4:33p Allender
81  * fix bogus repair message.  gray out messages based on players target
82  * 
83  * 12    9/30/97 5:07p Dave
84  * Adapted messaging to correctly work with client-server situations in
85  * multiplayer.
86  * 
87  * 11    9/23/97 4:34p Allender
88  * made squadmessaging use main keyboard reading loop instead of separate
89  * key_inkey()
90  * 
91  * 10    9/18/97 5:21p Hoffoss
92  * Added column breaks for message list in sexp trees, and added code for
93  * orders sexp.
94  * 
95  * 9     7/25/97 9:52a Allender
96  * added order dialog to Fred for designer to choose which orders for ship
97  * to accept/ignore.  Code in ship_create to set up variables for Fred use
98  * instead of Freespace use (for destroying ships before mission starts)
99  * 
100  * 8     6/16/97 2:58p Allender
101  * added ignore my target order to player's comm menu.  Fixed a couple of
102  * problem when trying to message wings
103  * 
104  * 7     4/30/97 2:32p Allender
105  * add ability to message enemies as debug tool
106  * 
107  * 6     4/07/97 3:50p Allender
108  * ability to assign > 1 ship to a hotkey.  Enabled use of hotkeys in
109  * squadmate messaging
110  * 
111  * 5     4/05/97 3:46p Allender
112  * lots 'o messaging stuff.  Make shortcut keys for squadmate messaging
113  * work.  Make menus a little more dynamic
114  * 
115  * 4     2/06/97 1:49p Allender
116  * more messaging stuff -- most menus printout out stuff -- nothing
117  * functional in terms of action
118  * 
119  * 3     2/03/97 4:50p Allender
120  * saving/restoring of keys used for messaging mode
121  * 
122  * 2     1/31/97 9:38a Allender
123  * checkpoint for sqaudmate messaging
124  * 
125  * 1     1/24/97 2:18p Allender
126  *
127  * $NoKeywords: $
128  */
129
130 #ifndef _HUD_SQUADMSG
131 #define _HUD_SQUADMSG
132
133 #include "multi.h"
134
135 // defines for messages that can be sent from the player.  Defined at bitfields so that we can enable
136 // and disable messages on a message by message basis
137 #define ATTACK_TARGET_ITEM              (1<<0)
138 #define DISABLE_TARGET_ITEM     (1<<1)
139 #define DISARM_TARGET_ITEM              (1<<2)
140 #define PROTECT_TARGET_ITEM     (1<<3)
141 #define IGNORE_TARGET_ITEM              (1<<4)
142 #define FORMATION_ITEM                  (1<<5)
143 #define COVER_ME_ITEM                   (1<<6)
144 #define ENGAGE_ENEMY_ITEM               (1<<7)
145 #define CAPTURE_TARGET_ITEM     (1<<8)
146
147 // the next are for the support ship only
148 #define REARM_REPAIR_ME_ITEM            (1<<9)
149 #define ABORT_REARM_REPAIR_ITEM (1<<10)
150 #define STAY_NEAR_ME_ITEM                       (1<<11)
151 #define STAY_NEAR_TARGET_ITEM           (1<<12)
152 #define KEEP_SAFE_DIST_ITEM             (1<<13)
153
154 // next item for all ships again -- to try to preserve relative order within the message menu
155 #define DEPART_ITEM                                     (1<<14)
156 #define DISABLE_SUBSYSTEM_ITEM  (1<<15)
157
158 #define MAX_SHIP_ORDERS                         13                      // Must sync correctly with Comm_orders array in HUDsquadmsg.cpp
159
160 // following defines are the set of possible commands that can be given to a ship.  A mission designer
161 // might not allow some messages
162
163 #define FIGHTER_MESSAGES        (ATTACK_TARGET_ITEM | DISABLE_TARGET_ITEM | DISARM_TARGET_ITEM | PROTECT_TARGET_ITEM | IGNORE_TARGET_ITEM | FORMATION_ITEM | COVER_ME_ITEM | ENGAGE_ENEMY_ITEM | DEPART_ITEM | DISABLE_SUBSYSTEM_ITEM)
164
165 #define BOMBER_MESSAGES         FIGHTER_MESSAGES                        // bombers can do the same things as fighters
166
167 #define TRANSPORT_MESSAGES      (ATTACK_TARGET_ITEM | CAPTURE_TARGET_ITEM | DEPART_ITEM )
168 #define FREIGHTER_MESSAGES      TRANSPORT_MESSAGES              // freighters can do the same things as transports
169
170 #define CRUISER_MESSAGES        (ATTACK_TARGET_ITEM | DEPART_ITEM)
171
172 #define CAPITAL_MESSAGES        (DEPART_ITEM)                           // can't order capitals to do much!!!!
173
174 #define SUPPORT_MESSAGES        (REARM_REPAIR_ME_ITEM | ABORT_REARM_REPAIR_ITEM | STAY_NEAR_ME_ITEM | STAY_NEAR_TARGET_ITEM | KEEP_SAFE_DIST_ITEM | DEPART_ITEM )
175
176 // these messages require an active target.  They are also the set of messages
177 // which cannot be given to a ship when the target is on the same team, or the target
178 // is not a ship.
179 #define ENEMY_TARGET_MESSAGES           (ATTACK_TARGET_ITEM | DISABLE_TARGET_ITEM | DISARM_TARGET_ITEM | IGNORE_TARGET_ITEM | STAY_NEAR_TARGET_ITEM | CAPTURE_TARGET_ITEM | DISABLE_SUBSYSTEM_ITEM )
180 #define FRIENDLY_TARGET_MESSAGES        (PROTECT_TARGET_ITEM)
181
182 #define TARGET_MESSAGES (ENEMY_TARGET_MESSAGES | FRIENDLY_TARGET_MESSAGES)
183
184
185 #define SQUADMSG_HISTORY_MAX 160
186
187 typedef struct squadmsg_history {
188         int ship;  // ship that received the order
189         int order;  // order that the ship received (see defines above)
190         int target;  // ship that is the target of the order
191
192         squadmsg_history() :
193                 ship(-1), order(-1), target(-1)
194         {
195         }
196 } squadmsg_history;
197
198 extern int squadmsg_history_index;
199 extern squadmsg_history Squadmsg_history[SQUADMSG_HISTORY_MAX];
200
201 extern int Multi_squad_msg_local;
202 extern int Multi_squad_msg_targ; 
203
204 extern void hud_init_squadmsg();
205 extern void hud_squadmsg_toggle();                                              // toggles the state of messaging mode
206 extern void hud_squadmsg_shortcut( int command );       // use of a shortcut key
207 extern int hud_squadmsg_hotkey_select( int k ); // a hotkey was hit -- maybe send a message to those ship(s)
208 extern void hud_squadmsg_save_keys( int do_scroll = 0 );                                        // saves into local area keys which need to be saved/restored when in messaging mode
209 extern int hud_squadmsg_do_frame();
210 extern int hud_query_order_issued(const char *name, const char *order, const char *target);
211 extern int hud_squadmsg_read_key( int k );                      // called from high level keyboard code
212
213 extern void hud_squadmsg_repair_rearm( int toggle_state, object *obj = NULL );
214 extern void hud_squadmsg_repair_rearm_abort( int toggle_state, object *obj = NULL );
215 extern void hud_squadmsg_rearm_shortcut();
216
217 extern int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, int player_num = -1 );
218 extern int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, int player_num = -1 );
219 extern void hud_squadmsg_send_to_all_fighters( int command, int player_num = -1 );
220 extern void hud_squadmsg_call_reinforcement(int reinforcement_num, int player_num = -1);
221
222 extern int hud_squadmsg_reinforcements_available(int team);
223
224 //#ifndef NDEBUG
225 void hud_enemymsg_toggle();                                             // debug function to allow messaging of enemies
226 //#endif
227
228 #endif
229