Open source remastering of the Freespace 2 engine
missionbriefcommon.cpp File Reference

Go to the source code of this file.


struct  colored_char
struct  icon_move_info
struct  icon_fade_info


#define BRIEF_CUP_X1   400
#define BRIEF_CUP_Y1   70
#define BRIEF_CUP_X2   639
#define BRIEF_CUP_Y2   245
#define BRIEF_CUPINFO_X1   445
#define BRIEF_CUPINFO_Y1   247
#define BRIEF_CUPINFO_X2   639
#define BRIEF_CUPINFO_Y2   438
#define LOOKAT_DIST   500.0f
#define STAGE_ADVANCE_DELAY   1000
#define BRIGHTEN_LEAD   2


typedef struct colored_char colored_char
typedef SCP_vector< colored_charbriefing_line
typedef SCP_vector< briefing_linebriefing_stream
typedef struct icon_move_info icon_move_info
typedef struct icon_fade_info fade_icon


void brief_render_elements (vec3d *pos, grid *gridp)
void brief_render_icons (int stage_num, float frametime)
void brief_grid_read_camera_controls (control_info *ci, float frametime)
void brief_maybe_create_new_grid (grid *gridp, vec3d *pos, matrix *orient, int force=0)
gridbrief_create_grid (grid *gridp, vec3d *forward, vec3d *right, vec3d *center, int nrows, int ncols, float square_size)
gridbrief_create_default_grid (void)
void brief_render_grid (grid *gridp)
void brief_modify_grid (grid *gridp)
void brief_rpd_line (vec3d *v0, vec3d *v1)
void brief_set_text_color (char color_tag)
void get_camera_limits (const matrix *start_camera, const matrix *end_camera, float time, vec3d *acc_max, vec3d *w_max)
int brief_text_wipe_finished ()
void brief_parse_icon_tbl ()
void brief_set_icon_color (int team)
void brief_move_icon_reset ()
void mission_brief_common_init ()
void mission_brief_common_reset ()
void mission_debrief_common_reset ()
void brief_reset ()
void debrief_reset ()
void brief_init_screen (int multiplayer_flag)
void brief_init_colors ()
briefing_icon_infobrief_get_icon_info (brief_icon *bi)
void brief_preload_icon_anim (brief_icon *bi)
void brief_preload_fade_anim (brief_icon *bi)
void brief_preload_highlight_anim (brief_icon *bi)
void brief_preload_anims ()
void brief_init_map ()
void brief_render_fade_outs (float frametime)
float brief_icon_get_dist_moved (icon_move_info *mi, float elapsed_time)
void brief_render_icon_line (int stage_num, int line_num)
void brief_render_icon (int stage_num, int icon_num, float frametime, int selected, float w_scale_factor, float h_scale_factor)
void brief_start_highlight_anims (int stage_num)
void brief_render_map (int stage_num, float frametime)
void brief_blit_stage_num (int stage_num, int stage_max)
void brief_render_line (int line_num, int x, int y, int instance)
int brief_render_text (int line_offset, int x, int y, int h, float frametime, int instance, int line_spacing)
void brief_reset_icons (int stage_num)
void brief_set_camera_target (vec3d *pos, matrix *orient, int time)
bool brief_verify_color_tag (char color_tag)
bool is_a_word_separator (char character)
int brief_text_colorize (char *src, int instance, char default_color_stack[], int &color_stack_index)
int brief_color_text_init (const char *src, int w, const char default_color, int instance, int max_lines, const bool append)
int brief_get_free_move_icon ()
int brief_set_move_list (int new_stage, int current_stage, float time)
void brief_clear_fade_out_icons ()
void brief_set_new_stage (vec3d *pos, matrix *orient, int time, int stage_num)
int camera_pos_past_target (vec3d *start, vec3d *current, vec3d *dest)
void interpolate_matrix (matrix *result, matrix *goal, matrix *start, float elapsed_time, float total_time)
float brief_camera_get_dist_moved (float elapsed_time)
void brief_camera_move (float frametime, int stage_num)
void brief_unload_anims ()
void brief_common_close ()
void brief_restart_text_wipe ()
void brief_voice_init ()
void brief_load_voice_file (int voice_num, char *name)
void brief_voice_load_all ()
void brief_voice_unload_all ()
void brief_voice_play (int stage_num)
void brief_voice_stop (int stage_num)
void brief_voice_pause (int stage_num)
void brief_voice_unpause (int stage_num)
void brief_reset_last_new_stage ()
void brief_common_get_icon_dimensions (int *w, int *h, brief_icon *bi)
void cmd_brief_reset ()
int brief_time_to_advance (int stage_num)


