]> icculus.org git repositories - taylor/freespace2.git/blob - include/missionbriefcommon.h
Initial revision
[taylor/freespace2.git] / include / missionbriefcommon.h
1 /*
2  * $Logfile: /Freespace2/code/Mission/MissionBriefCommon.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for briefing stuff common to FreeSpace and FRED
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 10    8/24/99 11:30a Jefff
15  * Increased number of debriefing lines
16  * 
17  * 9     7/20/99 7:09p Jefff
18  * briefing text occupies full window in 1024x768
19  * 
20  * 8     7/19/99 3:01p Dave
21  * Fixed icons. Added single transport icon.
22  * 
23  * 7     7/18/99 5:20p Dave
24  * Jump node icon. Fixed debris fogging. Framerate warning stuff.
25  * 
26  * 6     7/09/99 5:54p Dave
27  * Seperated cruiser types into individual types. Added tons of new
28  * briefing icons. Campaign screen.
29  * 
30  * 5     6/29/99 7:39p Dave
31  * Lots of small bug fixes.
32  * 
33  * 4     1/30/99 4:03p Johnson
34  * Include #defines for Fred
35  * 
36  * 3     1/29/99 4:17p Dave
37  * New interface screens.
38  * 
39  * 2     10/07/98 10:53a Dave
40  * Initial checkin.
41  * 
42  * 1     10/07/98 10:49a Dave
43  * 
44  * 71    6/10/98 6:47p Lawrance
45  * increase MAX_RECOMMENDATION_LEN to 1024, to accommodate other languages
46  * 
47  * 70    4/25/98 3:49p Lawrance
48  * Save briefing auto-advance pref
49  * 
50  * 69    4/20/98 3:53p Lawrance
51  * Fix various bugs with auto-advancing through briefings.
52  * 
53  * 68    4/15/98 10:27a Sandeep
54  * 
55  * 67    4/13/98 7:06p Lawrance
56  * implement auto advance of briefing stages
57  * 
58  * 66    4/06/98 2:51p Hoffoss
59  * Added sexp for briefing to FreeSpace.
60  * 
61  * 65    4/03/98 5:22p Hoffoss
62  * Changes: training missions don't show objectives anymore, text for
63  * objective stage is different than last briefing stage now, and
64  * objectives have a black background now.
65  * 
66  * 64    4/03/98 10:31a John
67  * Made briefing and debriefing arrays be malloc'd
68  * 
69  * 63    4/01/98 8:38p Lawrance
70  * Add support for jump node icons in the briefings.
71  * 
72  * 62    3/26/98 5:47p Lawrance
73  * remove icon text functionality
74  * 
75  * 61    3/17/98 4:13p Hoffoss
76  * finessed the coordinates of the text window in the briefing screen a
77  * little to improve visual quality.
78  * 
79  * 60    3/12/98 4:04p Hoffoss
80  * Changed text window size and spaced text out an extra pixel.
81  * 
82  * 59    3/09/98 12:13a Lawrance
83  * Add support for Red Alert missions
84  * 
85  * 58    3/07/98 11:50a Lawrance
86  * Fix bug with displaying the closeup title
87  * 
88  * 57    3/05/98 9:38p Hoffoss
89  * Finished up command brief screen.
90  * 
91  * 56    3/05/98 10:39a Hoffoss
92  * Added command brief stuff.
93  * 
94  * 55    2/26/98 4:59p Allender
95  * groundwork for team vs team briefings.  Moved weaponry pool into the
96  * Team_data structure.  Added team field into the p_info structure.
97  * Allow for mutliple structures in the briefing code.
98  * 
99  * 54    2/24/98 6:21p Lawrance
100  * Fix up map grid region
101  * 
102  * 53    2/24/98 12:22a Lawrance
103  * New coords for revamped briefing graphics
104  * 
105  * 52    2/18/98 6:45p Hoffoss
106  * Added support for lines between icons in briefings for Fred.
107  * 
108  * 51    2/13/98 5:16p Lawrance
109  * Add support for icon lines in the briefing.
110  * 
111  * 50    2/09/98 9:25p Allender
112  * team v team support.  multiple pools and breifings
113  * 
114  * 49    2/06/98 4:32p Lawrance
115  * Allow briefing voices to be toggled on/off
116  * 
117  * 48    2/04/98 4:32p Allender
118  * support for multiple briefings and debriefings.  Changes to mission
119  * type (now a bitfield).  Bitfield defs for multiplayer modes
120  * 
121  * 47    1/28/98 7:22p Lawrance
122  * Put back in highlight member in brief_icon for FRED compatability.
123  * 
124  * 46    1/28/98 7:19p Lawrance
125  * Get fading/highlighting animations working
126  * 
127  * 45    10/19/97 5:14p Lawrance
128  * add flags member to brief_stage
129  * 
130  * 44    10/15/97 4:45p Lawrance
131  * implement scene cut in debriefing
132  * 
133  * 43    10/13/97 7:40p Lawrance
134  * implement new debriefing/recommendation format
135  * 
136  * 42    10/04/97 12:00a Lawrance
137  * grey out background when help overlay is activated
138  * 
139  * 41    10/03/97 8:25a Lawrance
140  * be able to pause brief narration
141  * 
142  * 40    10/01/97 4:39p Lawrance
143  * move chat code into Chatbox.cpp, simplify interface
144  *
145  * $NoKeywords: $
146  */
147
148 #ifndef __MISSIONBRIEFCOMMON_H__
149 #define __MISSIONBRIEFCOMMON_H__
150
151 #include "packunpack.h"
152 #include "hud.h"
153
154 #define MAX_TEXT_STREAMS        2               // how many concurrent streams of text can be displayed
155
156 // ------------------------------------------------------------------------
157 // names for the icons that can appear in the briefing.  If you modify this list,
158 // update the Icons_names[] string array located in MissionParse.cpp
159 // ------------------------------------------------------------------------
160 #define MAX_BRIEF_ICONS                                         35              // keep up to date
161
162 #define ICON_FIGHTER                                                    0
163 #define ICON_FIGHTER_WING                                       1
164 #define ICON_CARGO                                                      2
165 #define ICON_CARGO_WING                                         3
166 #define ICON_LARGESHIP                                          4
167 #define ICON_LARGESHIP_WING                             5
168 #define ICON_CAPITAL                                                    6
169 #define ICON_PLANET                                                     7
170 #define ICON_ASTEROID_FIELD                             8
171 #define ICON_WAYPOINT                                           9
172 #define ICON_SUPPORT_SHIP                                       10
173 #define ICON_FREIGHTER_NO_CARGO                 11
174 #define ICON_FREIGHTER_WITH_CARGO               12
175 #define ICON_FREIGHTER_WING_NO_CARGO    13
176 #define ICON_FREIGHTER_WING_WITH_CARGO  14
177 #define ICON_INSTALLATION                                       15
178 #define ICON_BOMBER                                                     16
179 #define ICON_BOMBER_WING                                        17
180 #define ICON_CRUISER                                                    18
181 #define ICON_CRUISER_WING                                       19
182 #define ICON_UNKNOWN                                                    20
183 #define ICON_UNKNOWN_WING                                       21
184 #define ICON_FIGHTER_PLAYER                             22
185 #define ICON_FIGHTERW_PLAYER                            23
186 #define ICON_BOMBER_PLAYER                                      24
187 #define ICON_BOMBERW_PLAYER                             25
188 #define ICON_KNOSSOS_DEVICE                             26
189 #define ICON_TRANSPORT_WING                             27
190 #define ICON_CORVETTE                                           28
191 #define ICON_GAS_MINER                                          29
192 #define ICON_AWACS                                                      30
193 #define ICON_SUPERCAP                                           31
194 #define ICON_SENTRYGUN                                          32
195 #define ICON_JUMP_NODE                                          33
196 #define ICON_TRANSPORT                                          34
197
198 // ------------------------------------------------------------------------
199 // Structures to hold briefing data
200 // ------------------------------------------------------------------------
201
202 #define MAX_BRIEF_LEN                   4096            // size of char array which holds briefing text
203 #define MAX_BRIEF_LINES         50
204 #define MAX_BRIEF_LINE_LEN      256             // max number of chars in a briefing line
205 #define MAX_BRIEF_LINE_W_640            375             // max width of line in pixels in 640x480 mode
206 #define MAX_BRIEF_LINE_W_1024   600             // max width of line in pixels in 1024x768 mode
207
208 #define MAX_DEBRIEF_LEN         2048            // size of char array which holds debriefing text
209 #define MAX_DEBRIEF_LINES               60
210 #define MAX_DEBRIEF_LINE_LEN    256             // max number of chars in a debriefing line
211 #define MAX_DEBRIEF_LINE_W      500             // max width of line in pixels
212
213 #define MAX_ICON_TEXT_LEN                       1024            // max number of chars for icon info
214 #define MAX_ICON_TEXT_LINES             30
215 #define MAX_ICON_TEXT_LINE_LEN  256             // max number of chars in icon info line
216 #define MAX_ICON_TEXT_LINE_W            170             // max width of line in pixels
217
218 #define MAX_STAGE_ICONS                 20
219 #define MAX_BRIEF_STAGES                        15
220 #define MAX_DEBRIEF_STAGES              20
221 #define MAX_LABEL_LEN                           64
222
223 #define MAX_RECOMMENDATION_LEN  1024
224
225 #define         BI_HIGHLIGHT            (1<<0)
226 #define         BI_SHOWHIGHLIGHT        (1<<1)
227 #define         BI_FADEIN                       (1<<2)
228
229 typedef struct brief_icon
230 {
231         int             x,y,w,h;
232         int             hold_x, hold_y; // 2D screen position of icon, used to place animations
233         int             ship_class;
234         int             modelnum;
235         float           radius;
236         int             type;                                   // ICON_* defines from MissionBriefCommon.h
237         int             bitmap_id;
238         int             id;
239         int             team;
240         vector  pos;
241         char            label[MAX_LABEL_LEN];
242         char            closeup_label[MAX_LABEL_LEN];
243 //      char            text[MAX_ICON_TEXT_LEN];
244         hud_anim        fadein_anim;
245         hud_anim        fadeout_anim;
246         hud_anim        highlight_anim;
247         int             flags;                          // BI_* flags defined above
248 } brief_icon;
249
250 #define MAX_BRIEF_STAGE_LINES           20
251
252 typedef struct brief_line
253 {
254         int start_icon;         // index into icons[], where line starts
255         int end_icon;                   // index into icons[], where line ends
256 } brief_line;
257
258 #define BS_FORWARD_CUT          (1<<0)
259 #define BS_BACKWARD_CUT         (1<<1)
260
261 typedef struct brief_stage
262 {
263         char                    *new_text;
264         char                    voice[MAX_FILENAME_LEN];
265         vector          camera_pos;
266         matrix          camera_orient;
267         int                     camera_time;            // ms
268         int                     flags;                          // see BS_ flags above
269         int                     formula;
270         int                     num_icons;
271         brief_icon      *icons;
272         int                     num_lines;
273         brief_line      *lines;
274 } brief_stage;
275
276 typedef struct debrief_stage
277 {
278         int                     formula;
279         char                    *new_text;
280         char                    voice[MAX_FILENAME_LEN];
281         char                    *new_recommendation_text;
282 } debrief_stage;
283
284 typedef struct briefing {
285         int                     num_stages;
286         brief_stage     stages[MAX_BRIEF_STAGES];
287 } briefing;
288
289 typedef struct debriefing {
290         int                             num_stages;
291         debrief_stage   stages[MAX_DEBRIEF_STAGES];
292 } debriefing;
293
294
295 // Code to free/init the above structures between levels:
296
297 // --------------------------------------------------------------------------------------
298 // Does one time initialization of the briefing and debriefing structures.
299 // Namely setting all malloc'ble pointers to NULL.  Called once at game startup.
300 void mission_brief_common_init();
301
302 //--------------------------------------------------------------------------------------
303 // Frees all the memory allocated in the briefing and debriefing structures
304 // and sets all pointers to NULL.
305 void mission_brief_common_reset();
306
307
308 // --------------------------------------------------------------------------------------
309 // briefing screen
310 // --------------------------------------------------------------------------------------
311 extern int Brief_bmap_coords[GR_NUM_RESOLUTIONS][2];
312 extern int Brief_grid_coords[GR_NUM_RESOLUTIONS][4];
313 extern int Brief_text_coords[GR_NUM_RESOLUTIONS][4];
314 extern int Brief_text_max_lines[GR_NUM_RESOLUTIONS];
315 extern char *Brief_static_name[GR_NUM_RESOLUTIONS];
316 extern int Brief_static_coords[GR_NUM_RESOLUTIONS][2];
317
318 // Needed for Fred
319 #define BRIEF_GRID3_X1                                          42
320 #define BRIEF_GRID3_Y1                                          122
321 #define BRIEF_GRID0_X2                                          585
322 #define BRIEF_GRID0_Y2                                          371
323 #define BRIEF_GRID_W                                                    (BRIEF_GRID0_X2-BRIEF_GRID3_X1+1)
324 #define BRIEF_GRID_H                                                    (BRIEF_GRID0_Y2-BRIEF_GRID3_Y1+1)
325 /*
326 #define BRIEF_GRID0_X1                                          63
327 #define BRIEF_GRID0_Y1                                          122
328 #define BRIEF_GRID1_X1                                          575
329 #define BRIEF_GRID1_Y1                                          122
330 #define BRIEF_GRID2_X1                                          63
331 #define BRIEF_GRID2_Y1                                          350
332
333 #define BRIEF_TEXT_X1                                           0
334 #define BRIEF_TEXT_Y1                                           397
335 #define BRIEF_TEXT_X2                                           441
336 #define BRIEF_TEXT_Y2                                           477
337 #define BRIEF_TEXT_BEGIN_X                                      50
338 #define BRIEF_TEXT_BEGIN_Y                                      414
339 #define BRIEF_TEXT_H                                                    54
340
341 */
342
343 typedef struct brief_screen
344 {
345         int map_x1, map_x2, map_y1, map_y2;
346         int btext_x1, btext_x2, btext_y1, btext_y2;
347         int cup_x1, cup_x2, cup_y1, cup_y2;
348         int cupinfo_x1, cupinfo_x2, cupinfo_y1, cupinfo_y2;
349 } brief_sceen;
350
351 extern brief_screen bscreen;
352
353 // ------------------------------------------------------------------------
354 // Global briefing/debriefing data
355 // ------------------------------------------------------------------------
356 extern briefing         Briefings[MAX_TEAMS];
357 extern debriefing               Debriefings[MAX_TEAMS];
358 extern briefing         *Briefing;
359 extern debriefing               *Debriefing;
360 extern float                    Brief_text_wipe_time_elapsed;
361
362 extern int Cur_brief_id;
363 extern int Briefing_voice_enabled;
364
365 extern int Num_brief_text_lines[MAX_TEXT_STREAMS];
366 extern int Top_brief_text_line;
367 extern int Current_screen;
368
369 // ------------------------------------------------------------------------
370 // External interface
371 // ------------------------------------------------------------------------
372 void brief_reset();
373 void debrief_reset(); 
374 void brief_close_map();
375 void brief_init_map();
376 void brief_init_screen(int multiplayer_flag);
377 void brief_render_map(int stage_num, float frametime);
378 void brief_set_new_stage(vector *pos, matrix *orient, int time, int stage_num);
379 void brief_camera_move(float frametime, int stage_num);
380 void brief_render_icon(int stage_num, int icon_num, float frametime, int selected = 0, float w_scale_factor = 1.0f, float h_scale_factor = 1.0f);
381 void brief_render_icon_line(int stage_num, int line_num);
382 void brief_init_icons();
383 void brief_load_icons();
384 void brief_unload_icons();
385 void brief_common_close();
386 void brief_reset_icons(int stage_num);
387 void brief_restart_text_wipe();
388 void brief_reset_last_new_stage();
389 void brief_blit_stage_num(int stage_num, int stage_max);
390
391 void brief_common_get_icon_dimensions(int *w, int *h, int type, int ship_class);
392
393 // voice streaming interface
394 void brief_voice_init();
395 void brief_voice_load_all();
396 void brief_voice_unload_all();
397 void brief_voice_play(int stage_num);
398 void brief_voice_stop(int stage_num);
399 void brief_voice_pause(int stage_num);
400 void brief_voice_unpause(int stage_num);
401
402 // fancy briefing style text functions for use in other modules.
403 int brief_color_text_init(char *src, int w, int instance = 0);
404 int brief_render_text(int line_offset, int x, int y, int h, float frametime, int instance = 0, int line_spacing = 0);
405
406 void cmd_brief_reset();
407
408 int brief_time_to_advance(int stage_num, float frametime);
409
410 #endif
411