126 void pilotfile_convert::plr_import_controls()
133 if ( !num_controls ) {
138 if (num_controls > 118) {
139 throw "Data check failure in controls!";
142 plr->
controls.reserve(num_controls);
144 for (idx = 0; idx < num_controls; idx++) {
161 void pilotfile_convert::plr_import_hud()
176 for (idx = 0; idx < 39; idx++) {
180 throw "Data check failure in hud!";
190 void pilotfile_convert::plr_import_detail()
192 bool data_failure =
false;
234 throw "Data check failure in details!";
238 void pilotfile_convert::plr_import_stats()
254 for (idx = 0; idx < 18; idx++) {
261 for (idx = 0; idx <
count; idx++) {
279 void pilotfile_convert::plr_import_loadout()
282 int s_count, w_count;
298 for (idx = 0; idx < s_count; idx++) {
304 for (idx = 0; idx < w_count; idx++) {
310 for (idx = 0; idx < 12; idx++) {
314 for (j = 0; j < 12; j++) {
322 void pilotfile_convert::plr_import_multiplayer()
340 void pilotfile_convert::plr_import_red_alert()
353 if ( (num_slots < 0) || (num_slots >= 32) ) {
354 throw "Data check failure in red-alert!";
361 for (idx = 0; idx < num_slots; idx++) {
368 for (j = 0; j < 64; j++) {
373 for (j = 0; j < 12; j++) {
378 for (j = 0; j < 12; j++) {
385 void pilotfile_convert::plr_import_variables()
392 if ( (num_variables < 0) || (num_variables >= 100) ) {
393 throw "Data check failure in variables!";
398 for (idx = 0; idx < num_variables; idx++) {
407 void pilotfile_convert::plr_import()
414 if (plr_id != 0x46505346) {
415 throw "Invalid file signature!";
420 if ( (fver != 142) && (fver != 242) ) {
421 throw "Unsupported file version!";
437 if ( (plr->
tips < 0) || (plr->
tips > 1) ) {
438 throw "Data check failure!";
448 plr_import_controls();
469 for (idx = 0; idx < num_missions; idx++) {
479 throw "Data check failure!";
483 for (idx = 0; idx < 5; idx++) {
492 plr_import_loadout();
495 plr_import_multiplayer();
507 throw "Data check failure!";
511 plr_import_red_alert();
517 throw "Data check failure!";
527 plr_import_variables();
533 void pilotfile_convert::plr_export_flags()
535 startSection(Section::Flags);
561 void pilotfile_convert::plr_export_info()
563 startSection(Section::Info);
580 void pilotfile_convert::plr_export_stats()
582 int idx, list_size = 0;
584 startSection(Section::Scoring);
611 for (idx = 0; idx < list_size; idx++) {
620 for (idx = 0; idx < list_size; idx++) {
628 void pilotfile_convert::plr_export_stats_multi()
630 int idx, list_size = 0;
632 startSection(Section::ScoringMulti);
659 for (idx = 0; idx < list_size; idx++) {
668 for (idx = 0; idx < list_size; idx++) {
676 void pilotfile_convert::plr_export_hud()
680 startSection(Section::HUD);
702 for (idx = 0; idx < 39; idx++) {
712 void pilotfile_convert::plr_export_variables()
717 startSection(Section::Variables);
723 for (idx = 0; idx < list_size; idx++) {
732 void pilotfile_convert::plr_export_multiplayer()
734 startSection(Section::Multiplayer);
759 void pilotfile_convert::plr_export_controls()
763 startSection(Section::Controls);
767 for (idx = 0; idx < plr->
controls.size(); idx++) {
776 for (idx = 0; idx < MAX_JOY_AXES_CONV; idx++) {
784 void pilotfile_convert::plr_export_settings()
786 startSection(Section::Settings);
821 void pilotfile_convert::plr_export()
835 plr_export_stats_multi();
837 plr_export_variables();
838 plr_export_multiplayer();
839 plr_export_controls();
840 plr_export_settings();
862 filename.reserve(200);
870 filename.append(fname);
871 filename.append(
".pl2");
873 mprintf((
" PL2 => Converting '%s'...\n", filename.c_str()));
878 mprintf((
" PL2 => Unable to open '%s' for import!\n", fname));
884 }
catch (
const char *err) {
885 mprintf((
" PL2 => Import ERROR: %s\n", err));
896 filename.assign(fname);
897 filename.append(
".plr");
902 mprintf((
" PLR => Unable to open '%s' for export!\n", fname));
908 }
catch (
const char *err) {
909 mprintf((
" PLR => Export ERROR: %s\n", err));
917 mprintf((
" PLR => Conversion complete!\n"));
int cfwrite_ushort(ushort s, CFILE *file)
int Briefing_voice_enabled
#define CF_TYPE_SINGLE_PLAYERS
SCP_vector< index_list_t > medals_earned
short key_id
actual key bound to action
int cfread(void *buf, int elsize, int nelem, CFILE *fp)
SCP_vector< sexp_variable > variables
int cfwrite_ubyte(ubyte b, CFILE *file)
int cfwrite_uint(uint i, CFILE *file)
SCP_vector< config_item > controls
void cfread_string(char *buf, int n, CFILE *file)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
int cf_create_default_path_string(char *path, uint path_max, int pathtype, const char *filename, bool localize)
unsigned char hud_colors[39][4]
short joy_id
joystick button bound to action
unsigned int s_bonehead_hits
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int multi_voice_record_time
int detail_hardware_textures
unsigned int multi_respawn
int cfwrite_float(float f, CFILE *file)
#define DIR_SEPARATOR_STR
int multi_local_update_level
SCP_vector< index_list_t > ship_kills
unsigned char multi_squad_set
char language[LCL_LANG_NAME_LEN+1]
bool plr_convert(const char *fname, bool inferno)
int cfwrite_string_len(const char *buf, CFILE *file)
Write a fixed length string (not including its null terminator), with the length stored in file...
unsigned int p_shots_fired
char current_campaign[35]
int detail_shield_effects
short cfread_short(CFILE *file, int ver, short deflt)
unsigned char multi_skill_level
struct conv_color conv_color
int cfwrite_int(int i, CFILE *file)
unsigned int s_shots_fired
unsigned int p_bonehead_hits
ubyte cfread_ubyte(CFILE *file, int ver, ubyte deflt)
GLuint const GLchar * name
unsigned char multi_endgame_set
int cfwrite_short(short s, CFILE *file)
unsigned int missions_flown
unsigned char multi_voice_qos
ushort cfread_ushort(CFILE *file, int ver, ushort deflt)
int readyroom_listing_mode
int cfread_int(CFILE *file, int ver, int deflt)
float cfread_float(CFILE *file, int ver, float deflt)
int multi_voice_token_wait
char variable_name[TOKEN_LENGTH]
unsigned char multi_max_observers
int cfclose(CFILE *cfile)
int detail_targetview_model
unsigned char hud_num_lines
void lcl_get_language_name(char *lang_name)
uint cfread_uint(CFILE *file, int ver, uint deflt)
void cfread_string_len(char *buf, int n, CFILE *file)
Read a fixed length string that is not null-terminated, with the length stored in file...