FS2_Open
Open source remastering of the Freespace 2 engine
missionbriefcommon.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef __MISSIONBRIEFCOMMON_H__
13 #define __MISSIONBRIEFCOMMON_H__
14 
15 #include "anim/packunpack.h"
16 #include "globalincs/globals.h"
17 #include "graphics/generic.h"
18 #include "hud/hud.h"
19 
20 #define MAX_TEXT_STREAMS 2 // how many concurrent streams of text can be displayed
21 
22 // ------------------------------------------------------------------------
23 // names for the icons that can appear in the briefing. If you modify this list,
24 // update the Icons_names[] string array located in MissionParse.cpp
25 // ------------------------------------------------------------------------
26 #define MIN_BRIEF_ICONS 35 // keep up to date
27 
28 #define ICON_FIGHTER 0
29 #define ICON_FIGHTER_WING 1
30 #define ICON_CARGO 2
31 #define ICON_CARGO_WING 3
32 #define ICON_LARGESHIP 4
33 #define ICON_LARGESHIP_WING 5
34 #define ICON_CAPITAL 6
35 #define ICON_PLANET 7
36 #define ICON_ASTEROID_FIELD 8
37 #define ICON_WAYPOINT 9
38 #define ICON_SUPPORT_SHIP 10
39 #define ICON_FREIGHTER_NO_CARGO 11
40 #define ICON_FREIGHTER_WITH_CARGO 12
41 #define ICON_FREIGHTER_WING_NO_CARGO 13
42 #define ICON_FREIGHTER_WING_WITH_CARGO 14
43 #define ICON_INSTALLATION 15
44 #define ICON_BOMBER 16
45 #define ICON_BOMBER_WING 17
46 #define ICON_CRUISER 18
47 #define ICON_CRUISER_WING 19
48 #define ICON_UNKNOWN 20
49 #define ICON_UNKNOWN_WING 21
50 #define ICON_FIGHTER_PLAYER 22
51 #define ICON_FIGHTERW_PLAYER 23
52 #define ICON_BOMBER_PLAYER 24
53 #define ICON_BOMBERW_PLAYER 25
54 #define ICON_KNOSSOS_DEVICE 26
55 #define ICON_TRANSPORT_WING 27
56 #define ICON_CORVETTE 28
57 #define ICON_GAS_MINER 29
58 #define ICON_AWACS 30
59 #define ICON_SUPERCAP 31
60 #define ICON_SENTRYGUN 32
61 #define ICON_JUMP_NODE 33
62 #define ICON_TRANSPORT 34
63 
64 typedef struct briefing_icon_info {
69 
71 
72 struct brief_icon;
74 
75 
76 
77 // Moving out of missionbriefcommon.cpp so it can be referenced elsewhere -MageKing17
78 extern const float BRIEF_TEXT_WIPE_TIME; // time in seconds for wipe to occur
79 
80 // ------------------------------------------------------------------------
81 // Structures to hold briefing data
82 // ------------------------------------------------------------------------
83 
84 #define MAX_BRIEF_LINES 70
85 #define MAX_BRIEF_LINE_LEN 256 // max number of chars in a briefing line
86 #define MAX_BRIEF_LINE_W_640 375 // max width of line in pixels in 640x480 mode
87 #define MAX_BRIEF_LINE_W_1024 600 // max width of line in pixels in 1024x768 mode
88 
89 #define MAX_DEBRIEF_LINES 60
90 #define MAX_DEBRIEF_LINE_LEN 256 // max number of chars in a debriefing line
91 #define MAX_DEBRIEF_LINE_W 500 // max width of line in pixels
92 
93 #define MAX_ICON_TEXT_LEN 1024 // max number of chars for icon info
94 #define MAX_ICON_TEXT_LINES 30
95 #define MAX_ICON_TEXT_LINE_LEN 256 // max number of chars in icon info line
96 #define MAX_ICON_TEXT_LINE_W 170 // max width of line in pixels
97 
98 #define MAX_STAGE_ICONS 20
99 #define MAX_BRIEF_STAGES 15
100 #define MAX_DEBRIEF_STAGES 40
101 #define MAX_LABEL_LEN 64
102 
103 #define BI_HIGHLIGHT (1<<0)
104 #define BI_SHOWHIGHLIGHT (1<<1)
105 #define BI_FADEIN (1<<2)
106 #define BI_MIRROR_ICON (1<<3) // mirror the briefing icon so it points the other way - phreak
107 #define BI_USE_WING_ICON (1<<4) // use wing variant of briefing icon
108 #define BI_USE_CARGO_ICON (1<<5) // use cargo variant of briefing icon
109 
110 typedef struct brief_icon {
111  int x,y,w,h;
112  int hold_x, hold_y; // 2D screen position of icon, used to place animations
114  int modelnum;
115  float radius;
116  int type; // ICON_* defines from MissionBriefCommon.h
118  int id;
119  int team;
123 // char text[MAX_ICON_TEXT_LEN];
127  int flags; // BI_* flags defined above
128 } brief_icon;
129 
130 #define MAX_BRIEF_STAGE_LINES 20
131 
132 typedef struct brief_line {
133  int start_icon; // index into icons[], where line starts
134  int end_icon; // index into icons[], where line ends
135 } brief_line;
136 
137 #define BS_FORWARD_CUT (1<<0)
138 #define BS_BACKWARD_CUT (1<<1)
139 
141 {
142 public:
147  int camera_time; // ms
148  int flags; // see BS_ flags above
149  int formula;
154 
156  : text( ), camera_time( 0 ), flags( 0 ), formula( -1 ),
157  num_icons( 0 ), icons( NULL ), num_lines( 0 ), lines( NULL )
158  {
159  voice[ 0 ] = 0;
160  camera_pos = vmd_zero_vector;
161  camera_orient = vmd_identity_matrix;
162  }
163 };
164 
166 {
167 public:
168  int formula;
172 
174  : formula( -1 ), text( ),
175  recommendation_text( )
176  {
177  voice[ 0 ] = 0;
178  }
179 };
180 
181 class briefing
182 {
183 public:
189 
191  : num_stages(0)
192  {
193  memset(background, 0, GR_NUM_RESOLUTIONS * MAX_FILENAME_LEN * sizeof(char));
194  }
195 };
196 
198 {
199 public:
203 
205  : num_stages(0)
206  {}
207 };
208 
209 
210 
211 // Code to free/init the above structures between levels:
212 
213 // --------------------------------------------------------------------------------------
214 // Does one time initialization of the briefing and debriefing structures.
215 // Namely setting all malloc'ble pointers to NULL. Called once at game startup.
217 
218 //--------------------------------------------------------------------------------------
219 // Frees all the memory allocated in the briefing and debriefing structures
220 // and sets all pointers to NULL.
223 
224 
225 // --------------------------------------------------------------------------------------
226 // briefing screen
227 // --------------------------------------------------------------------------------------
234 
235 // Needed for Fred
236 #define BRIEF_GRID3_X1 42
237 #define BRIEF_GRID3_Y1 122
238 #define BRIEF_GRID0_X2 585
239 #define BRIEF_GRID0_Y2 371
240 #define BRIEF_GRID_W (BRIEF_GRID0_X2-BRIEF_GRID3_X1+1)
241 #define BRIEF_GRID_H (BRIEF_GRID0_Y2-BRIEF_GRID3_Y1+1)
242 /*
243 #define BRIEF_GRID0_X1 63
244 #define BRIEF_GRID0_Y1 122
245 #define BRIEF_GRID1_X1 575
246 #define BRIEF_GRID1_Y1 122
247 #define BRIEF_GRID2_X1 63
248 #define BRIEF_GRID2_Y1 350
249 
250 #define BRIEF_TEXT_X1 0
251 #define BRIEF_TEXT_Y1 397
252 #define BRIEF_TEXT_X2 441
253 #define BRIEF_TEXT_Y2 477
254 #define BRIEF_TEXT_BEGIN_X 50
255 #define BRIEF_TEXT_BEGIN_Y 414
256 #define BRIEF_TEXT_H 54
257 
258 */
259 
260 typedef struct brief_screen
261 {
263 /* int btext_x1, btext_x2, btext_y1, btext_y2;
264  int cup_x1, cup_x2, cup_y1, cup_y2;
265  int cupinfo_x1, cupinfo_x2, cupinfo_y1, cupinfo_y2;*/
266 } brief_sceen;
267 
268 extern brief_screen bscreen;
269 
270 // ------------------------------------------------------------------------
271 // Global briefing/debriefing data
272 // ------------------------------------------------------------------------
275 extern briefing *Briefing;
276 extern debriefing *Debriefing;
277 extern float Brief_text_wipe_time_elapsed;
278 
279 extern int Cur_brief_id;
280 extern int Briefing_voice_enabled;
281 
283 extern int Top_brief_text_line;
284 extern int Current_screen;
285 
286 // ------------------------------------------------------------------------
287 // External interface
288 // ------------------------------------------------------------------------
289 void brief_reset();
290 void debrief_reset();
291 void brief_init_screen(int multiplayer_flag);
292 void brief_render_map(int stage_num, float frametime);
293 void brief_set_new_stage(vec3d *pos, matrix *orient, int time, int stage_num);
294 void brief_camera_move(float frametime, int stage_num);
295 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);
296 void brief_render_icon_line(int stage_num, int line_num);
297 void brief_init_map();
298 void brief_parse_icon_tbl();
299 void brief_common_close();
300 void brief_reset_icons(int stage_num);
303 void brief_blit_stage_num(int stage_num, int stage_max);
304 
305 void brief_common_get_icon_dimensions(int *w, int *h, brief_icon *bi);
306 
307 // voice streaming interface
308 void brief_voice_init();
309 void brief_voice_load_all();
311 void brief_voice_play(int stage_num);
312 void brief_voice_stop(int stage_num);
313 void brief_voice_pause(int stage_num);
314 void brief_voice_unpause(int stage_num);
315 
316 // fancy briefing style text functions for use in other modules.
317 int brief_color_text_init(const char *src, int w, const char default_color = '\0', int instance = 0, int max_lines = MAX_BRIEF_LINES, const bool append = false);
318 int brief_render_text(int line_offset, int x, int y, int h, float frametime, int instance = 0, int line_spacing = 0);
319 
320 void cmd_brief_reset();
321 
322 int brief_time_to_advance(int stage_num);
323 
324 #endif
#define MAX_TEXT_STREAMS
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
void brief_common_get_icon_dimensions(int *w, int *h, brief_icon *bi)
void brief_reset_icons(int stage_num)
char weapon_select_background[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]
GLbitfield stages
Definition: Glext.h:7177
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
SCP_string recommendation_text
char * Brief_static_name[GR_NUM_RESOLUTIONS]
int Brief_static_coords[GR_NUM_RESOLUTIONS][2]
#define MAX_BRIEF_LINES
Definition: pstypes.h:88
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
void brief_voice_pause(int stage_num)
GLclampf f
Definition: Glext.h:7097
int brief_render_text(int line_offset, int x, int y, int h, float frametime, int instance=0, int line_spacing=0)
char background[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]
hud_anim highlight_anim
int brief_time_to_advance(int stage_num)
hull_check orient
Definition: lua.cpp:5049
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
int Brief_bmap_coords[GR_NUM_RESOLUTIONS][2]
void brief_voice_load_all()
int Brief_grid_coords[GR_NUM_RESOLUTIONS][4]
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)
void brief_voice_stop(int stage_num)
const float BRIEF_TEXT_WIPE_TIME
struct briefing_icon_info briefing_icon_type
brief_icon * icons
debriefing * Debriefing
char ship_select_background[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]
void brief_camera_move(float frametime, int stage_num)
char voice[MAX_FILENAME_LEN]
float Brief_text_wipe_time_elapsed
void brief_reset()
int Brief_text_coords[GR_NUM_RESOLUTIONS][4]
void brief_init_map()
struct brief_icon brief_icon
void mission_brief_common_init()
void brief_voice_init()
void brief_reset_last_new_stage()
briefing Briefings[MAX_TVT_TEAMS]
int Cur_brief_id
int Briefing_voice_enabled
void brief_voice_unpause(int stage_num)
int brief_color_text_init(const char *src, int w, const char default_color= '\0', int instance=0, int max_lines=MAX_BRIEF_LINES, const bool append=false)
char voice[MAX_FILENAME_LEN]
void mission_brief_common_reset()
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
debriefing Debriefings[MAX_TVT_TEAMS]
Definition: hud.h:22
void brief_render_icon_line(int stage_num, int line_num)
int Top_brief_text_line
#define MAX_LABEL_LEN
char background[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]
void brief_voice_unload_all()
void brief_blit_stage_num(int stage_num, int stage_max)
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
SCP_vector< briefing_icon_info > Briefing_icon_info
int Brief_text_max_lines[GR_NUM_RESOLUTIONS]
struct brief_screen brief_sceen
struct brief_line brief_line
briefing_icon_info * brief_get_icon_info(brief_icon *bi)
#define MAX_BRIEF_STAGES
cfbp line_num
Definition: cfile.cpp:1072
GLenum src
Definition: Glext.h:5917
hull_check pos
Definition: lua.cpp:5050
void brief_set_new_stage(vec3d *pos, matrix *orient, int time, int stage_num)
#define MAX_TVT_TEAMS
Definition: globals.h:57
void brief_common_close()
int Num_brief_text_lines[MAX_TEXT_STREAMS]
void mission_debrief_common_reset()
brief_screen bscreen
void brief_restart_text_wipe()
void cmd_brief_reset()
char closeup_label[MAX_LABEL_LEN]
int Current_screen
vec3d vmd_zero_vector
Definition: vecmat.cpp:24
char label[MAX_LABEL_LEN]
briefing * Briefing
void brief_init_screen(int multiplayer_flag)
void brief_render_map(int stage_num, float frametime)
matrix vmd_identity_matrix
Definition: vecmat.cpp:28
void brief_parse_icon_tbl()
hud_anim fadein_anim
void brief_voice_play(int stage_num)
GLint y
Definition: Gl.h:1505
#define MAX_DEBRIEF_STAGES
brief_line * lines
hud_anim fadeout_anim
void debrief_reset()