brief_screen bscreen
char * Brief_static_name [GR_NUM_RESOLUTIONS]
int Brief_static_coords [GR_NUM_RESOLUTIONS][2]
int Brief_bmap_coords [GR_NUM_RESOLUTIONS][2]
int Brief_grid_coords [GR_NUM_RESOLUTIONS][4]
int Brief_text_coords [GR_NUM_RESOLUTIONS][4]
int Brief_stage_text_coords [GR_NUM_RESOLUTIONS][2]
int Brief_stage_text_coords_multi [GR_NUM_RESOLUTIONS][2]
int Brief_text_max_lines [GR_NUM_RESOLUTIONS]
const float BRIEF_TEXT_WIPE_TIME = 1.5f
briefing Briefings [MAX_TVT_TEAMS]
debriefing Debriefings [MAX_TVT_TEAMS]
int Briefing_voice_enabled =1
int Cur_brief_id
const char BRIEF_META_CHAR = '$'
int Num_brief_text_lines [MAX_TEXT_STREAMS]
int Top_brief_text_line
float Brief_text_wipe_time_elapsed
icon_move_info Icon_movers [MAX_MOVING_ICONS]
icon_move_info Icon_move_list
icon_fade_info Fading_icons [MAX_FADING_ICONS]
int Num_fade_icons
int Brief_voices [MAX_BRIEF_STAGES]
cmd_brief Cmd_briefs [MAX_TVT_TEAMS]
SCP_vector< briefing_icon_infoBriefing_icon_info

Macro Definition Documentation

#define BRIEF_CUP_X1   400

Definition at line 45 of file missionbriefcommon.cpp.

#define BRIEF_CUP_X2   639

Definition at line 47 of file missionbriefcommon.cpp.

#define BRIEF_CUP_Y1   70

Definition at line 46 of file missionbriefcommon.cpp.

#define BRIEF_CUP_Y2   245

Definition at line 48 of file missionbriefcommon.cpp.

#define BRIEF_CUPINFO_X1   445

Definition at line 49 of file missionbriefcommon.cpp.

#define BRIEF_CUPINFO_X2   639

Definition at line 51 of file missionbriefcommon.cpp.

#define BRIEF_CUPINFO_Y1   247

Definition at line 50 of file missionbriefcommon.cpp.

#define BRIEF_CUPINFO_Y2   438

Definition at line 52 of file missionbriefcommon.cpp.

#define BRIGHTEN_LEAD   2

Definition at line 193 of file missionbriefcommon.cpp.

#define LOOKAT_DIST   500.0f

Definition at line 117 of file missionbriefcommon.cpp.


Definition at line 242 of file missionbriefcommon.cpp.


Definition at line 229 of file missionbriefcommon.cpp.

#define STAGE_ADVANCE_DELAY   1000

Definition at line 118 of file missionbriefcommon.cpp.

Typedef Documentation

Definition at line 189 of file missionbriefcommon.cpp.

Definition at line 190 of file missionbriefcommon.cpp.

typedef struct colored_char colored_char
typedef struct icon_fade_info fade_icon

Function Documentation

