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