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/MissionUI/MissionBrief.cpp $
15 * C module that contains code to display the mission briefing to the player
18 * Revision 1.11 2005/08/12 08:58:41 taylor
19 * fix the strange mouse click issues on briefing, ship select and weapon select screens
21 * Revision 1.10 2005/03/29 02:18:47 taylor
22 * Various 64-bit platform fixes
23 * Fix compiler errors with MAKE_FS1 and fix gr_set_bitmap() too
24 * Make sure that turrets can fire at asteroids for FS1 (needed for a couple missions)
25 * Streaming audio support (big thanks to Pierre Willenbrock!!)
26 * Removed dependance on strings.tbl for FS1 since we don't actually need it now
28 * Revision 1.9 2004/09/20 01:31:44 theoddone33
31 * Revision 1.8 2004/07/04 11:31:43 taylor
32 * amd64 support, compiler warning fixes, don't use software rendering
34 * Revision 1.7 2003/05/25 02:30:43 taylor
37 * Revision 1.6 2003/01/30 19:55:33 relnev
38 * remove second bmpman.h include (Taylor Richards)
40 * Revision 1.5 2002/06/17 06:33:09 relnev
41 * ryan's struct patch for gcc 2.95
43 * Revision 1.4 2002/06/09 04:41:22 relnev
44 * added copyright header
46 * Revision 1.3 2002/06/02 04:26:34 relnev
49 * Revision 1.2 2002/05/07 03:16:46 theoddone33
50 * The Great Newline Fix
52 * Revision 1.1.1.1 2002/05/03 03:28:10 root
56 * 48 10/14/99 2:51p Jefff
59 * 47 10/13/99 3:23p Jefff
60 * fixed unnumbered XSTRs
62 * 46 9/12/99 8:09p Dave
63 * Fixed problem where skip-training button would cause mission messages
64 * not to get paged out for the current mission.
66 * 45 9/09/99 3:40p Jefff
67 * no exit loop outisde of campaign mode
69 * 44 9/07/99 6:53p Jefff
70 * functionality to break out of a loop
72 * 43 9/06/99 6:38p Dave
73 * Improved CD detection code.
75 * 42 9/03/99 10:57a Jefff
78 * 41 8/30/99 5:30p Jefff
79 * fixed "more" being cut off in d3d
81 * 40 8/30/99 10:29a Jefff
82 * added autocenter flag to closup rendering
84 * 39 8/19/99 11:33a Dave
87 * 38 8/19/99 10:59a Dave
88 * Packet loss detection.
90 * 37 8/16/99 4:05p Dave
91 * Big honking checkin.
93 * 36 8/16/99 9:48a Jefff
94 * all clicks on briefing icons should now register
96 * 35 8/10/99 7:29p Jefff
97 * added mission title to briefing screen
99 * 34 8/03/99 1:34a Andsager
100 * fix skip training mission (again)
102 * 33 8/02/99 12:01p Jefff
103 * fixed "skip training" text pos
105 * 32 7/30/99 5:42p Jasenw
106 * Fixed coords for skip training button.
108 * 31 7/29/99 10:50p Dave
109 * Oops. Accidentally blew away some interface text changes.
111 * 30 7/29/99 10:48p Dave
113 * 29 7/29/99 3:05p Andsager
114 * Add skip training text. and properly skip.
116 * 28 7/24/99 6:07p Jefff
117 * Added "lock" text to multiplayer lock button
119 * 27 7/21/99 10:51a Jefff
120 * added "more" indicator to briefing text box
122 * 26 7/19/99 3:01p Dave
123 * Fixed icons. Added single transport icon.
125 * 25 7/18/99 5:20p Dave
126 * Jump node icon. Fixed debris fogging. Framerate warning stuff.
128 * 24 7/16/99 1:49p Dave
129 * 8 bit aabitmaps. yay.
131 * 23 7/15/99 9:20a Andsager
132 * FS2_DEMO initial checkin
134 * 22 7/09/99 5:54p Dave
135 * Seperated cruiser types into individual types. Added tons of new
136 * briefing icons. Campaign screen.
138 * 21 6/29/99 7:39p Dave
139 * Lots of small bug fixes.
141 * 20 6/11/99 11:13a Dave
142 * last minute changes before press tour build.
144 * 19 6/04/99 1:18p Dave
145 * Fixed briefing model rendering problems. Made show background option in
146 * fred toggle nebula rendering.
148 * 18 5/07/99 10:34a Andsager
149 * Make red alert work in FS2
151 * 17 4/23/99 12:01p Johnson
152 * Added SIF_HUGE_SHIP
154 * 16 3/25/99 2:45p Neilk
157 * 15 2/11/99 3:08p Dave
158 * PXO refresh button. Very preliminary squad war support.
160 * 14 2/05/99 7:19p Neilk
161 * Removed black part from mission screen, fixed info text coords
163 * 13 2/02/99 4:35p Neilk
164 * fixed coordinate problem where primary goals was on top of interface in
167 * 12 2/01/99 5:55p Dave
168 * Removed the idea of explicit bitmaps for buttons. Fixed text
169 * highlighting for disabled gadgets.
171 * 11 1/30/99 7:32p Neilk
172 * Fixed coords problems for mission briefing screens
174 * 10 1/30/99 5:08p Dave
175 * More new hi-res stuff.Support for nice D3D textures.
177 * 9 1/30/99 1:29a Dave
178 * Fixed nebula thumbnail problem. Full support for 1024x768 choose pilot
179 * screen. Fixed beam weapon death messages.
181 * 8 1/29/99 4:17p Dave
182 * New interface screens.
184 * 7 1/13/99 7:19p Neilk
185 * Converted Mission Brief, Barracks, Synch to high res support
187 * 6 12/18/98 1:13a Dave
188 * Rough 1024x768 support for Direct3D. Proper detection and usage through
191 * 5 11/30/98 1:07p Dave
192 * 16 bit conversion, first run.
194 * 4 11/20/98 4:08p Dave
195 * Fixed flak effect in multiplayer.
197 * 3 10/13/98 9:28a Dave
198 * Started neatening up freespace.h. Many variables renamed and
199 * reorganized. Added AlphaColors.[h,cpp]
201 * 2 10/07/98 10:53a Dave
204 * 1 10/07/98 10:49a Dave
206 * 114 9/17/98 3:08p Dave
207 * PXO to non-pxo game warning popup. Player icon stuff in create and join
208 * game screens. Upped server count refresh time in PXO to 35 secs (from
211 * 113 6/19/98 3:52p Lawrance
212 * Don't use large text in popup, since it is missing large foreign chars
214 * 112 6/09/98 5:17p Lawrance
215 * French/German localization
217 * 111 6/09/98 10:31a Hoffoss
218 * Created index numbers for all xstr() references. Any new xstr() stuff
219 * added from here on out should be added to the end if the list. The
220 * current list count can be found in FreeSpace.cpp (search for
223 * 110 6/01/98 11:43a John
224 * JAS & MK: Classified all strings for localization.
226 * 109 5/22/98 10:44a Lawrance
227 * put in case label to suppress warning
229 * 108 5/19/98 11:35p Lawrance
230 * Play sound for briefing control button presses
232 * 107 5/19/98 8:47p Lawrance
233 * Set proper distance for jump nodes
235 * 106 5/19/98 8:35p Dave
236 * Revamp PXO channel listing system. Send campaign goals/events to
237 * clients for evaluation. Made lock button pressable on all screens.
239 * 105 5/12/98 2:16p Hoffoss
240 * Added debug code to switch models of closeup icon to more easily check
241 * positions and zooms.
243 * 104 5/06/98 11:50p Lawrance
244 * Clean up help overlay code for loadout screens
246 * 103 5/06/98 8:03p Allender
247 * AL: only free pointers in brief_compact_stages if non-null
249 * 102 5/05/98 4:48p Lawrance
250 * Fix bug with launching closeup icon when pause button is pressed
252 * 101 4/29/98 1:45p Lawrance
253 * Print out mission filename if debug build, or if INTERPLAY QA defined
255 * 100 4/29/98 12:15a Lawrance
256 * reset demo trailer timer when briefing moves to a new stage
258 * 98 4/25/98 11:55p Lawrance
259 * fix bug with the auto-advance button
261 * 97 4/25/98 3:49p Lawrance
262 * Save briefing auto-advance pref
264 * 96 4/25/98 12:00p Lawrance
265 * disable advance keypress for 1/2 second after autoadvance
267 * 95 4/22/98 7:24p Dave
268 * Made sure the "player/ships" locked button for multiplayer appears on
269 * all briefing screens.
271 * 94 4/20/98 3:53p Lawrance
272 * Fix various bugs with auto-advancing through briefings.
274 * 93 4/19/98 12:11p Lawrance
275 * add new art for pause button in the briefing
277 * 92 4/17/98 10:39p Andsager
278 * AL: Fix bug with auto-advance of briefing stages.
280 * 91 4/16/98 8:05p Lawrance
281 * Don't show closeup icon for planets
283 * 90 4/15/98 5:17p Lawrance
284 * fix bug with skip training
290 #include "freespace.h"
291 #include "missionload.h"
292 #include "missionscreencommon.h"
293 #include "missionshipchoice.h"
294 #include "missionparse.h"
295 #include "missiongoals.h"
296 #include "gamesequence.h"
305 #include "linklist.h"
310 #include "audiostr.h"
312 #include "eventmusic.h"
313 #include "missioncampaign.h"
316 #include "snazzyui.h"
318 #include "missionbrief.h"
319 #include "missionbriefcommon.h"
320 #include "missiongrid.h"
321 #include "multimsgs.h"
323 #include "contexthelp.h"
325 #include "multiteamselect.h"
327 #include "asteroid.h"
330 #include "alphacolors.h"
332 #include "missionmessage.h"
335 #define OBJECTIVES_X 65
336 #define OBJECTIVES_Y 137
337 #define OBJECTIVES_W 508
338 #define OBJECTIVES_H 233
341 static int Brief_goals_coords[GR_NUM_RESOLUTIONS][4] = {
346 65,152,508,211 // GR_640
350 104,243,813,332 // GR_1024
354 static int Current_brief_stage; // what stage of the briefing we're on
355 static int Last_brief_stage;
356 static int Num_brief_stages;
357 static int Brief_multiplayer = FALSE;
359 static int Brief_last_auto_advance = 0; // timestamp of last auto-advance
361 // for managing the scene cut transition
362 static int Quick_transition_stage;
363 static int Start_fade_up_anim, Start_fade_down_anim;
364 static int Brief_playing_fade_sound;
367 int Briefing_music_handle = -1;
368 int Briefing_music_begin_timestamp = 0;
370 // --------------------------------------------------------------------------------------
371 // Module scope globals
372 // --------------------------------------------------------------------------------------
374 static MENU_REGION Briefing_select_region[NUM_BREIFING_REGIONS];
375 static int Num_briefing_regions;
377 // For closeup display
378 #define ONE_REV_TIME 6 // time (sec) for one revolution
379 #define MAX_ANG_CHG 0.15f
381 static int Closeup_coords[GR_NUM_RESOLUTIONS][4] = {
383 203, 151, 200, 213 // GR_640
386 325, 241, 200, 213 // GR_1024
390 static int Brief_infobox_coords[GR_NUM_RESOLUTIONS][2] = {
403 static char *Brief_infobox_filename[GR_NUM_RESOLUTIONS] = {
408 static char *Brief_filename[GR_NUM_RESOLUTIONS] = {
413 static char *Brief_multi_filename[GR_NUM_RESOLUTIONS] = {
415 "Brief", // use the standard bitmap and slap the chatbox on later
422 static char *Brief_mask_filename[GR_NUM_RESOLUTIONS] = {
427 static char *Brief_multi_mask_filename[GR_NUM_RESOLUTIONS] = {
433 static char *Brief_win_filename[GR_NUM_RESOLUTIONS] = {
443 // coordinate inidices
444 #define BRIEF_X_COORD 0
445 #define BRIEF_Y_COORD 1
446 #define BRIEF_W_COORD 2
447 #define BRIEF_H_COORD 3
449 //static int Closeup_region[4] = {220,132,420,269};
450 int Closeup_region[GR_NUM_RESOLUTIONS][4] = {
459 char *Closeup_background_filename[GR_NUM_RESOLUTIONS] = {
460 NOX("BriefPop"), // GR_640
461 NOX("2_BriefPop") // GR_1024
464 char *Closeup_button_filename[GR_NUM_RESOLUTIONS] = {
465 NOX("BPB_00"), // GR_640
466 NOX("2_BPB_00"), // GR_1024
469 int Closeup_button_hotspot = 14;
471 //static int Closeup_button_coords[2] = {CLOSEUP_X+164,CLOSEUP_Y+227};
472 int Closeup_button_coords[GR_NUM_RESOLUTIONS][2] = {
473 { 374, 316 }, // GR_640
474 { 599, 506 } // GR_1024
477 UI_BUTTON Closeup_close_button;
478 int Closeup_bitmap=-1;
479 int Closeup_one_revolution_time=ONE_REV_TIME;
481 brief_icon *Closeup_icon;
482 angles Closeup_angles;
483 matrix Closeup_orient;
485 int Closeup_font_height;
486 int Closeup_x1, Closeup_y1;
488 // used for the 3d view of a closeup ship
490 vector Closeup_cam_pos;
492 // Mask bitmap pointer and Mask bitmap_id
493 bitmap* BriefingMaskPtr; // bitmap pointer to the briefing select mask bitmap
494 ubyte* BriefingMaskData; // pointer to actual bitmap data
495 int Briefing_mask_w, Briefing_mask_h;
496 int BriefingMaskBitmap; // bitmap id of the briefing mask bitmap
497 int Brief_inited = FALSE;
499 // --------------------------------------------------------------------------------------
500 // Briefing specific UI
501 // --------------------------------------------------------------------------------------
502 #define BRIEF_LAST_STAGE_MASK 7
503 #define BRIEF_NEXT_STAGE_MASK 8
504 #define BRIEF_PREV_STAGE_MASK 9
505 #define BRIEF_FIRST_STAGE_MASK 10
506 #define BRIEF_TEXT_SCROLL_UP_MASK 11
507 #define BRIEF_TEXT_SCROLL_DOWN_MASK 12
508 #define BRIEF_SKIP_TRAINING_MASK 15
509 #define BRIEF_PAUSE_MASK 16
512 static char *Brief_mask_single[GR_NUM_RESOLUTIONS] = {
514 "2_brief-m" // GR_1024
517 static char *Brief_mask_multi[GR_NUM_RESOLUTIONS] = {
518 "briefmulti-m", // GR_640
519 "2_briefmulti-m" // GR_1024
523 struct brief_buttons {
529 UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
531 brief_buttons(char *name, int x1, int y1, int xt1, int yt1, int h, int r = 0) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h), repeat(r) {}
534 int Brief_grid_bitmap = -1;
535 int Brief_text_bitmap = -1;
537 int Brief_multitext_bitmap = -1;
538 int Brief_background_bitmap =-1;
541 static int MapWin01 = -1;
542 static int MapWin02 = -1;
543 static int MapWin03 = -1;
544 static int MapWin04 = -1;
547 UI_WINDOW Brief_ui_window;
549 // Briefing specific buttons
550 #define NUM_BRIEF_BUTTONS 10
552 brief_buttons Brief_buttons[GR_NUM_RESOLUTIONS][NUM_BRIEF_BUTTONS] = {
555 brief_buttons("BRB_08", 356, 351, -1, -1, 8), // vcr - fastforward
556 brief_buttons("BRB_09", 331, 351, -1, -1, 9), // vcr - play forwards
557 brief_buttons("BRB_10", 277, 351, -1, -1, 10), // vcr - play backwards
558 brief_buttons("BRB_11", 253, 351, -1, -1, 11), // vcr - reverse
559 brief_buttons("BRB_12", 0, 400, -1, -1, 12), // scroll up
560 brief_buttons("BRB_13", 0, 442, -1, -1, 13), // scroll down
561 brief_buttons("BRB_15", 562, 0, -1, -1, 15), // skip training
562 brief_buttons("BRB_16", 304, 351, -1, -1, 16), // vcr - pause
563 brief_buttons("TSB_34", 601, 344, -1, -1, 50), // multi lock
564 brief_buttons("BRB_15", 562, 0, -1, -1, 15) // exit loop
566 brief_buttons("BRB_08", 110, 116, 117, 157, 8),
567 brief_buttons("BRB_09", 84, 116, 117, 157, 9),
568 brief_buttons("BRB_10", 29, 116, 117, 157, 10),
569 brief_buttons("BRB_11", 4, 116, 117, 157, 11),
570 brief_buttons("BRB_12", 0, 405, 117, 157, 12),
571 brief_buttons("BRB_13", 0, 447, 117, 157, 13),
572 brief_buttons("BRB_15", 562, 0, 117, 157, 15), // skip training
573 brief_buttons("BRB_16", 56, 116, 117, 157, 16),
574 brief_buttons("TSB_34", 603, 374, 117, 157, 34),
575 brief_buttons("BRB_15", 562, 0, 117, 157, 15) // exit loop
579 brief_buttons("2_BRB_08", 175, 187, 117, 157, 8),
580 brief_buttons("2_BRB_09", 135, 187, 117, 157, 9),
581 brief_buttons("2_BRB_10", 47, 187, 117, 157, 10),
582 brief_buttons("2_BRB_11", 8, 187, 117, 157, 11),
583 brief_buttons("2_BRB_12", 0, 649, 117, 157, 12),
584 brief_buttons("2_BRB_13", 0, 716, 117, 157, 13),
585 brief_buttons("2_BRB_15", 900, 0, 117, 157, 15), // skip training
586 brief_buttons("2_BRB_16", 91, 187, 117, 157, 16),
587 brief_buttons("2_TSB_34", 966, 599, 117, 157, 34),
588 brief_buttons("2_BRB_15", 900, 0, 117, 157, 15) // exit loop
594 #define BRIEF_SELECT_NUM_TEXT 3
596 UI_XSTR Brief_select_text[GR_NUM_RESOLUTIONS][BRIEF_SELECT_NUM_TEXT] = {
598 { "Lock", 1270, 602, 364, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[0][BRIEF_BUTTON_MULTI_LOCK].button },
599 { "Skip Training", 1442, 467, 7, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[0][BRIEF_BUTTON_SKIP_TRAINING].button },
600 { "Exit Loop", 1477, 490, 7, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[0][BRIEF_BUTTON_EXIT_LOOP].button }
603 { "Lock", 1270, 964, 584, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[1][BRIEF_BUTTON_MULTI_LOCK].button },
604 { "Skip Training", 1442, 805, 12, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[1][BRIEF_BUTTON_SKIP_TRAINING].button },
605 { "Exit Loop", 1477, 830, 12, UI_XSTR_COLOR_GREEN, -1, &Brief_buttons[1][BRIEF_BUTTON_EXIT_LOOP].button }
610 // coordinates for briefing title -- the x value is for the RIGHT side of the text
611 static int Title_coords[GR_NUM_RESOLUTIONS][2] = {
615 {575, 117}, // GR_640
617 {918, 194} // GR_1024
620 // coordinates for briefing title in multiplayer briefings -- the x value is for the LEFT side of the text
621 // third coord is max width of area for it to fit into (it is force fit there)
622 static int Title_coords_multi[GR_NUM_RESOLUTIONS][3] = {
626 {1, 105, 190}, // GR_640
628 {1, 174, 304} // GR_1024
631 // briefing line widths
632 int Brief_max_line_width[GR_NUM_RESOLUTIONS] = {
633 MAX_BRIEF_LINE_W_640, MAX_BRIEF_LINE_W_1024
636 // --------------------------------------------------------------------------------------
637 // Forward declarations
638 // --------------------------------------------------------------------------------------
639 int brief_setup_closeup(brief_icon *bi);
640 void brief_maybe_blit_scene_cut(float frametime);
641 void brief_transition_reset();
643 char *brief_tooltip_handler(char *str)
645 if (!stricmp(str, NOX("@close"))) {
647 return XSTR( "Close", 428);
653 // brief_skip_training_pressed()
655 // called when the skip training button on the briefing screen is hit. When this happens,
656 // do a popup, then move to the next mission in the campaign.
657 void brief_skip_training_pressed()
661 val = popup(PF_USE_NEGATIVE_ICON | PF_USE_AFFIRMATIVE_ICON,2,POPUP_NO,POPUP_YES,XSTR( "Skip Training\n\n\n\nAre you sure you want to skip this training mission?", 429));
663 // val is 0 when we hit no (first on the list)
664 // AL: also, -1 is returned when ESC is hit
669 // page out mission messages
670 message_mission_shutdown();
672 if ( !(Game_mode & GM_CAMPAIGN_MODE) ){
673 gameseq_post_event( GS_EVENT_MAIN_MENU );
676 // tricky part. Need to move to the next mission in the campaign.
677 mission_goal_mark_objectives_complete();
678 mission_goal_fail_incomplete();
679 mission_campaign_store_goals_and_events();
681 mission_campaign_eval_next_mission();
682 mission_campaign_mission_over();
685 if(game_do_cd_mission_check(Game_current_mission_filename)){
686 gameseq_post_event( GS_EVENT_START_GAME );
688 gameseq_post_event( GS_EVENT_MAIN_MENU );
692 #if defined(FS2_DEMO) || defined(FS1_DEMO)
693 extern void demo_reset_trailer_timer();
695 // --------------------------------------------------------------------------------------
696 // brief_do_next_pressed()
699 void brief_do_next_pressed(int play_sound)
702 now = timer_get_milliseconds();
704 if ( (now - Brief_last_auto_advance) < 500 ) {
708 #if defined(FS2_DEMO) || defined(FS1_DEMO)
709 demo_reset_trailer_timer();
712 Current_brief_stage++;
713 if ( Current_brief_stage >= Num_brief_stages ) {
714 Current_brief_stage = Num_brief_stages - 1;
715 gamesnd_play_iface(SND_GENERAL_FAIL);
716 if ( Quick_transition_stage != -1 )
717 brief_transition_reset();
720 gamesnd_play_iface(SND_BRIEF_STAGE_CHG);
724 Assert(Current_brief_stage >= 0);
727 // --------------------------------------------------------------------------------------
728 // brief_do_prev_pressed()
731 void brief_do_prev_pressed()
733 Current_brief_stage--;
734 if ( Current_brief_stage < 0 ) {
735 Current_brief_stage = 0;
736 gamesnd_play_iface(SND_GENERAL_FAIL);
737 if ( Quick_transition_stage != -1 )
738 brief_transition_reset();
740 gamesnd_play_iface(SND_BRIEF_STAGE_CHG);
742 Assert(Current_brief_stage >= 0);
746 // --------------------------------------------------------------------------------------
747 // brief_do_start_pressed()
750 void brief_do_start_pressed()
752 if ( Current_brief_stage != 0 ) {
753 gamesnd_play_iface(SND_BRIEF_STAGE_CHG);
754 Current_brief_stage = 0;
755 if ( Quick_transition_stage != -1 )
756 brief_transition_reset();
758 gamesnd_play_iface(SND_GENERAL_FAIL);
760 Assert(Current_brief_stage >= 0);
763 // --------------------------------------------------------------------------------------
764 // brief_do_end_pressed()
767 void brief_do_end_pressed()
769 if ( Current_brief_stage != Num_brief_stages - 1 ) {
770 gamesnd_play_iface(SND_BRIEF_STAGE_CHG);
771 Current_brief_stage = Num_brief_stages - 1;
772 if ( Quick_transition_stage != -1 )
773 brief_transition_reset();
776 gamesnd_play_iface(SND_GENERAL_FAIL);
778 Assert(Current_brief_stage >= 0);
782 void brief_scroll_up_text()
784 Top_brief_text_line--;
785 if ( Top_brief_text_line < 0 ) {
786 Top_brief_text_line = 0;
787 gamesnd_play_iface(SND_GENERAL_FAIL);
789 gamesnd_play_iface(SND_SCROLL);
793 void brief_scroll_down_text()
795 Top_brief_text_line++;
796 if ( (Num_brief_text_lines[0] - Top_brief_text_line) < Brief_text_max_lines[gr_screen.res]) {
797 Top_brief_text_line--;
798 gamesnd_play_iface(SND_GENERAL_FAIL);
800 gamesnd_play_iface(SND_SCROLL);
805 // handles the exit loop option
806 void brief_exit_loop_pressed()
808 int val = popup(PF_USE_NEGATIVE_ICON | PF_USE_AFFIRMATIVE_ICON, 2, POPUP_NO, POPUP_YES, XSTR( "Exit Loop\n\n\n\nAre you sure you want to leave the mission loop?", 1489));
810 // bail if esc hit or no clicked
815 // handle the details
816 // this also posts the start game event
817 mission_campaign_exit_loop();
821 // -------------------------------------------------------------------------------------
822 // brief_select_button_do() do the button action for the specified pressed button
824 void brief_button_do(int i)
827 case BRIEF_BUTTON_LAST_STAGE:
828 brief_do_end_pressed();
831 case BRIEF_BUTTON_NEXT_STAGE:
832 brief_do_next_pressed(1);
835 case BRIEF_BUTTON_PREV_STAGE:
836 brief_do_prev_pressed();
839 case BRIEF_BUTTON_FIRST_STAGE:
840 brief_do_start_pressed();
843 case BRIEF_BUTTON_SCROLL_UP:
844 brief_scroll_up_text();
847 case BRIEF_BUTTON_SCROLL_DOWN:
848 brief_scroll_down_text();
851 case BRIEF_BUTTON_PAUSE:
852 gamesnd_play_iface(SND_USER_SELECT);
853 Player->auto_advance ^= 1;
856 case BRIEF_BUTTON_SKIP_TRAINING:
857 brief_skip_training_pressed();
860 case BRIEF_BUTTON_EXIT_LOOP:
861 brief_exit_loop_pressed();
864 case BRIEF_BUTTON_MULTI_LOCK:
865 Assert(Game_mode & GM_MULTIPLAYER);
866 // the "lock" button has been pressed
867 multi_ts_lock_pressed();
869 // disable the button if it is now locked
870 if(multi_ts_is_locked()){
871 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.disable();
877 // -------------------------------------------------------------------
878 // brief_check_buttons()
880 // Iterate through the briefing buttons, checking if they are pressed
882 void brief_check_buttons()
887 for (i=0; i<NUM_BRIEF_BUTTONS; i++) {
888 b = &Brief_buttons[gr_screen.res][i].button;
889 if ( b->pressed() ) {
890 common_flash_button_init();
895 if (Closeup_close_button.pressed()) {
896 brief_turn_off_closeup_icon();
900 // -------------------------------------------------------------------
901 // brief_redraw_pressed_buttons()
903 // Redraw any briefing buttons that are pressed down. This function is needed
904 // since we sometimes need to draw pressed buttons last to ensure the entire
905 // button gets drawn (and not overlapped by other buttons)
907 void brief_redraw_pressed_buttons()
912 common_redraw_pressed_buttons();
914 for ( i = 0; i < NUM_BRIEF_BUTTONS; i++ ) {
915 b = &Brief_buttons[gr_screen.res][i].button;
916 if ( b->button_down() ) {
921 if ( !Player->auto_advance ) {
922 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PAUSE].button.draw_forced(2);
926 void brief_buttons_init()
931 //if ( Briefing->num_stages <= 0 )
934 for ( i = 0; i < NUM_BRIEF_BUTTONS; i++ ) {
935 b = &Brief_buttons[gr_screen.res][i].button;
936 b->create( &Brief_ui_window, "", Brief_buttons[gr_screen.res][i].x, Brief_buttons[gr_screen.res][i].y, 60, 30, 0, 1 );
937 // set up callback for when a mouse first goes over a button
938 b->set_highlight_action( common_play_highlight_sound );
940 if ((i == BRIEF_BUTTON_SKIP_TRAINING) || (i == BRIEF_BUTTON_EXIT_LOOP)) {
941 b->set_bmaps(Brief_buttons[gr_screen.res][i].filename, 3, 0);
943 b->set_bmaps(Brief_buttons[gr_screen.res][i].filename);
945 b->link_hotspot(Brief_buttons[gr_screen.res][i].hotspot);
950 for(i=0; i<BRIEF_SELECT_NUM_TEXT; i++) {
951 Brief_ui_window.add_XSTR(&Brief_select_text[gr_screen.res][i]);
955 // Hide the 'skip training' button by default. Only enable and unhide if we are playing a training
957 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SKIP_TRAINING].button.disable();
958 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SKIP_TRAINING].button.hide();
959 if ( (Game_mode & GM_NORMAL) && (The_mission.game_type & MISSION_TYPE_TRAINING) ) {
960 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SKIP_TRAINING].button.enable();
961 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SKIP_TRAINING].button.unhide();
964 // Hide the 'exit loop' button by default. Only enable and unhide if we are playing a loop
966 Brief_buttons[gr_screen.res][BRIEF_BUTTON_EXIT_LOOP].button.disable();
967 Brief_buttons[gr_screen.res][BRIEF_BUTTON_EXIT_LOOP].button.hide();
968 if ( (Game_mode & GM_NORMAL) && (Campaign.loop_enabled) && (Game_mode & GM_CAMPAIGN_MODE) ) {
969 Brief_buttons[gr_screen.res][BRIEF_BUTTON_EXIT_LOOP].button.enable();
970 Brief_buttons[gr_screen.res][BRIEF_BUTTON_EXIT_LOOP].button.unhide();
973 // maybe disable the multi-lock button
974 if(!(Game_mode & GM_MULTIPLAYER)){
975 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.hide();
976 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.disable();
978 // if we're not the host of the game (or a tema captain in team vs. team mode), disable the lock button
979 if(Netgame.type_flags & NG_TYPE_TEAM){
980 if(!(Net_player->flags & NETINFO_FLAG_TEAM_CAPTAIN)){
981 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.disable();
984 if(!(Net_player->flags & NETINFO_FLAG_GAME_HOST)){
985 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.disable();
990 // create close button for closeup popup
991 Closeup_close_button.create( &Brief_ui_window, "", Closeup_button_coords[gr_screen.res][BRIEF_X_COORD], Closeup_button_coords[gr_screen.res][BRIEF_Y_COORD], 60, 30, 0, 1 );
992 Closeup_close_button.set_highlight_action( common_play_highlight_sound );
993 Closeup_close_button.set_bmaps(Closeup_button_filename[gr_screen.res]);
994 Closeup_close_button.link_hotspot(Closeup_button_hotspot);
996 // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
997 Brief_buttons[gr_screen.res][BRIEF_BUTTON_LAST_STAGE].button.set_hotkey(KEY_SHIFTED|KEY_RIGHT);
998 Brief_buttons[gr_screen.res][BRIEF_BUTTON_NEXT_STAGE].button.set_hotkey(KEY_RIGHT);
999 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PREV_STAGE].button.set_hotkey(KEY_LEFT);
1000 Brief_buttons[gr_screen.res][BRIEF_BUTTON_FIRST_STAGE].button.set_hotkey(KEY_SHIFTED|KEY_LEFT);
1001 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_UP].button.set_hotkey(KEY_UP);
1002 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_DOWN].button.set_hotkey(KEY_DOWN);
1004 Closeup_close_button.disable();
1005 Closeup_close_button.hide();
1007 // if we have no briefing stages, hide and disable briefing buttons
1008 if(Num_brief_stages <= 0){
1009 Brief_buttons[gr_screen.res][BRIEF_BUTTON_LAST_STAGE].button.disable();
1010 Brief_buttons[gr_screen.res][BRIEF_BUTTON_LAST_STAGE].button.hide();
1011 Brief_buttons[gr_screen.res][BRIEF_BUTTON_NEXT_STAGE].button.disable();
1012 Brief_buttons[gr_screen.res][BRIEF_BUTTON_NEXT_STAGE].button.hide();
1013 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PREV_STAGE].button.disable();
1014 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PREV_STAGE].button.hide();
1015 Brief_buttons[gr_screen.res][BRIEF_BUTTON_FIRST_STAGE].button.disable();
1016 Brief_buttons[gr_screen.res][BRIEF_BUTTON_FIRST_STAGE].button.hide();
1017 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_UP].button.disable();
1018 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_UP].button.hide();
1019 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_DOWN].button.disable();
1020 Brief_buttons[gr_screen.res][BRIEF_BUTTON_SCROLL_DOWN].button.hide();
1021 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PAUSE].button.disable();
1022 Brief_buttons[gr_screen.res][BRIEF_BUTTON_PAUSE].button.hide();
1026 // --------------------------------------------------------------------------------------
1027 // brief_get_closeup_icon()
1030 brief_icon *brief_get_closeup_icon()
1032 return Closeup_icon;
1035 // stop showing the closeup view of an icon
1036 void brief_turn_off_closeup_icon()
1039 if ( Closeup_icon != NULL ) {
1040 gamesnd_play_iface(SND_BRIEF_ICON_SELECT);
1041 Closeup_icon = NULL;
1042 Closeup_close_button.disable();
1043 Closeup_close_button.hide();
1047 // --------------------------------------------------------------------------------------
1048 // brief_load_bitmaps()
1051 void brief_load_bitmaps()
1053 Brief_text_bitmap = bm_load(Brief_infobox_filename[gr_screen.res]);
1054 Brief_grid_bitmap = bm_load(Brief_win_filename[gr_screen.res]);
1056 if ( Closeup_bitmap == -1 ) {
1057 Closeup_bitmap = bm_load(Closeup_background_filename[gr_screen.res]);
1061 MapWin01 = bm_load(NOX("MapWin01"));
1062 MapWin02 = bm_load(NOX("MapWin02"));
1063 MapWin03 = bm_load(NOX("MapWin03"));
1064 MapWin04 = bm_load(NOX("MapWin04"));
1068 // --------------------------------------------------------------------------------------
1072 void brief_ui_init()
1074 if(Game_mode & GM_MULTIPLAYER) {
1075 Brief_background_bitmap = bm_load(Brief_multi_filename[gr_screen.res]);
1077 Brief_background_bitmap = bm_load(Brief_filename[gr_screen.res]);
1080 if ( Num_brief_stages <= 0 ){
1084 brief_load_bitmaps();
1088 // --------------------------------------------------------------------------------------
1089 // brief_set_default_closeup()
1092 void brief_set_default_closeup()
1097 bs = &Briefing->stages[0];
1099 if ( Briefing->num_stages <= 0 ) {
1100 Closeup_icon = NULL;
1104 if ( bs->num_icons <= 0 ) {
1105 Closeup_icon = NULL;
1109 // check for the first highlighted icons to have as the default closeup
1110 for ( i = 0; i < bs->num_icons; i++ ) {
1111 if ( bs->icons[i].flags & BI_HIGHLIGHT )
1115 if ( i == bs->num_icons ) {
1116 brief_setup_closeup(&bs->icons[0]);
1119 brief_setup_closeup(&bs->icons[i]);
1123 // funciton to evaluate the sexpressions of the briefing stages eliminating those stages
1124 // which shouldn't get shown
1125 void brief_compact_stages()
1130 if((Game_mode & GM_MULTIPLAYER) && (Netgame.campaign_mode == MP_CAMPAIGN) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
1131 Game_mode |= GM_CAMPAIGN_MODE;
1136 while ( num < Briefing->num_stages ) {
1137 result = eval_sexp( Briefing->stages[num].formula );
1139 if ( Briefing->stages[num].new_text ) {
1140 free( Briefing->stages[num].new_text );
1141 Briefing->stages[num].new_text = NULL;
1144 if ( Briefing->stages[num].icons ) {
1145 free( Briefing->stages[num].icons );
1146 Briefing->stages[num].icons = NULL;
1150 if ( Briefing->stages[num].lines ) {
1151 free( Briefing->stages[num].lines );
1152 Briefing->stages[num].lines = NULL;
1155 Briefing->stages[num].num_icons = 0;
1156 for ( i = num+1; i < Briefing->num_stages; i++ ) {
1157 Briefing->stages[i-1] = Briefing->stages[i];
1159 Briefing->num_stages--;
1166 if((Game_mode & GM_MULTIPLAYER) && (Netgame.campaign_mode == MP_CAMPAIGN) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
1167 Game_mode &= ~(GM_CAMPAIGN_MODE);
1173 // --------------------------------------------------------------------------------------
1176 int red_alert_mission(void);
1180 // Since first stage of briefing can take some time to arrive and play,
1181 // reset the trailer timer on briefing init.
1182 #if defined(FS2_DEMO) || defined(FS1_DEMO)
1183 demo_reset_trailer_timer();
1186 // for multiplayer, change the state in my netplayer structure
1187 // and initialize the briefing chat area thingy
1188 if ( Game_mode & GM_MULTIPLAYER ){
1189 Net_player->state = NETPLAYER_STATE_BRIEFING;
1192 // Non standard briefing in red alert mission
1193 if ( red_alert_mission() ) {
1194 gameseq_post_event(GS_EVENT_RED_ALERT);
1198 // get a pointer to the appropriate briefing structure
1199 if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
1200 Briefing = &Briefings[Net_player->p_info.team];
1202 Briefing = &Briefings[0];
1205 Brief_last_auto_advance = 0;
1207 brief_compact_stages(); // compact the briefing array to eliminate unused stages
1209 common_set_interface_palette("BriefingPalette");
1211 ship_stop_animation();
1212 set_active_ui(&Brief_ui_window);
1213 Current_screen = ON_BRIEFING_SELECT;
1214 brief_restart_text_wipe();
1215 common_flash_button_init();
1216 common_music_init(SCORE_BRIEFING);
1219 help_overlay_set_state(BR_OVERLAY,0);
1221 if ( Brief_inited == TRUE ) {
1222 common_buttons_maybe_reload(&Brief_ui_window); // AL 11-21-97: this is necessary since we may returning from the hotkey
1223 // screen, which can release common button bitmaps.
1224 common_reset_buttons();
1225 nprintf(("Alan","brief_init() returning without doing anything\n"));
1229 if (The_mission.game_type & MISSION_TYPE_TRAINING)
1230 Num_brief_stages = Briefing->num_stages;
1232 Num_brief_stages = Briefing->num_stages + 1;
1234 Current_brief_stage = 0;
1235 Last_brief_stage = 0;
1237 // init the scene-cut data
1238 brief_transition_reset();
1240 #if !(defined(FS2_DEMO) || defined(FS1_DEMO))
1241 hud_anim_init(&Fade_anim, Brief_static_coords[gr_screen.res][0], Brief_static_coords[gr_screen.res][1], Brief_static_name[gr_screen.res]);
1242 hud_anim_load(&Fade_anim);
1245 nprintf(("Alan","Entering brief_init()\n"));
1246 common_select_init();
1248 if(Game_mode & GM_MULTIPLAYER) {
1249 BriefingMaskBitmap = bm_load(Brief_multi_mask_filename[gr_screen.res]);
1251 BriefingMaskBitmap = bm_load(Brief_mask_filename[gr_screen.res]);
1254 if (BriefingMaskBitmap < 0) {
1255 Error(LOCATION,"Could not load in 'brief-m'!");
1258 Briefing_mask_w = -1;
1259 Briefing_mask_h = -1;
1261 // get a pointer to bitmap by using bm_lock()
1262 BriefingMaskPtr = bm_lock(BriefingMaskBitmap, 8, BMP_AABITMAP);
1263 BriefingMaskData = (ubyte*)BriefingMaskPtr->data;
1264 bm_get_info(BriefingMaskBitmap, &Briefing_mask_w, &Briefing_mask_h);
1266 help_overlay_load(BR_OVERLAY);
1268 // Set up the mask regions
1269 // initialize the different regions of the menu that will react when the mouse moves over it
1270 Num_briefing_regions = 0;
1272 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_BRIEFING_REGION, 0);
1273 #ifndef FS1_DEMO // not available in demo
1274 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_SS_REGION, 0);
1275 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_WEAPON_REGION, 0);
1277 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_COMMIT_REGION, 0);
1278 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_HELP_REGION, 0);
1279 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", COMMON_OPTIONS_REGION, 0);
1281 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_LAST_STAGE_MASK, 0);
1282 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_NEXT_STAGE_MASK, 0);
1283 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_PREV_STAGE_MASK, 0);
1284 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_FIRST_STAGE_MASK, 0);
1285 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_TEXT_SCROLL_UP_MASK, 0);
1286 snazzy_menu_add_region(&Briefing_select_region[Num_briefing_regions++], "", BRIEF_TEXT_SCROLL_DOWN_MASK, 0);
1289 Brief_ui_window.create( 0, 0, gr_screen.max_w, gr_screen.max_h, 0 );
1291 if(Game_mode & GM_MULTIPLAYER){
1292 Brief_ui_window.set_mask_bmap(Brief_mask_multi[gr_screen.res]);
1294 Brief_ui_window.set_mask_bmap(Brief_mask_single[gr_screen.res]);
1297 Brief_ui_window.tooltip_handler = brief_tooltip_handler;
1298 common_buttons_init(&Brief_ui_window);
1299 brief_buttons_init();
1301 // if multiplayer, initialize a few other systems
1302 if(Game_mode & GM_MULTIPLAYER){
1303 // again, should not be necessary, but we'll leave it for now
1306 // force the chatbox to be small
1307 chatbox_force_small();
1310 // set up the screen regions
1311 brief_init_screen(Brief_multiplayer);
1313 // init briefing specific UI
1316 // init the briefing map
1319 // init the briefing voice playback
1321 brief_voice_load_all();
1323 // init objectives display stuff
1324 ML_objectives_init(Brief_goals_coords[gr_screen.res][BRIEF_X_COORD], Brief_goals_coords[gr_screen.res][BRIEF_Y_COORD], Brief_goals_coords[gr_screen.res][BRIEF_W_COORD], Brief_goals_coords[gr_screen.res][BRIEF_H_COORD]);
1326 // set the camera target
1327 if ( Briefing->num_stages > 0 ) {
1328 brief_set_new_stage(&Briefing->stages[0].camera_pos, &Briefing->stages[0].camera_orient, 0, Current_brief_stage);
1329 brief_reset_icons(Current_brief_stage);
1332 Brief_playing_fade_sound = 0;
1333 Brief_mouse_up_flag = 0;
1334 Closeup_font_height = gr_get_font_height();
1335 Closeup_icon = NULL;
1336 Brief_inited = TRUE;
1339 // -------------------------------------------------------------------------------------
1340 // brief_render_closeup_text()
1343 #define CLOSEUP_TEXT_OFFSET 10
1344 void brief_render_closeup_text()
1348 char line[MAX_ICON_TEXT_LINE_LEN];
1349 int n_lines, i, render_x, render_y;
1350 int n_chars[MAX_ICON_TEXT_LINES];
1351 char *p_str[MAX_ICON_TEXT_LINES];
1353 if ( Closeup_icon == NULL ) {
1360 render_x = Closeup_region[0];
1361 render_y = Closeup_region[1] + CLOSEUP_IMG_H;
1363 gr_set_clip(render_x+CLOSEUP_TEXT_OFFSET, render_y, CLOSEUP_W,CLOSEUP_TEXT_H);
1364 gr_set_color_fast(&Color_white);
1366 // n_lines = split_str(bi->text, CLOSEUP_W - 2*CLOSEUP_TEXT_OFFSET, n_chars, p_str, MAX_ICON_TEXT_LINES);
1367 Assert(n_lines != -1);
1369 for ( i = 0; i < n_lines; i++ ) {
1370 Assert(n_chars[i] < MAX_ICON_TEXT_LINE_LEN);
1371 strncpy(line, p_str[i], n_chars[i]);
1372 line[n_chars[i]] = 0;
1373 gr_printf(0,0+i*Closeup_font_height,line);
1378 // -------------------------------------------------------------------------------------
1379 // brief_render_closeup()
1382 void brief_render_closeup(int ship_class, float frametime)
1384 matrix view_orient = IDENTITY_MATRIX;
1392 if (Closeup_bitmap < 0)
1395 ang = PI2 * frametime/Closeup_one_revolution_time;
1396 if ( ang > MAX_ANG_CHG )
1399 Closeup_angles.h += ang;
1400 if ( Closeup_angles.h > PI2 )
1401 Closeup_angles.h -= PI2;
1402 vm_angles_2_matrix(&temp_matrix, &Closeup_angles );
1403 Closeup_orient = temp_matrix;
1405 w = Closeup_region[gr_screen.res][2];
1406 h = Closeup_region[gr_screen.res][3];
1407 gr_set_clip(Closeup_region[gr_screen.res][0], Closeup_region[gr_screen.res][1], w, h);
1411 g3_set_view_matrix(&Closeup_cam_pos, &view_orient, Closeup_zoom);
1412 model_clear_instance( Closeup_icon->modelnum );
1413 model_set_detail_level(0);
1415 int is_neb = The_mission.flags & MISSION_FLAG_FULLNEB;
1417 // maybe switch off nebula rendering
1419 The_mission.flags &= ~MISSION_FLAG_FULLNEB;
1422 int model_render_flags;
1423 if ( Closeup_icon->type == ICON_JUMP_NODE ) {
1424 model_set_outline_color(HUD_color_red, HUD_color_green, HUD_color_blue);
1425 model_render_flags = MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_POLYS | MR_SHOW_OUTLINE;
1427 model_render_flags = MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER;
1430 model_render( Closeup_icon->modelnum, &Closeup_orient, &Closeup_pos, model_render_flags );
1433 The_mission.flags |= MISSION_FLAG_FULLNEB;
1438 gr_set_color_fast(&Color_bright_white);
1440 gr_printf(0x8000,2,Closeup_icon->closeup_label);
1441 // brief_render_closeup_text();
1443 Closeup_close_button.enable();
1444 Closeup_close_button.unhide();
1449 // -------------------------------------------------------------------------------------
1452 // frametime is in seconds
1453 void brief_render(float frametime)
1462 if ( Num_brief_stages <= 0 ) {
1463 gr_set_color_fast(&Color_white);
1464 Assert( Game_current_mission_filename != NULL );
1465 gr_printf(0x8000,200,XSTR( "No Briefing exists for mission: %s", 430), Game_current_mission_filename);
1468 gr_get_string_size(&w, &h, The_mission.name);
1469 gr_set_color_fast(&Color_normal);
1470 gr_printf(0x8000, 230, NOX("[filename: %s, last mod: %s]"), Mission_filename, The_mission.modified);
1476 gr_set_bitmap(Brief_grid_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1477 gr_bitmap(Brief_bmap_coords[gr_screen.res][0], Brief_bmap_coords[gr_screen.res][1]);
1479 brief_render_map(Current_brief_stage, frametime);
1481 // draw the frame bitmaps
1482 gr_set_bitmap(Brief_text_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1483 gr_bitmap(Brief_infobox_coords[gr_screen.res][0], Brief_infobox_coords[gr_screen.res][1]);
1484 brief_blit_stage_num(Current_brief_stage, Num_brief_stages);
1486 z = brief_render_text(Top_brief_text_line, Brief_text_coords[gr_screen.res][0], Brief_text_coords[gr_screen.res][1], Brief_text_coords[gr_screen.res][3], frametime);
1488 brief_voice_play(Current_brief_stage);
1491 // maybe output the "more" indicator
1492 if ( (Brief_text_max_lines[gr_screen.res] + Top_brief_text_line + 2) < Num_brief_text_lines[0] ) {
1493 // can be scrolled down
1494 int more_txt_x = Brief_text_coords[gr_screen.res][0] + (Brief_max_line_width[gr_screen.res]/2) - 10;
1495 int more_txt_y = Brief_text_coords[gr_screen.res][1] + Brief_text_coords[gr_screen.res][3] - 2; // located below brief text, centered
1497 gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469)));
1498 gr_set_color_fast(&Color_black);
1499 gr_rect(more_txt_x-2, more_txt_y, w+3, h);
1500 gr_set_color_fast(&Color_red);
1501 gr_string(more_txt_x, more_txt_y, XSTR("more", 1469)); // base location on the input x and y?
1504 brief_maybe_blit_scene_cut(frametime);
1507 if (MapWin01 != -1) {
1508 gr_set_bitmap(MapWin01, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1512 if (MapWin02 != -1) {
1513 gr_set_bitmap(MapWin02, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1514 gr_bitmap(575, 122);
1517 if (MapWin03 != -1) {
1518 gr_set_bitmap(MapWin03, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1522 if (MapWin04 != -1) {
1523 gr_set_bitmap(MapWin04, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
1528 #if !defined(NDEBUG) || defined(INTERPLAYQA)
1529 gr_set_color_fast(&Color_normal);
1530 int title_y_offset = (Game_mode & GM_MULTIPLAYER) ? 20 : 10;
1531 gr_printf(Brief_bmap_coords[gr_screen.res][0], Brief_bmap_coords[gr_screen.res][1]-title_y_offset, NOX("[name: %s, mod: %s]"), Mission_filename, The_mission.modified);
1534 // output mission title
1536 gr_set_color_fast(&Color_bright_white);
1538 gr_set_color_fast(&Color_bright_blue);
1540 if (Game_mode & GM_MULTIPLAYER) {
1542 strncpy(buf, The_mission.name, 256);
1543 gr_force_fit_string(buf, 255, Title_coords_multi[gr_screen.res][2]);
1545 // align from the end of the string instead of the beginning
1546 gr_get_string_size(&w, NULL, buf);
1547 gr_string(Title_coords_multi[gr_screen.res][0] - w, Title_coords_multi[gr_screen.res][1], buf);
1549 gr_string(Title_coords_multi[gr_screen.res][0], Title_coords_multi[gr_screen.res][1], buf);
1552 gr_get_string_size(&w, NULL, The_mission.name);
1553 gr_string(Title_coords[gr_screen.res][0] - w, Title_coords[gr_screen.res][1], The_mission.name);
1556 // maybe do objectives
1557 if (Current_brief_stage == Briefing->num_stages) {
1558 ML_objectives_do_frame(0);
1562 // -------------------------------------------------------------------------------------
1563 // brief_set_closeup_pos()
1566 #define CLOSEUP_OFFSET 20
1567 void brief_set_closeup_pos(brief_icon *bi)
1570 Closeup_x1 = fl2i(320 - Closeup_coords[gr_screen.res][BRIEF_W_COORD]/2.0f + 0.5f);
1573 void brief_get_closeup_ship_modelnum(brief_icon *ci)
1578 // find the model number for the ship to display
1579 for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
1581 if ( objp == &obj_used_list || objp->type != OBJ_SHIP ) {
1585 sp = &Ships[objp->instance];
1586 if ( sp->ship_info_index == ci->ship_class ) {
1587 ci->ship_class = sp->ship_info_index;
1588 ci->modelnum = sp->modelnum;
1589 ci->radius = objp->radius;
1595 // cut any text off after (and including) '#' char
1596 void brief_truncate_label(char *src)
1598 char *pointer_to_last_char;
1600 pointer_to_last_char = strstr(src, NOX("#"));
1602 if ( pointer_to_last_char ) {
1603 *pointer_to_last_char = 0;
1607 // -------------------------------------------------------------------------------------
1608 // brief_setup_closeup()
1610 // exit: 0 => set-up icon sucessfully
1611 // -1 => could not setup closeup icon
1612 int brief_setup_closeup(brief_icon *bi)
1614 char pof_filename[NAME_LENGTH];
1615 ship_info *sip=NULL;
1619 Closeup_icon->ship_class = bi->ship_class;
1620 Closeup_icon->modelnum = -1;
1622 Closeup_one_revolution_time = ONE_REV_TIME;
1624 switch(Closeup_icon->type) {
1626 Closeup_icon = NULL;
1629 strcpy(pof_filename, NOX("planet.pof"));
1630 strcpy(Closeup_icon->closeup_label, XSTR("planet",-1));
1631 vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -8300.0f);
1632 Closeup_zoom = 0.5f;
1633 Closeup_one_revolution_time = ONE_REV_TIME * 3;
1636 case ICON_ASTEROID_FIELD:
1637 #if !(defined(FS2_DEMO) || defined(FS1_DEMO))
1638 strcpy(pof_filename, Asteroid_info[ASTEROID_TYPE_BIG].pof_files[0]);
1639 strcpy(Closeup_icon->closeup_label, XSTR( "asteroid", 431));
1640 (void) vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -334.0f);
1641 Closeup_zoom = 0.5f;
1644 case ICON_JUMP_NODE:
1645 strcpy(pof_filename, NOX("subspacenode.pof"));
1646 strcpy(Closeup_icon->closeup_label, XSTR( "jump node", 432));
1647 (void) vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -2700.0f);
1648 Closeup_zoom = 0.5f;
1649 Closeup_one_revolution_time = ONE_REV_TIME * 3;
1652 case ICON_UNKNOWN_WING:
1653 strcpy(pof_filename, NOX("unknownship.pof"));
1654 strcpy(Closeup_icon->closeup_label, XSTR( "unknown", 433));
1655 (void) vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -22.0f);
1656 Closeup_zoom = 0.5f;
1659 brief_get_closeup_ship_modelnum(Closeup_icon);
1660 Assert( Closeup_icon->ship_class != -1 );
1661 sip = &Ship_info[Closeup_icon->ship_class];
1663 strcpy(Closeup_icon->closeup_label,sip->name);
1665 // cut any text off after (and including) '#' char
1666 brief_truncate_label(Closeup_icon->closeup_label);
1668 if ( sip->flags & (SIF_SMALL_SHIP|SIF_BIG_SHIP|SIF_HUGE_SHIP|SIF_SENTRYGUN) ) {
1669 strcat(Closeup_icon->closeup_label, XSTR( " class", 434));
1674 if ( Closeup_icon->modelnum == -1 ) {
1675 if ( sip == NULL ) {
1676 Closeup_icon->modelnum = model_load(pof_filename, 0, NULL);
1678 Closeup_icon->modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
1680 Closeup_icon->radius = model_get_radius(Closeup_icon->modelnum);
1683 vm_set_identity(&Closeup_orient);
1684 (void) vm_vec_make(&tvec, 0.0f, 0.0f, -1.0f);
1685 Closeup_orient.v.fvec = tvec;
1686 vm_vec_zero(&Closeup_pos);
1687 Closeup_angles.p = 0.0f;
1688 Closeup_angles.b = 0.0f;
1689 Closeup_angles.h = PI;
1691 brief_set_closeup_pos(bi);
1694 Closeup_cam_pos = sip->closeup_pos;
1695 Closeup_zoom = sip->closeup_zoom;
1701 // -------------------------------------------------------------------------------------
1702 // brief_update_closeup_icon()
1704 // input: mode => how to update the closeup view
1707 void brief_update_closeup_icon(int mode)
1711 int i, closeup_index;
1715 // mode 0 means disable the closeup icon
1716 if ( Closeup_icon != NULL ) {
1717 brief_turn_off_closeup_icon();
1722 if ( Closeup_icon == NULL )
1725 bs = &Briefing->stages[Current_brief_stage];
1728 // see if any icons are being highlighted this stage
1729 for ( i = 0; i < bs->num_icons; i++ ) {
1731 if ( bi->flags & BI_HIGHLIGHT ) {
1737 if ( closeup_index != -1 ) {
1738 bi = &bs->icons[closeup_index];
1739 brief_setup_closeup(bi);
1742 Closeup_icon = NULL;
1747 // -------------------------------------------------------------------------------------
1748 // brief_check_for_anim()
1751 void brief_check_for_anim()
1753 int mx, my, i, iw, ih, x, y;
1755 brief_icon *bi = NULL;
1757 bs = &Briefing->stages[Current_brief_stage];
1758 mouse_get_pos( &mx, &my );
1760 // if mouse click is over the VCR controls, don't launch an icon
1761 // FIXME - should prolly push these into defines instead of hardcoding this
1762 // if ( mx >= 0 && mx <= 115 && my >= 136 && my <= 148 ) {
1766 // same as above but without the hardcoded values, which were wrong anyway. don't know
1767 // how this will work longterm but will hopefully keep things working well - taylor
1768 for (i = 0; i <= BRIEF_BUTTON_FIRST_STAGE; i++) {
1769 Brief_buttons[gr_screen.res][i].button.get_dimensions(&x, &y, &iw, &ih);
1771 if (mx >= x && mx <= (x+iw) && my >= y && my <= (y+ih)) {
1776 // if mouse coords are outside the briefing screen, then go away
1777 my -= bscreen.map_y1;
1778 mx -= bscreen.map_x1;
1779 if ( my < 0 || mx < 0 || mx > (bscreen.map_x2-bscreen.map_x1+1) || my > (bscreen.map_y2-bscreen.map_y1+1) )
1782 for ( i = 0; i < bs->num_icons; i++ ) {
1784 brief_common_get_icon_dimensions(&iw, &ih, bi->type, bi->ship_class);
1785 if ( mx < bi->x ) continue;
1786 if ( mx > (bi->x + iw) ) continue;
1787 if ( my < bi->y ) continue;
1788 if ( my > (bi->y + ih) ) continue;
1789 // if we've got here, must be a hit
1793 if ( i == bs->num_icons ) {
1794 brief_turn_off_closeup_icon();
1798 if ( brief_setup_closeup(bi) == 0 ) {
1799 gamesnd_play_iface(SND_BRIEF_ICON_SELECT);
1801 gamesnd_play_iface(SND_GENERAL_FAIL);
1805 // maybe flash a button if player hasn't done anything for a while
1806 void brief_maybe_flash_button()
1810 if ( Num_brief_stages <= 0 )
1813 if ( Closeup_icon != NULL ) {
1814 common_flash_button_init();
1818 if ( common_flash_bright() ) {
1819 if ( Current_brief_stage == (Num_brief_stages-1) ) {
1821 // AL 4-4-98: Don't flash ship selection button on briefing in demo build
1822 #if defined(FS2_DEMO) || defined(FS1_DEMO)
1825 // AL 30-3-98: Don't flash ship selection button if in a training mission,
1826 if ( brief_only_allow_briefing() ) {
1830 b = &Common_buttons[Current_screen-1][gr_screen.res][1].button; // ship select button
1833 b = &Brief_buttons[gr_screen.res][1].button; // next stage button
1836 if ( b->button_hilighted() ) {
1837 common_flash_button_init();
1844 // -------------------------------------------------------------------------------------
1847 // frametime is in seconds
1849 void brief_do_frame(float frametime)
1851 int k, brief_choice;
1853 if ( red_alert_mission() ) {
1858 if ( !Brief_inited ){
1862 int snazzy_action = -1;
1863 brief_choice = snazzy_menu_do(BriefingMaskData, Briefing_mask_w, Briefing_mask_h, Num_briefing_regions, Briefing_select_region, &snazzy_action, 0);
1865 k = common_select_do(frametime);
1867 if ( Closeup_icon ) {
1868 Brief_mouse_up_flag = 0;
1871 if ( help_overlay_active(BR_OVERLAY) ) {
1872 common_flash_button_init();
1873 brief_turn_off_closeup_icon();
1876 // Check common keypresses
1877 common_check_keys(k);
1883 if ( Briefing->num_stages > 0 ) {
1885 // check for special keys
1889 case KEY_CTRLED | KEY_PAGEUP: {
1890 if (Closeup_icon->ship_class) {
1891 Closeup_icon->ship_class--;
1893 ship_info *sip = &Ship_info[Closeup_icon->ship_class];
1894 if (sip->modelnum < 0)
1895 sip->modelnum = model_load(sip->pof_file, 0, NULL);
1897 mprintf(("Shiptype = %d (%s)\n", Closeup_icon->ship_class, sip->name));
1898 mprintf(("Modelnum = %d (%s)\n", sip->modelnum, sip->pof_file));
1899 brief_setup_closeup(Closeup_icon);
1905 case KEY_CTRLED | KEY_PAGEDOWN: {
1906 if (Closeup_icon->ship_class < Num_ship_types - 1) {
1907 Closeup_icon->ship_class++;
1909 ship_info *sip = &Ship_info[Closeup_icon->ship_class];
1910 if (sip->modelnum < 0)
1911 sip->modelnum = model_load(sip->pof_file, 0, NULL);
1913 mprintf(("Shiptype = %d (%s)\n", Closeup_icon->ship_class, sip->name));
1914 mprintf(("Modelnum = %d (%s)\n", sip->modelnum, sip->pof_file));
1915 brief_setup_closeup(Closeup_icon);
1922 Closeup_cam_pos.xyz.z += 1;
1926 case KEY_A + KEY_SHIFTED:
1927 Closeup_cam_pos.xyz.z += 10;
1932 Closeup_cam_pos.xyz.z -= 1;
1936 case KEY_Z + KEY_SHIFTED:
1937 Closeup_cam_pos.xyz.z -= 10;
1942 Closeup_cam_pos.xyz.y += 1;
1946 case KEY_Y + KEY_SHIFTED:
1947 Closeup_cam_pos.xyz.y += 10;
1952 Closeup_cam_pos.xyz.y -= 1;
1956 case KEY_H + KEY_SHIFTED:
1957 Closeup_cam_pos.xyz.y -= 10;
1962 Closeup_zoom -= 0.1f;
1963 if ( Closeup_zoom < 0.1 )
1964 Closeup_zoom = 0.1f;
1968 case KEY_COMMA+KEY_SHIFTED:
1969 Closeup_zoom -= 0.5f;
1970 if ( Closeup_zoom < 0.1 )
1971 Closeup_zoom = 0.1f;
1976 Closeup_zoom += 0.1f;
1980 case KEY_PERIOD+KEY_SHIFTED:
1981 Closeup_zoom += 0.5f;
1985 case 1000: // need this to avoid warning about no case
1995 nprintf(("General","Camera pos: %.2f, %.2f %.2f // ", Closeup_cam_pos.xyz.x, Closeup_cam_pos.xyz.y, Closeup_cam_pos.xyz.z));
1996 nprintf(("General","Camera zoom: %.2f\n", Closeup_zoom));
2000 if ( brief_choice > -1 && snazzy_action == SNAZZY_OVER ) {
2001 Brief_mouse_up_flag = 0;
2006 common_check_buttons();
2007 // if ( Briefing->num_stages > 0 )
2008 brief_check_buttons();
2010 if ( brief_choice != -1 ) {
2011 Brief_mouse_up_flag = 0;
2016 common_render(frametime);
2018 if ( Current_brief_stage < (Num_brief_stages-1) ) {
2019 if ( !help_overlay_active(BR_OVERLAY) && brief_time_to_advance(Current_brief_stage, frametime) ) {
2020 brief_do_next_pressed(0);
2021 common_flash_button_init();
2022 Brief_last_auto_advance = timer_get_milliseconds();
2026 if ( !Background_playing ) {
2028 int check_jump_flag = 1;
2029 if ( Current_brief_stage != Last_brief_stage ) {
2031 // Check if we have a quick transition pending
2032 if ( Quick_transition_stage != -1 ) {
2033 Quick_transition_stage = -1;
2034 brief_reset_last_new_stage();
2036 check_jump_flag = 0;
2039 if ( check_jump_flag ) {
2040 if ( abs(Current_brief_stage - Last_brief_stage) > 1 ) {
2041 Quick_transition_stage = Current_brief_stage;
2042 Current_brief_stage = Last_brief_stage;
2043 Assert(Current_brief_stage >= 0);
2044 Start_fade_up_anim = 1;
2045 goto Transition_done;
2050 if ( Current_brief_stage > Last_brief_stage ) {
2051 if ( Briefing->stages[Last_brief_stage].flags & BS_FORWARD_CUT ) {
2052 Quick_transition_stage = Current_brief_stage;
2053 Current_brief_stage = Last_brief_stage;
2054 Assert(Current_brief_stage >= 0);
2055 Start_fade_up_anim = 1;
2056 goto Transition_done;
2058 time = Briefing->stages[Current_brief_stage].camera_time;
2062 if ( Briefing->stages[Last_brief_stage].flags & BS_BACKWARD_CUT ) {
2063 Quick_transition_stage = Current_brief_stage;
2064 Current_brief_stage = Last_brief_stage;
2065 Assert(Current_brief_stage >= 0);
2066 Start_fade_up_anim = 1;
2067 goto Transition_done;
2069 time = Briefing->stages[Last_brief_stage].camera_time;
2074 brief_voice_stop(Last_brief_stage);
2076 if ( Current_brief_stage < 0 ) {
2078 Current_brief_stage=0;
2081 // set the camera target
2082 brief_set_new_stage(&Briefing->stages[Current_brief_stage].camera_pos,
2083 &Briefing->stages[Current_brief_stage].camera_orient,
2084 time, Current_brief_stage);
2086 Brief_playing_fade_sound = 0;
2087 Last_brief_stage = Current_brief_stage;
2088 brief_reset_icons(Current_brief_stage);
2089 brief_update_closeup_icon(0);
2094 if ( Brief_mouse_up_flag && !Closeup_icon) {
2095 brief_check_for_anim();
2098 brief_render(frametime);
2099 brief_camera_move(frametime, Current_brief_stage);
2101 if (Closeup_icon && (Closeup_bitmap >= 0)) {
2102 // blit closeup background
2103 gr_set_bitmap(Closeup_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
2104 gr_bitmap(Closeup_coords[gr_screen.res][BRIEF_X_COORD], Closeup_coords[gr_screen.res][BRIEF_Y_COORD]);
2107 Brief_ui_window.draw();
2108 brief_redraw_pressed_buttons();
2109 common_render_selected_screen_button();
2112 brief_render_closeup(Closeup_icon->ship_class, frametime);
2115 // render some extra stuff in multiplayer
2116 if (Game_mode & GM_MULTIPLAYER) {
2117 // should render this last so that it overlaps all controls
2120 // render the status indicator for the voice system
2121 multi_common_voice_display_status();
2123 // blit the "ships/players" locked button
2124 // multi_ts_blit_locked_button();
2126 // maybe blit the multiplayer "locked" button
2127 // if its locked, everyone blits it as such
2128 if(multi_ts_is_locked()){
2129 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.draw_forced(2);
2131 // anyone who can't hit the button sees it off, otherwise
2133 if( ((Netgame.type_flags & NG_TYPE_TEAM) && !(Net_player->flags & NETINFO_FLAG_TEAM_CAPTAIN)) ||
2134 ((Netgame.type_flags & NG_TYPE_TEAM) && !(Net_player->flags & NETINFO_FLAG_GAME_HOST)) ){
2135 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.draw_forced(0);
2137 Brief_buttons[gr_screen.res][BRIEF_BUTTON_MULTI_LOCK].button.draw();
2143 // maybe flash a button if player hasn't done anything for a while
2144 brief_maybe_flash_button();
2146 // blit help overlay if active
2147 help_overlay_maybe_blit(BR_OVERLAY);
2151 // If the commit button was pressed, do the commit button actions. Done at the end of the
2152 // loop so there isn't a skip in the animation (since ship_create() can take a long time if
2153 // the ship model is not in memory
2154 if (Commit_pressed) {
2155 if (Game_mode & GM_MULTIPLAYER) {
2156 multi_ts_commit_pressed();
2165 // --------------------------------------------------------------------------------------
2166 // brief_unload_bitmaps()
2169 void brief_unload_bitmaps()
2171 if ( BriefingMaskBitmap != -1 ) {
2172 bm_unload(BriefingMaskBitmap);
2173 BriefingMaskBitmap = -1;
2176 if ( Brief_text_bitmap != -1 ) {
2177 bm_unload(Brief_text_bitmap);
2178 Brief_text_bitmap = -1;
2181 if(Brief_grid_bitmap != -1){
2182 bm_unload(Brief_grid_bitmap);
2183 Brief_grid_bitmap = -1;
2186 if ( Brief_multitext_bitmap != -1 ) {
2187 bm_unload(Brief_multitext_bitmap);
2188 Brief_multitext_bitmap = -1;
2191 if ( Brief_background_bitmap != -1 ) {
2192 bm_unload(Brief_background_bitmap);
2193 Brief_background_bitmap = -1;
2197 if (MapWin01 != -1){
2198 bm_unload(MapWin01);
2202 if (MapWin02 != -1){
2203 bm_unload(MapWin02);
2207 if (MapWin03 != -1){
2208 bm_unload(MapWin03);
2212 if (MapWin04 != -1){
2213 bm_unload(MapWin04);
2218 help_overlay_unload(BR_OVERLAY);
2221 // ------------------------------------------------------------------------------------
2227 if ( Brief_inited == FALSE ) {
2228 nprintf(("Warning","brief_close() returning without doing anything\n"));
2232 nprintf(("Alan", "Entering brief_close()\n"));
2234 ML_objectives_close();
2236 // unload the audio streams used for voice playback
2237 brief_voice_unload_all();
2239 #if !(defined(FS2_DEMO) || defined(FS1_DEMO))
2240 hud_anim_release(&Fade_anim);
2243 // done mask bitmap, so unlock it
2244 bm_unlock(BriefingMaskBitmap);
2246 Brief_ui_window.destroy();
2250 common_free_interface_palette();
2253 // unload the bitmaps
2254 brief_unload_bitmaps();
2256 brief_common_close();
2258 Brief_inited = FALSE;
2261 void briefing_stop_music()
2263 if ( Briefing_music_handle != -1 ) {
2264 audiostream_close_file(Briefing_music_handle);
2265 Briefing_music_handle = -1;
2269 void briefing_load_music(char* fname)
2271 if ( Cmdline_freespace_no_music ) {
2275 if ( Briefing_music_handle != -1 )
2279 Briefing_music_handle = audiostream_open( fname, ASF_EVENTMUSIC );
2282 void briefing_start_music()
2284 if ( Briefing_music_handle != -1 ) {
2285 if ( !audiostream_is_playing(Briefing_music_handle) )
2286 audiostream_play(Briefing_music_handle, Master_event_music_volume);
2289 nprintf(("Warning", "No music file exists to play music at this briefing!\n"));
2293 void brief_stop_voices()
2295 brief_voice_stop(Current_brief_stage);
2298 void brief_maybe_blit_scene_cut(float frametime)
2300 if ( Start_fade_up_anim ) {
2302 #if defined(FS2_DEMO) || defined(FS1_DEMO)
2303 Fade_anim.time_elapsed = 0.0f;
2304 Start_fade_up_anim = 0;
2305 Start_fade_down_anim = 1;
2306 Current_brief_stage = Quick_transition_stage;
2308 if ( Current_brief_stage < 0 ) {
2309 brief_transition_reset();
2310 Current_brief_stage = Last_brief_stage;
2312 goto Fade_down_anim_start;
2316 Fade_anim.time_elapsed += frametime;
2318 if ( !Brief_playing_fade_sound ) {
2319 gamesnd_play_iface(SND_BRIEFING_STATIC);
2320 Brief_playing_fade_sound = 1;
2323 if ( Fade_anim.time_elapsed > Fade_anim.total_time ) {
2324 Fade_anim.time_elapsed = 0.0f;
2325 Start_fade_up_anim = 0;
2326 Start_fade_down_anim = 1;
2327 Current_brief_stage = Quick_transition_stage;
2329 if ( Current_brief_stage < 0 ) {
2330 brief_transition_reset();
2331 Current_brief_stage = Last_brief_stage;
2334 Assert(Current_brief_stage >= 0);
2335 goto Fade_down_anim_start;
2338 // draw the correct frame of animation
2339 framenum = fl2i( (Fade_anim.time_elapsed * Fade_anim.num_frames) / Fade_anim.total_time );
2342 if ( framenum >= Fade_anim.num_frames )
2343 framenum = Fade_anim.num_frames-1;
2345 // Blit the bitmap for this frame
2346 gr_set_bitmap(Fade_anim.first_frame + framenum, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
2347 gr_bitmap(Fade_anim.sx, Fade_anim.sy);
2352 Fade_down_anim_start:
2353 if ( Start_fade_down_anim ) {
2355 #if defined(FS2_DEMO) || defined(FS1_DEMO)
2356 Fade_anim.time_elapsed = 0.0f;
2357 Start_fade_up_anim = 0;
2358 Start_fade_down_anim = 0;
2364 Fade_anim.time_elapsed += frametime;
2366 if ( Fade_anim.time_elapsed > Fade_anim.total_time ) {
2367 Fade_anim.time_elapsed = 0.0f;
2368 Start_fade_up_anim = 0;
2369 Start_fade_down_anim = 0;
2373 // draw the correct frame of animation
2374 framenum = fl2i( (Fade_anim.time_elapsed * Fade_anim.num_frames) / Fade_anim.total_time );
2377 if ( framenum >= Fade_anim.num_frames )
2378 framenum = Fade_anim.num_frames-1;
2380 // Blit the bitmap for this frame
2381 gr_set_bitmap(Fade_anim.first_frame + (Fade_anim.num_frames-1) - framenum, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
2382 gr_bitmap(Fade_anim.sx, Fade_anim.sy);
2388 void brief_transition_reset()
2390 Quick_transition_stage = -1;
2391 Start_fade_up_anim = 0;
2392 Start_fade_down_anim = 0;
2393 Fade_anim.time_elapsed = 0.0f;
2396 // return 1 if this mission only allow players to use the briefing (and not ship or
2397 // weapon loadout). Otherwise return 0.
2398 int brief_only_allow_briefing()
2400 if ( The_mission.game_type & MISSION_TYPE_TRAINING ) {
2404 if ( The_mission.scramble || The_mission.red_alert) {