void brief_blit_stage_num ( int  stage_num,
int  stage_max 

Display what stage of the briefing is active

Definition at line 1143 of file missionbriefcommon.cpp.

float brief_camera_get_dist_moved ( float  elapsed_time)

Calculate how far the camera should have moved

Definition at line 1845 of file missionbriefcommon.cpp.

void brief_camera_move ( float  frametime,
int  stage_num 

Update the camera position

Definition at line 1865 of file missionbriefcommon.cpp.

void brief_clear_fade_out_icons ( )

Definition at line 1721 of file missionbriefcommon.cpp.

int brief_color_text_init ( const char *  src,
int  w,
const char  default_color,
int  instance,
int  max_lines,
const bool  append 

Initialise briefing coloured text

srcparagraph of text to process
wmax width of line in pixels
[in]default_coloroptional, default color for this text (defaults to '\0', which gets converted to the first defined color tag (should be 'w'))
instanceoptional parameter, used when multiple text streams are required (default value is 0)
max_linesmaximum number of lines
[in]appendadd on to the existing lines instead of replacing them (defaults to false)

Definition at line 1543 of file missionbriefcommon.cpp.

void brief_common_close ( )

Definition at line 2168 of file missionbriefcommon.cpp.

void brief_common_get_icon_dimensions ( int w,
int h,
brief_icon bi 

Get the dimensions for a briefing icon

Definition at line 2318 of file missionbriefcommon.cpp.

grid * brief_create_default_grid ( void  )

Create a nice default grid. Centered at origin, 10x10, 10.0 size squares, in xz plane.

Definition at line 2081 of file missionbriefcommon.cpp.

grid * brief_create_grid ( grid gridp,
vec3d forward,
vec3d right,
vec3d center,
int  nrows,
int  ncols,
float  square_size 

Definition at line 1990 of file missionbriefcommon.cpp.

int brief_get_free_move_icon ( )

Get free handle to a move icon

-1 on failure, a handle to a free move icon struct on success

Definition at line 1604 of file missionbriefcommon.cpp.

briefing_icon_info* brief_get_icon_info ( brief_icon bi)

Definition at line 548 of file missionbriefcommon.cpp.

void brief_grid_read_camera_controls ( control_info ci,
float  frametime 
float brief_icon_get_dist_moved ( icon_move_info mi,
float  elapsed_time 

Figure out how far an icon should move based on the elapsed time

Definition at line 763 of file missionbriefcommon.cpp.

void brief_init_colors ( )

Definition at line 544 of file missionbriefcommon.cpp.

void brief_init_map ( )

Definition at line 686 of file missionbriefcommon.cpp.

void brief_init_screen ( int  multiplayer_flag)

Set up the screen regions. A mulitplayer briefing will look different than a single player briefing.

Definition at line 532 of file missionbriefcommon.cpp.

void brief_load_voice_file ( int  voice_num,
char *  name 

Definition at line 2191 of file missionbriefcommon.cpp.

void brief_maybe_create_new_grid ( grid gridp,
vec3d pos,
matrix orient,
int  force 

Project the viewer's position onto the grid plane. If more than threshold distance from grid center, move grid center.

Definition at line 1914 of file missionbriefcommon.cpp.

void brief_modify_grid ( grid gridp)

Definition at line 2138 of file missionbriefcommon.cpp.

void brief_move_icon_reset ( )

Definition at line 361 of file missionbriefcommon.cpp.

void brief_parse_icon_tbl ( )

Definition at line 275 of file missionbriefcommon.cpp.

void brief_preload_anims ( )

Preload highlight, fadein and fadeout animations that are used in each stage

Definition at line 661 of file missionbriefcommon.cpp.

void brief_preload_fade_anim ( brief_icon bi)

Definition at line 616 of file missionbriefcommon.cpp.

void brief_preload_highlight_anim ( brief_icon bi)

Definition at line 636 of file missionbriefcommon.cpp.

void brief_preload_icon_anim ( brief_icon bi)

Definition at line 599 of file missionbriefcommon.cpp.

void brief_render_elements ( vec3d pos,
grid gridp 

Draw the lines that show objects positions on the grid

Definition at line 1313 of file missionbriefcommon.cpp.

void brief_render_fade_outs ( float  frametime)

Definition at line 717 of file missionbriefcommon.cpp.

void brief_render_grid ( grid gridp)

Renders a grid

gridpGrid defined in a grid struct to render

Definition at line 2115 of file missionbriefcommon.cpp.

void brief_render_icon ( int  stage_num,
int  icon_num,
float  frametime,
int  selected,
float  w_scale_factor,
float  h_scale_factor 

Draw a briefing icon

stage_numbriefing stage number (start at 0)
icon_numicon number in stage
frametimetime elapsed in seconds
selectedFRED only (will be 0 or non-zero)
w_scale_factorscale icon in width by this amount (default 1.0f)
h_scale_factorscale icon in height by this amount (default 1.0f)

Definition at line 855 of file missionbriefcommon.cpp.

void brief_render_icon_line ( int  stage_num,
int  line_num 

Draw a line between two icons on the briefing screen

Definition at line 782 of file missionbriefcommon.cpp.

void brief_render_icons ( int  stage_num,
float  frametime 

Definition at line 1048 of file missionbriefcommon.cpp.

void brief_render_line ( int  line_num,
int  x,
int  y,
int  instance 

Render a line of text for the briefings. Lines are drawn in as a wipe, with leading bright white characters. Have to jump through some hoops since we support colored words. This means that we need to process the line one character at a time.

line_numnumber of the line of the briefing page to be drawn
xhorizontal position where the text is drawn
yvertical position where the text is drawn
instanceindex of Colored_stream of the text page to display

Definition at line 1167 of file missionbriefcommon.cpp.

void brief_render_map ( int  stage_num,
float  frametime 

Definition at line 1105 of file missionbriefcommon.cpp.

int brief_render_text ( int  line_offset,
int  x,
int  y,
int  h,
float  frametime,
int  instance,
int  line_spacing 


frametimetime in seconds of previous frame
instanceoptional parameter. Used to indicate which text stream is used. This value is 0 unless multiple text streams are required

Definition at line 1274 of file missionbriefcommon.cpp.

void brief_reset ( )

Definition at line 505 of file missionbriefcommon.cpp.

void brief_reset_icons ( int  stage_num)

Definition at line 1340 of file missionbriefcommon.cpp.

void brief_reset_last_new_stage ( )

Definition at line 2310 of file missionbriefcommon.cpp.

void brief_restart_text_wipe ( )

Definition at line 2173 of file missionbriefcommon.cpp.

void brief_rpd_line ( vec3d v0,
vec3d v1 

Rotate and project points and draw a line.

Definition at line 2100 of file missionbriefcommon.cpp.

void brief_set_camera_target ( vec3d pos,
matrix orient,
int  time 

Direct camera to look at target

postarget position for the camera
orienttarget orientation for the camera
timetime in ms to reach target

Definition at line 1363 of file missionbriefcommon.cpp.

void brief_set_icon_color ( int  team)

Definition at line 352 of file missionbriefcommon.cpp.

int brief_set_move_list ( int  new_stage,
int  current_stage,
float  time 

Set move list in briefing

new_stagenew stage number that briefing is now moving to
current_stagecurrent stage that the briefing is on
timetime in seconds

Definition at line 1627 of file missionbriefcommon.cpp.

void brief_set_new_stage ( vec3d pos,
matrix orient,
int  time,
int  stage_num 

Set new stage in briefing

postarget position for the camera
orienttarget orientation for the camera
timetime in ms to reach target
stage_numstage number of briefing (start numbering at 0)

Definition at line 1735 of file missionbriefcommon.cpp.

void brief_set_text_color ( char  color_tag)

Definition at line 1426 of file missionbriefcommon.cpp.

void brief_start_highlight_anims ( int  stage_num)

See if there are any highlight animations to play

Definition at line 1071 of file missionbriefcommon.cpp.

int brief_text_colorize ( char *  src,
int  instance,
char  default_color_stack[],
int color_stack_index 

Builds a vector of colored characters from a string containing color markups and stores it to Colored_stream table.

A color markup is made of a minimum of three characters: '$' + a char standing for a color + contigous multiple spaces (chars t n and ' ') The markup is completely removed from the resulting character sequence.

srca not null pointer to a C string terminated by a /0 char.
instanceindex into Colored_stream where the result should be placed. Value is 0 unless multiple text streams are required.
[in,out]default_color_stackpointer to an array containing a stack of default colors (for color spans)
[in,out]color_stack_indexpointer to the current index in the above stack
number of character of the resulting sequence.

Definition at line 1455 of file missionbriefcommon.cpp.

int brief_text_wipe_finished ( )

Definition at line 1253 of file missionbriefcommon.cpp.

int brief_time_to_advance ( int  stage_num)

Should briefing advance to the next stage?

Definition at line 2357 of file missionbriefcommon.cpp.

void brief_unload_anims ( )

Definition at line 2144 of file missionbriefcommon.cpp.

bool brief_verify_color_tag ( char  color_tag)

Definition at line 1417 of file missionbriefcommon.cpp.

void brief_voice_init ( )

Initialize the array of handles to the different voice streams

Definition at line 2183 of file missionbriefcommon.cpp.

void brief_voice_load_all ( )

Open and pre-load the stream buffers for the different voice streams

Definition at line 2215 of file missionbriefcommon.cpp.

void brief_voice_pause ( int  stage_num)

Pause playback of the voice for a particular briefing stage, to resume just call brief_voice_unpause() again

Definition at line 2292 of file missionbriefcommon.cpp.

void brief_voice_play ( int  stage_num)

Start playback of the voice for a particular briefing stage

Definition at line 2247 of file missionbriefcommon.cpp.

void brief_voice_stop ( int  stage_num)

Stop playback of the voice for a particular briefing stage

Definition at line 2279 of file missionbriefcommon.cpp.

void brief_voice_unload_all ( )

Close all the briefing voice streams

Definition at line 2232 of file missionbriefcommon.cpp.

void brief_voice_unpause ( int  stage_num)

Definition at line 2301 of file missionbriefcommon.cpp.

int camera_pos_past_target ( vec3d start,
vec3d current,
vec3d dest 

Definition at line 1802 of file missionbriefcommon.cpp.

void cmd_brief_reset ( )

Definition at line 2336 of file missionbriefcommon.cpp.

void debrief_reset ( )

Definition at line 517 of file missionbriefcommon.cpp.

void get_camera_limits ( const matrix start_camera,
const matrix end_camera,
float  time,
vec3d acc_max,
vec3d w_max 

Definition at line 2005 of file vecmat.cpp.

void interpolate_matrix ( matrix result,
matrix goal,
matrix start,
float  elapsed_time,
float  total_time 

Interpolate between matrices. elapsed_time/total_time gives percentage of interpolation between cur and goal.

Definition at line 1821 of file missionbriefcommon.cpp.

bool is_a_word_separator ( char  character)

Checks if a character is a word separator

characterthe character to be analysed.
true when the given character is a word separator, and false when the character is part of a word.

Definition at line 1436 of file missionbriefcommon.cpp.

void mission_brief_common_init ( )

Does one time initialization of the briefing and debriefing structures. Namely setting all malloc'ble pointers to NULL. Called once at game startup.

Definition at line 375 of file missionbriefcommon.cpp.

void mission_brief_common_reset ( )

Frees all the memory allocated in the briefing and debriefing structures and sets all pointers to NULL.

Definition at line 443 of file missionbriefcommon.cpp.

void mission_debrief_common_reset ( )

Split from above since we need to clear them separately

See also

Definition at line 484 of file missionbriefcommon.cpp.

Variable Documentation

int Brief_bmap_coords[GR_NUM_RESOLUTIONS][2]
Initial value:
= {
0, 115
0, 184

Definition at line 68 of file missionbriefcommon.cpp.

int Brief_grid_coords[GR_NUM_RESOLUTIONS][4]
Initial value:
= {
19, 147, 555, 232
30, 235, 888, 371

Definition at line 77 of file missionbriefcommon.cpp.

const char BRIEF_META_CHAR = '$'

Definition at line 139 of file missionbriefcommon.cpp.

int Brief_stage_text_coords[GR_NUM_RESOLUTIONS][2]
Initial value:
= {
138, 117
227, 194

Definition at line 95 of file missionbriefcommon.cpp.

int Brief_stage_text_coords_multi[GR_NUM_RESOLUTIONS][2]
Initial value:
= {
479, 385
821, 616

Definition at line 104 of file missionbriefcommon.cpp.

int Brief_static_coords[GR_NUM_RESOLUTIONS][2]
Initial value:
= {
10, 130
15, 208

Definition at line 59 of file missionbriefcommon.cpp.

char* Brief_static_name[GR_NUM_RESOLUTIONS]
Initial value:
= {

Definition at line 54 of file missionbriefcommon.cpp.

int Brief_text_coords[GR_NUM_RESOLUTIONS][4]
Initial value:
= {
28, 399, 395, 74
46, 637, 630, 120

Definition at line 86 of file missionbriefcommon.cpp.

int Brief_text_max_lines[GR_NUM_RESOLUTIONS]
Initial value:
= {
8, 13

Definition at line 113 of file missionbriefcommon.cpp.

const float BRIEF_TEXT_WIPE_TIME = 1.5f
float Brief_text_wipe_time_elapsed

Definition at line 195 of file missionbriefcommon.cpp.

int Brief_voices[MAX_BRIEF_STAGES]

Definition at line 248 of file missionbriefcommon.cpp.

briefing* Briefing

Definition at line 127 of file missionbriefcommon.cpp.

SCP_vector<briefing_icon_info> Briefing_icon_info

Definition at line 253 of file missionbriefcommon.cpp.

int Briefing_voice_enabled =1

Definition at line 130 of file missionbriefcommon.cpp.

briefing Briefings[MAX_TVT_TEAMS]

Definition at line 125 of file missionbriefcommon.cpp.

brief_screen bscreen

Definition at line 42 of file missionbriefcommon.cpp.

cmd_brief Cmd_briefs[MAX_TVT_TEAMS]

Definition at line 251 of file missionbriefcommon.cpp.

int Cur_brief_id

Definition at line 137 of file missionbriefcommon.cpp.

cmd_brief* Cur_cmd_brief

Definition at line 250 of file missionbriefcommon.cpp.

debriefing* Debriefing

Definition at line 128 of file missionbriefcommon.cpp.

debriefing Debriefings[MAX_TVT_TEAMS]

Definition at line 126 of file missionbriefcommon.cpp.

Definition at line 244 of file missionbriefcommon.cpp.


Definition at line 141 of file missionbriefcommon.cpp.

icon_move_info Icon_move_list

Definition at line 232 of file missionbriefcommon.cpp.

Definition at line 231 of file missionbriefcommon.cpp.

int Num_brief_text_lines[MAX_TEXT_STREAMS]

Definition at line 177 of file missionbriefcommon.cpp.

int Num_fade_icons

Definition at line 245 of file missionbriefcommon.cpp.

int Top_brief_text_line

Definition at line 178 of file missionbriefcommon.cpp.