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.2 2002/06/09 04:41:13 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 10 8/24/99 11:30a Jefff
26 * Increased number of debriefing lines
28 * 9 7/20/99 7:09p Jefff
29 * briefing text occupies full window in 1024x768
31 * 8 7/19/99 3:01p Dave
32 * Fixed icons. Added single transport icon.
34 * 7 7/18/99 5:20p Dave
35 * Jump node icon. Fixed debris fogging. Framerate warning stuff.
37 * 6 7/09/99 5:54p Dave
38 * Seperated cruiser types into individual types. Added tons of new
39 * briefing icons. Campaign screen.
41 * 5 6/29/99 7:39p Dave
42 * Lots of small bug fixes.
44 * 4 1/30/99 4:03p Johnson
45 * Include #defines for Fred
47 * 3 1/29/99 4:17p Dave
48 * New interface screens.
50 * 2 10/07/98 10:53a Dave
53 * 1 10/07/98 10:49a Dave
55 * 71 6/10/98 6:47p Lawrance
56 * increase MAX_RECOMMENDATION_LEN to 1024, to accommodate other languages
58 * 70 4/25/98 3:49p Lawrance
59 * Save briefing auto-advance pref
61 * 69 4/20/98 3:53p Lawrance
62 * Fix various bugs with auto-advancing through briefings.
64 * 68 4/15/98 10:27a Sandeep
66 * 67 4/13/98 7:06p Lawrance
67 * implement auto advance of briefing stages
69 * 66 4/06/98 2:51p Hoffoss
70 * Added sexp for briefing to FreeSpace.
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.
77 * 64 4/03/98 10:31a John
78 * Made briefing and debriefing arrays be malloc'd
80 * 63 4/01/98 8:38p Lawrance
81 * Add support for jump node icons in the briefings.
83 * 62 3/26/98 5:47p Lawrance
84 * remove icon text functionality
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.
90 * 60 3/12/98 4:04p Hoffoss
91 * Changed text window size and spaced text out an extra pixel.
93 * 59 3/09/98 12:13a Lawrance
94 * Add support for Red Alert missions
96 * 58 3/07/98 11:50a Lawrance
97 * Fix bug with displaying the closeup title
99 * 57 3/05/98 9:38p Hoffoss
100 * Finished up command brief screen.
102 * 56 3/05/98 10:39a Hoffoss
103 * Added command brief stuff.
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.
110 * 54 2/24/98 6:21p Lawrance
111 * Fix up map grid region
113 * 53 2/24/98 12:22a Lawrance
114 * New coords for revamped briefing graphics
116 * 52 2/18/98 6:45p Hoffoss
117 * Added support for lines between icons in briefings for Fred.
119 * 51 2/13/98 5:16p Lawrance
120 * Add support for icon lines in the briefing.
122 * 50 2/09/98 9:25p Allender
123 * team v team support. multiple pools and breifings
125 * 49 2/06/98 4:32p Lawrance
126 * Allow briefing voices to be toggled on/off
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
132 * 47 1/28/98 7:22p Lawrance
133 * Put back in highlight member in brief_icon for FRED compatability.
135 * 46 1/28/98 7:19p Lawrance
136 * Get fading/highlighting animations working
138 * 45 10/19/97 5:14p Lawrance
139 * add flags member to brief_stage
141 * 44 10/15/97 4:45p Lawrance
142 * implement scene cut in debriefing
144 * 43 10/13/97 7:40p Lawrance
145 * implement new debriefing/recommendation format
147 * 42 10/04/97 12:00a Lawrance
148 * grey out background when help overlay is activated
150 * 41 10/03/97 8:25a Lawrance
151 * be able to pause brief narration
153 * 40 10/01/97 4:39p Lawrance
154 * move chat code into Chatbox.cpp, simplify interface
159 #ifndef __MISSIONBRIEFCOMMON_H__
160 #define __MISSIONBRIEFCOMMON_H__
162 #include "packunpack.h"
165 #define MAX_TEXT_STREAMS 2 // how many concurrent streams of text can be displayed
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
173 #define ICON_FIGHTER 0
174 #define ICON_FIGHTER_WING 1
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
209 // ------------------------------------------------------------------------
210 // Structures to hold briefing data
211 // ------------------------------------------------------------------------
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
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
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
229 #define MAX_STAGE_ICONS 20
230 #define MAX_BRIEF_STAGES 15
231 #define MAX_DEBRIEF_STAGES 20
232 #define MAX_LABEL_LEN 64
234 #define MAX_RECOMMENDATION_LEN 1024
236 #define BI_HIGHLIGHT (1<<0)
237 #define BI_SHOWHIGHLIGHT (1<<1)
238 #define BI_FADEIN (1<<2)
240 typedef struct brief_icon
243 int hold_x, hold_y; // 2D screen position of icon, used to place animations
247 int type; // ICON_* defines from MissionBriefCommon.h
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
261 #define MAX_BRIEF_STAGE_LINES 20
263 typedef struct brief_line
265 int start_icon; // index into icons[], where line starts
266 int end_icon; // index into icons[], where line ends
269 #define BS_FORWARD_CUT (1<<0)
270 #define BS_BACKWARD_CUT (1<<1)
272 typedef struct brief_stage
275 char voice[MAX_FILENAME_LEN];
277 matrix camera_orient;
278 int camera_time; // ms
279 int flags; // see BS_ flags above
287 typedef struct debrief_stage
291 char voice[MAX_FILENAME_LEN];
292 char *new_recommendation_text;
295 typedef struct briefing {
297 brief_stage stages[MAX_BRIEF_STAGES];
300 typedef struct debriefing {
302 debrief_stage stages[MAX_DEBRIEF_STAGES];
306 // Code to free/init the above structures between levels:
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();
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();
319 // --------------------------------------------------------------------------------------
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];
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)
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
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
354 typedef struct brief_screen
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;
362 extern brief_screen bscreen;
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;
373 extern int Cur_brief_id;
374 extern int Briefing_voice_enabled;
376 extern int Num_brief_text_lines[MAX_TEXT_STREAMS];
377 extern int Top_brief_text_line;
378 extern int Current_screen;
380 // ------------------------------------------------------------------------
381 // External interface
382 // ------------------------------------------------------------------------
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);
402 void brief_common_get_icon_dimensions(int *w, int *h, int type, int ship_class);
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);
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);
417 void cmd_brief_reset();
419 int brief_time_to_advance(int stage_num, float frametime);