// Called once when red alert interface is started void red_alert_init() { int i; ui_button_info *b; if ( Red_alert_inited ) { return; } Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0); Ui_window.set_mask_bmap(Red_alert_mask[gr_screen.res]); for (i=0; i<NUM_BUTTONS; i++) { b = &Buttons[gr_screen.res][i]; b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1); // set up callback for when a mouse first goes over a button b->button.set_highlight_action(common_play_highlight_sound); b->button.set_bmaps(b->filename); b->button.link_hotspot(b->hotspot); } // all text for(i=0; i<RED_ALERT_NUM_TEXT; i++){ Ui_window.add_XSTR(&Red_alert_text[gr_screen.res][i]); } // set up red alert hotkeys Buttons[gr_screen.res][RA_CONTINUE].button.set_hotkey(KEY_CTRLED | KEY_ENTER); // hud_anim_init(&Flash_anim, Ra_flash_coords[gr_screen.res][RA_X_COORD], Ra_flash_coords[gr_screen.res][RA_Y_COORD], NOX("AlertFlash")); // hud_anim_load(&Flash_anim); Red_alert_voice = -1; if ( !Briefing ) { Briefing = &Briefings[0]; } // load in background image and flashing red alert animation Background_bitmap = mission_ui_background_load(Briefing->background[gr_screen.res], Red_alert_fname[gr_screen.res]); // Make sure word wrapping and rendering use the same font font::set_font(font::FONT1); if ( Briefing->num_stages > 0 ) { brief_color_text_init(Briefing->stages[0].text.c_str(), Ra_brief_text_wnd_coords[gr_screen.res][RA_W_COORD], default_redalert_briefing_color, 0); } red_alert_voice_load(); // we have to reset/setup the shipselect and weaponselect pointers before moving on ship_select_common_init(); weapon_select_common_init(); Text_delay = timestamp(200); Red_alert_voice_started = 0; Red_alert_inited = 1; }
void cmd_brief_init(int team) { common_music_init(SCORE_BRIEFING); int i; ui_button_info *b; Cmd_brief_inited = 0; Cur_cmd_brief = &Cmd_briefs[team]; // Goober5000 - replace any variables (probably persistent variables) with their values for (i = 0; i < Cur_cmd_brief->num_stages; i++) sexp_replace_variable_names_with_values(Cur_cmd_brief->stage[i].text); if (Cur_cmd_brief->num_stages <= 0) return; gr_reset_clip(); gr_clear(); gr_flip(); // first determine which layout to use Uses_scroll_buttons = 1; // assume true Cmd_brief_background_bitmap = mission_ui_background_load(Cur_cmd_brief->background[gr_screen.res], Cmd_brief_fname[Uses_scroll_buttons][gr_screen.res]); // try to load extra one first if (Cmd_brief_background_bitmap < 0) // failed to load { Uses_scroll_buttons = 0; // nope, sorry Cmd_brief_background_bitmap = mission_ui_background_load(NULL, Cmd_brief_fname[Uses_scroll_buttons][gr_screen.res]); } Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0); Ui_window.set_mask_bmap(Cmd_brief_mask[Uses_scroll_buttons][gr_screen.res]); for (i=0; i<NUM_CMD_BRIEF_BUTTONS; i++) { b = &Cmd_brief_buttons[gr_screen.res][i]; b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1); // set up callback for when a mouse first goes over a button b->button.set_highlight_action(common_play_highlight_sound); b->button.set_bmaps(b->filename); b->button.link_hotspot(b->hotspot); } // add text for(i=0; i<CMD_BRIEF_NUM_TEXT; i++){ Ui_window.add_XSTR(&Cmd_brief_text[gr_screen.res][i]); } // set up readyrooms for buttons so we draw the correct animation frame when a key is pressed Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_FIRST_STAGE].button.set_hotkey(KEY_SHIFTED | KEY_LEFT); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_LAST_STAGE].button.set_hotkey(KEY_SHIFTED | KEY_RIGHT); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_PREV_STAGE].button.set_hotkey(KEY_LEFT); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_NEXT_STAGE].button.set_hotkey(KEY_RIGHT); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_ACCEPT].button.set_hotkey(KEY_CTRLED | KEY_ENTER); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_HELP].button.set_hotkey(KEY_F1); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_OPTIONS].button.set_hotkey(KEY_F2); // extra - Goober5000 if (Uses_scroll_buttons) { Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_SCROLL_UP].button.set_hotkey(KEY_UP); Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_SCROLL_DOWN].button.set_hotkey(KEY_DOWN); } // load in help overlay bitmap Cmd_brief_overlay_id = help_overlay_get_index(CMD_BRIEF_OVERLAY); help_overlay_set_state(Cmd_brief_overlay_id,gr_screen.res,0); for (i=0; i<Cur_cmd_brief->num_stages; i++) cmd_brief_ani_wave_init(i); cmd_brief_init_voice(); cmd_brief_new_stage(0); Cmd_brief_paused = 0; Cmd_brief_inited = 1; }