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