]> icculus.org git repositories - taylor/freespace2.git/blob - include/missionshipchoice.h
Initial revision
[taylor/freespace2.git] / include / missionshipchoice.h
1 /*
2  * $Logfile: /Freespace2/code/MissionUI/MissionShipChoice.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file to support functions that allow player ship selection for the mission
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 3     7/15/99 6:36p Jamesa
15  * Moved default ship name into the ships.tbl
16  * 
17  * 2     10/07/98 10:53a Dave
18  * Initial checkin.
19  * 
20  * 1     10/07/98 10:50a Dave
21  * 
22  * 21    3/05/98 5:03p Dave
23  * More work on team vs. team support for multiplayer. Need to fix bugs in
24  * weapon select.
25  * 
26  * 20    2/24/98 6:21p Lawrance
27  * Integrate new reset button into loadout screens
28  * 
29  * 19    2/18/98 3:56p Dave
30  * Several bugs fixed for mp team select screen. Put in standalone packet
31  * routing for team select.
32  * 
33  * 18    2/17/98 6:07p Dave
34  * Tore out old multiplayer team select screen, installed new one.
35  * 
36  * 17    1/15/98 4:11p Lawrance
37  * Add call to check if slot is player occupied.
38  * 
39  * 16    1/09/98 6:06p Dave
40  * Put in network sound support for multiplayer ship/weapon select
41  * screens. Made clients exit game correctly through warp effect. Fixed
42  * main hall menu help overlay bug.
43  * 
44  * 15    12/29/97 4:21p Lawrance
45  * Flash buttons on briefing/ship select/weapons loadout when enough time
46  * has elapsed without activity.
47  * 
48  * 14    12/24/97 1:19p Lawrance
49  * fix some bugs with the multiplayer ship/weapons loadout
50  * 
51  * 13    12/23/97 5:25p Allender
52  * more fixes to multiplayer ship selection.  Fixed strange reentrant
53  * problem with cf_callback when loading freespace data
54  * 
55  * 12    12/22/97 6:18p Lawrance
56  * Get save/restore of player loadout working with new code
57  * 
58  * 11    12/22/97 1:40a Lawrance
59  * Re-write ship select/weapons loadout to be multiplayer friendly
60  * 
61  * 10    12/19/97 1:23p Dave
62  * Put in multiplayer groundwork for new weapon/ship select screens.
63  * 
64  * 9     12/18/97 8:59p Dave
65  * Finished putting in basic support for weapon select and ship select in
66  * multiplayer.
67  * 
68  * 8     12/18/97 10:24a Lawrance
69  * Fix problem with ships having no weapons due to bogus weapons pools.
70  * 
71  * 7     12/08/97 9:37p Lawrance
72  * fix up auto-restore of player ship selection and weapons
73  * 
74  * 6     12/03/97 1:22p Lawrance
75  * implement saving/restoring of ship selection and weapons loadout
76  * 
77  * 5     12/02/97 10:51p Lawrance
78  * implement save/restore of ship selection and weapon loadouts
79  * 
80  * 4     11/27/97 10:03a Lawrance
81  * supporting SF_LOCKED flag
82  * 
83  * 3     10/04/97 5:56p Lawrance
84  * keep track of original ship class in ship selection
85  * 
86  * 2     10/04/97 12:00a Lawrance
87  * grey out background when help overlay is activated
88  * 
89  * 1     9/30/97 10:16a Lawrance
90  * move files from Mission lib to MissionUI lib
91  * 
92  * 34    9/25/97 3:49p Lawrance
93  * add a disabled icon to ship icon frame list
94  * 
95  * 33    9/24/97 11:43p Hoffoss
96  * Changed Parse_player to Team_data, removed the fields we don't want in
97  * it anymore, and fixed some code that had problems with that.
98  * 
99  * 32    9/24/97 5:03p Dave
100  * Spliced a bunch of stuff into MissionScreenCommon.[h,cpp]
101  * 
102  * 31    9/23/97 11:55p Lawrance
103  * add ss_return_name() function
104  * 
105  * 30    9/19/97 4:22p Allender
106  * externed some functions that multi team selection screen will use
107  * 
108  * 29    9/18/97 7:58a Lawrance
109  * fix some bugs associated with the player ship being created early on
110  * 
111  * 28    9/16/97 5:15p Allender
112  * fixed link problem with Fred
113  * 
114  * 27    9/07/97 10:04p Lawrance
115  * make drag/drop and selection work as Windows does with mouse-button up
116  * for selection
117  * 
118  * 26    8/30/97 12:24p Lawrance
119  * supporting animations in the weapons loadout screen, fixed some bugs
120  * 
121  * 25    8/29/97 7:33p Lawrance
122  * further work on weapons loadout
123  * 
124  * 24    8/24/97 5:24p Lawrance
125  * improve drawing of buttons 
126  * 
127  * 23    8/18/97 5:28p Lawrance
128  * integrating sounds for when mouse goes over an active control
129  * 
130  * 22    8/17/97 2:41p Lawrance
131  * improving interface
132  * 
133  * 21    8/15/97 8:00p Lawrance
134  * integrating new art for the briefing screens
135  * 
136  * 20    8/11/97 9:47p Lawrance
137  * get multiplayer chat window hooks working
138  * 
139  * 19    7/23/97 11:36a Lawrance
140  * support common buttons through the briefing/ship select/weapons
141  * loadout, be able to hide buttons when necessary
142  * 
143  * 18    7/21/97 11:41a Lawrance
144  * make playback time of .ani files keyed of frametime
145  * 
146  * 17    7/20/97 6:59p Lawrance
147  * changed name of some anim functions to be more consistent
148  * 
149  * 16    7/14/97 3:58p Lawrance
150  * limit frametime to 33 ms for animation timing
151  * 
152  * 15    6/26/97 12:12a Lawrance
153  * supporting anti-aliased bitmap animations
154  * 
155  * 14    6/24/97 11:46p Lawrance
156  * supporting icon text and rotating models
157  * 
158  * 13    6/12/97 11:09p Lawrance
159  * getting map and text integrated into briefing
160  * 
161  * 12    6/12/97 11:28a Lawrance
162  * separating FRED dependant code
163  * 
164  * 11    6/12/97 2:48a Lawrance
165  * integrating briefing into ship select / weapon loadout screen
166  * 
167  * 10    5/23/97 2:01p Lawrance
168  * added update_player_weapons()
169  * 
170  * 9     5/20/97 2:44p Allender
171  * move player ship creation into player_level_init which is done before
172  * most other things when a level loads
173  * 
174  * 8     3/28/97 12:09p Lawrance
175  * change create_default_player_ship() to allow the default to be the last
176  * ship the player has flown
177  * 
178  * 7     3/20/97 3:01p Lawrance
179  * made scroll buttons repeat action when held down, don't do button
180  * actions until down and release
181  * 
182  * 6     3/07/97 8:14p Lawrance
183  * added code to drag and drop to wing formations
184  * 
185  * 5     2/26/97 10:05a Lawrance
186  * move ship_create() to end of loop when commit pressed, so don't skip on
187  * animation
188  * 
189  * 4     2/25/97 11:11a Lawrance
190  * ship selection and weapon loadout interfaces working at basic level
191  * 
192  * 3     12/30/96 1:58a Lawrance
193  * supporting ship choice in multiplayer
194  * 
195  * 2     11/19/96 1:21p Lawrance
196  * got ship selection working inside out
197  *
198  * $NoKeywords: $
199  *
200 */
201
202 #ifndef __MISSIONSHIPCHOICE_H__
203 #define __MISSIONSHIPCHOICE_H__
204
205 #include "missionscreencommon.h"
206 #include "missionparse.h"
207
208 ///////////////////////////////////////////////////////
209 // Ships selection hot spots
210 ///////////////////////////////////////////////////////
211 #define SHIP_SELECT_SHIP_SCROLL_UP                              8
212 #define SHIP_SELECT_SHIP_SCROLL_DOWN                    9
213
214 #define SHIP_SELECT_ICON_0                                                      10
215 #define SHIP_SELECT_ICON_1                                                      11
216 #define SHIP_SELECT_ICON_2                                                      12
217 #define SHIP_SELECT_ICON_3                                                      13
218
219 #define WING_0_SHIP_0                                                           14
220 #define WING_0_SHIP_1                                                           15
221 #define WING_0_SHIP_2                                                           16
222 #define WING_0_SHIP_3                                                           17
223 #define WING_1_SHIP_0                                                           18
224 #define WING_1_SHIP_1                                                           19
225 #define WING_1_SHIP_2                                                           20
226 #define WING_1_SHIP_3                                                           21
227 #define WING_2_SHIP_0                                                           22
228 #define WING_2_SHIP_1                                                           23
229 #define WING_2_SHIP_2                                                           24
230 #define WING_2_SHIP_3                                                           25
231
232 #define SHIP_SELECT_RESET                                                       39
233
234 #define NUM_SHIP_SELECT_REGIONS                                 (NUM_COMMON_REGIONS + 19)
235
236 extern int Ship_select_open;    // This game-wide global flag is set to 1 to indicate that the ship
237                                                                                 // select screen has been opened and memory allocated.  This flag
238                                                                                 // is needed so we can know if ship_select_close() needs to called if
239                                                                                 // restoring a game from the Options screen invoked from ship select
240
241 extern int Commit_pressed;      // flag to indicate that the commit button was pressed
242                                                                         // use a flag, so the ship_create() can be done at the end of the loop
243
244 extern char default_player_ship[255];
245 extern int Select_default_ship;
246
247 void draw_wing_block(int wb_num, int hot_slot, int selected_slot, int class_select);
248 void ship_select_init();
249 void ship_select_do(float frametime);
250 void ship_select_close();
251 void ship_select_common_init();
252 void ship_stop_animation();
253 int ss_get_ship_class(int ship_entry_index);
254 int ss_get_selected_ship();
255
256 void ss_blit_ship_icon(int x,int y,int ship_class,int bmap_num);
257
258 // called from weapon select
259 int     ss_return_ship(int wing_block, int wing_slot, int *ship_index, p_object **ppobjp);
260 void    ss_return_name(int wing_block, int wing_slot, char *name);
261 int     ss_return_original_ship_class(int slot_num);
262 int     ss_return_saindex(int slot_num);
263 int     ss_disabled_slot(int slot_num);
264 int     ss_wing_slot_is_console_player(int index);
265
266 // lock/unlock any necessary slots for multiplayer
267 void ss_recalc_multiplayer_slots();
268
269 int     create_default_player_ship( int use_last_flown = 1 );
270 void    update_player_ship(int si_index);
271
272 void ss_synch_interface();
273
274 // set the necessary pointers
275 void ss_set_team_pointers(int team);
276
277 // called by multiplayer team select to set the slot based flags
278 void ss_make_slot_empty(int slot_index);
279 void ss_make_slot_full(int slot_index);
280
281 int ss_dump_to_list(int from_slot, int to_list, int *sound);
282 int ss_swap_slot_slot(int from_slot, int to_slot, int *sound);
283 int ss_grab_from_list(int from_list, int to_slot, int *sound);
284 int ss_swap_list_slot(int from_list, int to_slot, int *sound);
285
286 void ss_apply(int mode, int from_slot,int from_index,int to_slot,int to_index,int player_index = -1);
287 void ss_drop(int from_slot,int from_index,int to_slot,int to_index,int player_index = -1);
288
289 #endif  /* __MISSIONSHIPCHOICE_H__ */
290