// draw the shield icon and integrity for the escort ship void HudGaugeEscort::renderIcon(int x, int y, int index) { if(MULTI_DOGFIGHT && index <= 2) { renderIconDogfight(x, y, index); return; } float shields, integrity; int screen_integrity, offset; char buf[255]; object *objp = &Objects[Escort_ships[index].objnum]; ship *sp = &Ships[objp->instance]; // determine if its "friendly" or not // Goober5000 - changed in favor of just passing the team setGaugeColorEscort(index, sp->team); /* if(Player_ship != NULL){ hud_escort_set_gauge_color(index, (sp->team == Player_ship->team) ? 1 : 0); } else { hud_escort_set_gauge_color(index, 1); } */ // draw a 'D' if a ship is disabled if ( (sp->flags & SF_DISABLED) || (ship_subsys_disrupted(sp, SUBSYSTEM_ENGINE)) ) { renderString( x + ship_status_offsets[0], y + ship_status_offsets[1], EG_NULL, XSTR( "D", 284)); } // print out ship name strcpy_s(buf, sp->ship_name); gr_force_fit_string(buf, 255, ship_name_max_width); end_string_at_first_hash_symbol(buf); renderString( x + ship_name_offsets[0], y + ship_name_offsets[1], EG_ESCORT1 + index, buf); // show ship integrity hud_get_target_strength(objp, &shields, &integrity); screen_integrity = fl2i(integrity*100 + 0.5f); offset = 0; if ( screen_integrity < 100 ) { offset = 2; if ( screen_integrity == 0 ) { if ( integrity > 0 ) { screen_integrity = 1; } } } renderPrintf( x+ship_integrity_offsets[0] + offset, y+ship_integrity_offsets[1], EG_NULL, "%d", screen_integrity); //Let's be nice. setGaugeColor(); }
// maybe reformat a string void emp_maybe_reformat_text(char *text, int max_len, int gauge_id) { wacky_text *wt; // if the EMP effect is not active, never reformat it if(!emp_active_local()){ return; } // randomly _don't_ apply text craziness if(frand_range(0.0f, 1.0f) > Emp_intensity){ return; } // if the gauge is EG_NULL, empty the string if(gauge_id == EG_NULL){ strcpy(text, ""); return; } // if this gauge has not been wacked out, or if the timestamp has expired, we // neeed to wack it out again Assert((gauge_id >= EG_NULL) && (gauge_id < NUM_TEXT_STAMPS)); wt = &Emp_wacky_text[gauge_id]; if((wt->stamp == -1) || timestamp_elapsed(wt->stamp)){ // reformat specific gauges differently switch(gauge_id){ // weapons case EG_WEAPON_TITLE: case EG_WEAPON_P1: case EG_WEAPON_P2: case EG_WEAPON_P3: case EG_WEAPON_S1: case EG_WEAPON_S2: int wep_index; wep_index = (int)frand_range(0.0f, (float)(MAX_WEAPON_TYPES - 1)); strcpy_s(wt->str, Weapon_info[ wep_index >= MAX_WEAPON_TYPES ? 0 : wep_index ].name); break; // escort list case EG_ESCORT1: case EG_ESCORT2: case EG_ESCORT3: // choose a random ship int shipnum; shipnum = ship_get_random_targetable_ship(); if(shipnum >= 0){ strcpy_s(wt->str, Ships[shipnum].ship_name); } break; // directives title case EG_OBJ_TITLE: strcpy_s(wt->str, ""); break; // directives themselves case EG_OBJ1: case EG_OBJ2: case EG_OBJ3: case EG_OBJ4: case EG_OBJ5: strcpy_s(wt->str, text); emp_randomize_chars(wt->str); break; // target box info case EG_TBOX_EXTRA1: case EG_TBOX_EXTRA2: case EG_TBOX_EXTRA3: case EG_TBOX_CLASS: case EG_TBOX_DIST: case EG_TBOX_CARGO: case EG_TBOX_HULL: case EG_TBOX_NAME: case EG_TBOX_INTEG: strcpy_s(wt->str, text); emp_randomize_chars(wt->str); break; // squadmsg menu case EG_SQ1: case EG_SQ2: case EG_SQ3: case EG_SQ4: case EG_SQ5: case EG_SQ6: case EG_SQ7: case EG_SQ8: case EG_SQ9: case EG_SQ10: strcpy_s(wt->str, text); emp_randomize_chars(wt->str); break; // default default : return; } // recalculate the timestamp wt->stamp = timestamp((int)frand_range(100.0f, 750.0f * (1.0f - Emp_intensity))); // copy the text strcpy(text, wt->str); } // otherwise, use what we calculated last time else { strcpy(text, wt->str); } // watch out for '#' - Goober5000 end_string_at_first_hash_symbol(text); }
// evaluate a kill on a ship int scoring_eval_kill(object *ship_objp) { float max_damage_pct; // the pct% of total damage the max damage object did int max_damage_index; // the index into the dying ship's damage_ship[] array corresponding the greatest amount of damage int killer_sig; // signature of the guy getting credit for the kill (or -1 if none) int idx,net_player_num; player *plr; // pointer to a player struct if it was a player who got the kill net_player *net_plr = NULL; ship *dead_ship; // the ship which was killed net_player *dead_plr = NULL; float scoring_scale_by_damage = 1; // percentage to scale the killer's score by if we score based on the amount of damage caused int kill_score, assist_score; bool is_enemy_player = false; // true if the player just killed an enemy player ship // multiplayer clients bail here if(MULTIPLAYER_CLIENT){ return -1; } // we don't evaluate kills on anything except ships if(ship_objp->type != OBJ_SHIP){ return -1; } if((ship_objp->instance < 0) || (ship_objp->instance >= MAX_SHIPS)){ return -1; } // assign the dead ship dead_ship = &Ships[ship_objp->instance]; // evaluate player deaths if(Game_mode & GM_MULTIPLAYER){ net_player_num = multi_find_player_by_object(ship_objp); if(net_player_num != -1){ Net_players[net_player_num].m_player->stats.m_player_deaths++; nprintf(("Network","Setting player %s deaths to %d\n",Net_players[net_player_num].m_player->callsign,Net_players[net_player_num].m_player->stats.m_player_deaths)); dead_plr = &Net_players[net_player_num]; is_enemy_player = true; } } else { if(ship_objp == Player_obj){ Player->stats.m_player_deaths++; } } net_player_num = -1; // clear out invalid damager ships for(idx=0; idx<MAX_DAMAGE_SLOTS; idx++){ if((dead_ship->damage_ship_id[idx] >= 0) && (ship_get_by_signature(dead_ship->damage_ship_id[idx]) < 0)){ dead_ship->damage_ship[idx] = 0.0f; dead_ship->damage_ship_id[idx] = -1; } } // determine which object did the most damage to the dying object, and how much damage that was max_damage_index = -1; for(idx=0;idx<MAX_DAMAGE_SLOTS;idx++){ // bogus ship if(dead_ship->damage_ship_id[idx] < 0){ continue; } // if this slot did more damage then the next highest slot if((max_damage_index == -1) || (dead_ship->damage_ship[idx] > dead_ship->damage_ship[max_damage_index])){ max_damage_index = idx; } } // doh if((max_damage_index < 0) || (max_damage_index >= MAX_DAMAGE_SLOTS)){ return -1; } // the pct of total damage applied to this ship max_damage_pct = dead_ship->damage_ship[max_damage_index] / dead_ship->total_damage_received; CLAMP(max_damage_pct, 0.0f, 1.0f); // only evaluate if the max damage % is high enough to record a kill and it was done by a valid object if((max_damage_pct >= Kill_percentage) && (dead_ship->damage_ship_id[max_damage_index] >= 0)){ // set killer_sig for this ship to the signature of the guy who gets credit for the kill killer_sig = dead_ship->damage_ship_id[max_damage_index]; // set the scale value if we only award 100% score for 100% damage if (The_mission.ai_profile->flags & AIPF_KILL_SCORING_SCALES_WITH_DAMAGE) { scoring_scale_by_damage = max_damage_pct; } // null this out for now plr = NULL; net_plr = NULL; // get the player (whether single or multiplayer) net_player_num = -1; if(Game_mode & GM_MULTIPLAYER){ net_player_num = multi_find_player_by_signature(killer_sig); if(net_player_num != -1){ plr = Net_players[net_player_num].m_player; net_plr = &Net_players[net_player_num]; } } else { if(Objects[Player->objnum].signature == killer_sig){ plr = Player; } } // if we found a valid player, evaluate some kill details if(plr != NULL){ int si_index; // bogus if((plr->objnum < 0) || (plr->objnum >= MAX_OBJECTS)){ return -1; } // get the ship info index of the ship type of this kill. we need to take ship // copies into account here. si_index = dead_ship->ship_info_index; if (Ship_info[si_index].flags & SIF_SHIP_COPY) { char temp[NAME_LENGTH]; strcpy_s(temp, Ship_info[si_index].name); end_string_at_first_hash_symbol(temp); // Goober5000 - previous error checking guarantees that this will be >= 0 si_index = ship_info_lookup(temp); } // if he killed a guy on his own team increment his bonehead kills if((Ships[Objects[plr->objnum].instance].team == dead_ship->team) && !MULTI_DOGFIGHT ){ if (!(The_mission.flags & MISSION_FLAG_NO_TRAITOR)) { plr->stats.m_bonehead_kills++; kill_score = -(int)(dead_ship->score * scoring_get_scale_factor()); plr->stats.m_score += kill_score; if(net_plr != NULL ) { multi_team_maybe_add_score(-(dead_ship->score), net_plr->p_info.team); } } } // otherwise increment his valid kill count and score else { // dogfight mode if(MULTI_DOGFIGHT && (multi_find_player_by_object(ship_objp) < 0)){ // don't add a kill for dogfight kills on non-players } else { plr->stats.m_okKills[si_index]++; plr->stats.m_kill_count_ok++; // only computer controlled enemies should scale with difficulty if (is_enemy_player) { kill_score = (int)(dead_ship->score * scoring_scale_by_damage); } else { kill_score = (int)(dead_ship->score * scoring_get_scale_factor() * scoring_scale_by_damage); } plr->stats.m_score += kill_score; hud_gauge_popup_start(HUD_KILLS_GAUGE); #ifdef SCORING_DEBUG char kill_score_text[1024] = ""; sprintf(kill_score_text, "SCORING : %s killed a ship worth %d points and gets %d pts for the kill\n", plr->callsign, dead_ship->score, kill_score); if (MULTIPLAYER_MASTER) { send_game_chat_packet(Net_player, kill_score_text, MULTI_MSG_ALL); } HUD_printf(kill_score_text); mprintf((kill_score_text)); #endif // multiplayer if(net_plr != NULL){ multi_team_maybe_add_score(dead_ship->score , net_plr->p_info.team); // award teammates % of score value for big ship kills // not in dogfight tho // and not if there is no assist threshold (as otherwise assists could get higher scores than kills) if (!(Netgame.type_flags & NG_TYPE_DOGFIGHT) && (Ship_info[dead_ship->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) { for (idx=0; idx<MAX_PLAYERS; idx++) { if (MULTI_CONNECTED(Net_players[idx]) && (Net_players[idx].p_info.team == net_plr->p_info.team) && (&Net_players[idx] != net_plr)) { assist_score = (int)(dead_ship->score * The_mission.ai_profile->assist_award_percentage_scale[Game_skill_level]); Net_players[idx].m_player->stats.m_score += assist_score; #ifdef SCORING_DEBUG // DEBUG CODE TO TEST NEW SCORING char score_text[1024] = ""; sprintf(score_text, "SCORING : All team mates get %d pts for helping kill the capship\n", assist_score); send_game_chat_packet(Net_player, score_text, MULTI_MSG_ALL); HUD_printf(score_text); mprintf((score_text)); #endif } } } // death message if((Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (net_plr != NULL) && (dead_plr != NULL) && (net_plr->m_player != NULL) && (dead_plr->m_player != NULL)){ char dead_text[1024] = ""; sprintf(dead_text, "%s gets the kill for %s", net_plr->m_player->callsign, dead_plr->m_player->callsign); send_game_chat_packet(Net_player, dead_text, MULTI_MSG_ALL, NULL, NULL, 2); HUD_printf(dead_text); } } } } // increment his all-encompassing kills plr->stats.m_kills[si_index]++; plr->stats.m_kill_count++; // update everyone on this guy's kills if this is multiplayer if(MULTIPLAYER_MASTER && (net_player_num != -1)){ // send appropriate stats if(Netgame.type_flags & NG_TYPE_DOGFIGHT){ // evaluate dogfight kills multi_df_eval_kill(&Net_players[net_player_num], ship_objp); // update stats send_player_stats_block_packet(&Net_players[net_player_num], STATS_DOGFIGHT_KILLS); } else { send_player_stats_block_packet(&Net_players[net_player_num], STATS_MISSION_KILLS); } } } } else { // set killer_sig for this ship to -1, indicating no one got the kill for it killer_sig = -1; } // pass in the guy who got the credit for the kill (if any), so that he doesn't also // get credit for an assist scoring_eval_assists(dead_ship,killer_sig, is_enemy_player); #ifdef SCORING_DEBUG if (Game_mode & GM_MULTIPLAYER) { char buf[256]; sprintf(Scoring_debug_text, "SCORING : %s killed.\nDamage by ship:\n\n", Ship_info[dead_ship->ship_info_index].name); // show damage done by player for (int i=0; i<MAX_DAMAGE_SLOTS; i++) { int net_player_num = multi_find_player_by_signature(dead_ship->damage_ship_id[i]); if (net_player_num != -1) { plr = Net_players[net_player_num].m_player; sprintf(buf, "%s: %f", plr->callsign, dead_ship->damage_ship[i]); if (dead_ship->damage_ship_id[i] == killer_sig ) { strcat_s(buf, " KILLER\n"); } else { strcat_s(buf, "\n"); } strcat_s(Scoring_debug_text, buf); } } mprintf ((Scoring_debug_text)); } #endif return max_damage_index; }
// --------------------------------------------------------------------- // mission_hotkey_do_frame() // // Called once per frame to process user input for the Hotkey Assignment Screen // void mission_hotkey_do_frame(float frametime) { char buf[256]; int i, k, w, h, y, z, line, hotkeys; int font_height = gr_get_font_height(); int select_tease_line = -1; // line mouse is down on, but won't be selected until button released color circle_color; if ( help_overlay_active(Hotkey_overlay_id) ) { Buttons[gr_screen.res][HELP_BUTTON].button.reset_status(); Ui_window.set_ignore_gadgets(1); } k = Ui_window.process() & ~KEY_DEBUGGED; if ( (k > 0) || B1_JUST_RELEASED ) { if ( help_overlay_active(Hotkey_overlay_id) ) { help_overlay_set_state(Hotkey_overlay_id, gr_screen.res, 0); Ui_window.set_ignore_gadgets(0); k = 0; } } if ( !help_overlay_active(Hotkey_overlay_id) ) { Ui_window.set_ignore_gadgets(0); } switch (k) { case KEY_DOWN: // scroll list down hotkey_scroll_line_down(); break; case KEY_UP: // scroll list up hotkey_scroll_line_up(); break; case KEY_PAGEDOWN: // scroll list down hotkey_scroll_screen_down(); break; case KEY_PAGEUP: // scroll list up hotkey_scroll_screen_up(); break; case KEY_CTRLED | KEY_ENTER: save_hotkeys(); // fall through to next state -- allender changed this behavior since ESC should always cancel, no? case KEY_ESC: mission_hotkey_exit(); break; case KEY_TAB: case KEY_ENTER: case KEY_PADENTER: expand_wing(); break; case KEY_EQUAL: case KEY_PADPLUS: add_hotkey(Cur_hotkey); break; case KEY_MINUS: case KEY_PADMINUS: remove_hotkey(); break; case KEY_F2: gameseq_post_event(GS_EVENT_OPTIONS_MENU); break; case KEY_CTRLED | KEY_R: reset_hotkeys(); break; case KEY_CTRLED | KEY_C: clear_hotkeys(); break; } // end switch // ? for (i=0; i<MAX_KEYED_TARGETS; i++) { if (k == Key_sets[i]) Cur_hotkey = i; if (k == (Key_sets[i] | KEY_SHIFTED)) add_hotkey(i); } // handle pressed buttons for (i=0; i<NUM_BUTTONS; i++) { if (Buttons[gr_screen.res][i].button.pressed()) { hotkey_button_pressed(i); break; // only need to handle 1 button @ a time } } for (i=0; i<LIST_BUTTONS_MAX; i++) { // check for tease line if (List_buttons[i].button_down()) { select_tease_line = i + Scroll_offset; } // check for selected list item if (List_buttons[i].pressed()) { Selected_line = i + Scroll_offset; List_buttons[i].get_mouse_pos(&z, NULL); z += Hotkey_list_coords[gr_screen.res][0]; // adjust to full screen space if ((z >= Hotkey_wing_icon_x[gr_screen.res]) && (z < (Hotkey_wing_icon_x[gr_screen.res]) + Hotkey_function_field_width[gr_screen.res])) { expand_wing(); } } if (List_buttons[i].double_clicked()) { Selected_line = i + Scroll_offset; hotkeys = -1; switch (Hotkey_lines[Selected_line].type) { case HOTKEY_LINE_WING: hotkeys = get_wing_hotkeys(Hotkey_lines[Selected_line].index); break; case HOTKEY_LINE_SHIP: case HOTKEY_LINE_SUBSHIP: hotkeys = Hotkey_bits[Hotkey_lines[Selected_line].index]; break; } if (hotkeys != -1) { if (hotkeys & (1 << Cur_hotkey)) remove_hotkey(); else add_hotkey(Cur_hotkey); } } } GR_MAYBE_CLEAR_RES(Background_bitmap); if (Background_bitmap >= 0) { gr_set_bitmap(Background_bitmap); gr_bitmap(0, 0, GR_RESIZE_MENU); } else gr_clear(); Ui_window.draw(); gr_init_color(&circle_color, 160, 160, 0); // draw the big "F10" in the little box font::set_font(font::FONT2); gr_set_color_fast(&Color_text_normal); strcpy_s(buf, Scan_code_text[Key_sets[Cur_hotkey]]); gr_get_string_size(&w, &h, buf); gr_printf_menu(Hotkey_function_name_coords[gr_screen.res][0] + (Hotkey_function_name_coords[gr_screen.res][2] - w) / 2, Hotkey_function_name_coords[gr_screen.res][1], buf); font::set_font(font::FONT1); line = Scroll_offset; while (hotkey_line_query_visible(line)) { z = Hotkey_lines[line].index; y = Hotkey_list_coords[gr_screen.res][1] + Hotkey_lines[line].y - Hotkey_lines[Scroll_offset].y; hotkeys = 0; switch (Hotkey_lines[line].type) { case HOTKEY_LINE_HEADING: gr_set_color_fast(&Color_text_heading); gr_get_string_size(&w, &h, Hotkey_lines[line].label); i = y + h / 2 - 1; gr_line(Hotkey_list_coords[gr_screen.res][0], i, Hotkey_ship_x[gr_screen.res] - 2, i, GR_RESIZE_MENU); gr_line(Hotkey_ship_x[gr_screen.res] + w + 1, i, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2], i, GR_RESIZE_MENU); break; case HOTKEY_LINE_WING: gr_set_bitmap(Wing_bmp); bm_get_info(Wing_bmp, NULL, &h, NULL); i = y + font_height / 2 - h / 2 - 1; gr_bitmap(Hotkey_wing_icon_x[gr_screen.res], i, GR_RESIZE_MENU); // i = y + font_height / 2 - 1; // gr_set_color_fast(&circle_color); // gr_circle(ICON_LIST_X + 4, i, 5, GR_RESIZE_MENU); // gr_set_color_fast(&Color_bright); // gr_line(ICON_LIST_X, i, ICON_LIST_X + 2, i, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 4, i - 4, ICON_LIST_X + 4, i - 2, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 6, i, ICON_LIST_X + 8, i, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 4, i + 2, ICON_LIST_X + 4, i + 4, GR_RESIZE_MENU); hotkeys = get_wing_hotkeys(Hotkey_lines[line].index); break; case HOTKEY_LINE_SHIP: case HOTKEY_LINE_SUBSHIP: hotkeys = Hotkey_bits[Hotkey_lines[line].index]; break; default: Int3(); } if (Hotkey_lines[line].type != HOTKEY_LINE_HEADING) { Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX ); List_buttons[line - Scroll_offset].update_dimensions(Hotkey_list_coords[gr_screen.res][0], y, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_list_coords[gr_screen.res][0], font_height); List_buttons[line - Scroll_offset].enable(); if (hotkeys & (1 << Cur_hotkey)) { gr_set_color_fast(&Color_text_active); } else { if (line == Selected_line) gr_set_color_fast(&Color_text_selected); else if (line == select_tease_line) gr_set_color_fast(&Color_text_subselected); else gr_set_color_fast(&Color_text_normal); } } else { Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX ); List_buttons[line - Scroll_offset].disable(); } // print active hotkeys associated for this line if (hotkeys) { for (i=0; i<MAX_KEYED_TARGETS; i++) { if (hotkeys & (1 << i)) { gr_printf_menu(Hotkey_list_coords[gr_screen.res][0] + Hotkey_function_field_width[gr_screen.res]*i, y, Scan_code_text[Key_sets[i]]); } } /* *buf = 0; for (i=0; i<MAX_KEYED_TARGETS; i++) { if (hotkeys & (1 << i)) { strcat_s(buf, Scan_code_text[Key_sets[i]]); strcat_s(buf, ", "); } } Assert(strlen(buf) > 1); buf[strlen(buf) - 2] = 0; // lose the ", " on the end font::force_fit_string(buf, 255, GROUP_LIST_W); gr_printf_menu(GROUP_LIST_X, y, buf);*/ } // draw ship/wing name strcpy_s(buf, Hotkey_lines[line].label); end_string_at_first_hash_symbol(buf); if (Hotkey_lines[line].type == HOTKEY_LINE_SUBSHIP) { // indent font::force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - (Hotkey_ship_x[gr_screen.res]+20)); gr_printf_menu(Hotkey_ship_x[gr_screen.res]+20, y, buf); } else { font::force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_ship_x[gr_screen.res]); gr_printf_menu(Hotkey_ship_x[gr_screen.res], y, buf); } line++; } i = line - Scroll_offset; while (i < LIST_BUTTONS_MAX) List_buttons[i++].disable(); // blit help overlay if active help_overlay_maybe_blit(Hotkey_overlay_id, gr_screen.res); gr_flip(); }
void VoiceActingManager::OnGenerateScript() { int i; char pathname[256]; // stuff data to variables UpdateData(TRUE); // prompt to save script CFileDialog dlg(FALSE, "txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text files (*.txt)|*.txt||"); if (dlg.DoModal() != IDOK) return; CString dlgPathName = dlg.GetPathName( ); string_copy(pathname, dlgPathName, 256); fp = cfopen(pathname, "wt", CFILE_NORMAL); if (!fp) { MessageBox("Can't open file to save.", "Error!"); return; } fout("%s\n", Mission_filename); fout("%s\n\n", The_mission.name); if (m_export_everything || m_export_command_briefings) { fout("\n\nCommand Briefings\n-----------------\n\n"); for (i = 0; i < Cmd_briefs[0].num_stages; i++) { CString entry = m_script_entry_format; entry.Replace("\r\n", "\n"); cmd_brief_stage *stage = &Cmd_briefs[0].stage[i]; entry.Replace("$filename", stage->wave_filename); entry.Replace("$message", stage->text); entry.Replace("$persona", "<no persona specified>"); entry.Replace("$sender", "<no sender specified>"); fout("%s\n\n\n", (char *) (LPCTSTR) entry); } } if (m_export_everything || m_export_briefings) { fout("\n\nBriefings\n---------\n\n"); for (i = 0; i < Briefings[0].num_stages; i++) { CString entry = m_script_entry_format; entry.Replace("\r\n", "\n"); brief_stage *stage = &Briefings[0].stages[i]; entry.Replace("$filename", stage->voice); entry.Replace("$message", stage->new_text); entry.Replace("$persona", "<no persona specified>"); entry.Replace("$sender", "<no sender specified>"); fout("%s\n\n\n", (char *) (LPCTSTR) entry); } } if (m_export_everything || m_export_debriefings) { fout("\n\nDebriefings\n-----------\n\n"); for (i = 0; i < Debriefings[0].num_stages; i++) { CString entry = m_script_entry_format; entry.Replace("\r\n", "\n"); debrief_stage *stage = &Debriefings[0].stages[i]; entry.Replace("$filename", stage->voice); entry.Replace("$message", stage->new_text); entry.Replace("$persona", "<no persona specified>"); entry.Replace("$sender", "<no sender specified>"); fout("%s\n\n\n", (char *) (LPCTSTR) entry); } } if (m_export_everything || m_export_messages) { fout("\n\nMessages\n--------\n\n"); for (i = 0; i < Num_messages - Num_builtin_messages; i++) { CString entry = m_script_entry_format; entry.Replace("\r\n", "\n"); MMessage *message = &Messages[i + Num_builtin_messages]; // replace file name entry.Replace("$filename", message->wave_info.name); // determine and replace persona entry.Replace("$message", message->message); if (message->persona_index >= 0) entry.Replace("$persona", Personas[message->persona_index].name); else entry.Replace("$persona", "<none>"); // determine sender char sender[NAME_LENGTH+1]; strcpy_s(sender, get_message_sender(message->name)); int shipnum = ship_name_lookup(sender); if (shipnum >= 0) { ship *shipp = &Ships[shipnum]; // we may have to use the callsign if (*Fred_callsigns[shipnum]) { hud_stuff_ship_callsign(sender, shipp); } // account for hidden ship names else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) ) { hud_stuff_ship_class(sender, shipp); } // use the regular sender text else { end_string_at_first_hash_symbol(sender); } } // replace sender (but print #Command as Command) if (*sender == '#') entry.Replace("$sender", &sender[1]); else entry.Replace("$sender", sender); fout("%s\n\n\n", (char *) (LPCTSTR) entry); } } cfclose(fp); // notify MessageBox("Script generation complete.", "Woohoo!"); }