void pilotfile::plr_write_multiplayer() { startSection(Section::Multiplayer); // netgame options cfwrite_ubyte(p->m_server_options.squad_set, cfp); cfwrite_ubyte(p->m_server_options.endgame_set, cfp); cfwrite_int(p->m_server_options.flags, cfp); cfwrite_uint(p->m_server_options.respawn, cfp); cfwrite_ubyte(p->m_server_options.max_observers, cfp); cfwrite_ubyte(p->m_server_options.skill_level, cfp); cfwrite_ubyte(p->m_server_options.voice_qos, cfp); cfwrite_int(p->m_server_options.voice_token_wait, cfp); cfwrite_int(p->m_server_options.voice_record_time, cfp); cfwrite_int((int)p->m_server_options.mission_time_limit, cfp); cfwrite_int(p->m_server_options.kill_limit, cfp); // local options cfwrite_int(p->m_local_options.flags, cfp); cfwrite_int(p->m_local_options.obj_update_level, cfp); // netgame protocol cfwrite_int(Multi_options_g.protocol, cfp); endSection(); }
void pilotfile_convert::plr_export_multiplayer() { startSection(Section::Multiplayer); // netgame options cfwrite_ubyte(plr->multi_squad_set, cfp); cfwrite_ubyte(plr->multi_endgame_set, cfp); cfwrite_int(plr->multi_flags, cfp); cfwrite_uint(plr->multi_respawn, cfp); cfwrite_ubyte(plr->multi_max_observers, cfp); cfwrite_ubyte(plr->multi_skill_level, cfp); cfwrite_ubyte(plr->multi_voice_qos, cfp); cfwrite_int(plr->multi_voice_token_wait, cfp); cfwrite_int(plr->multi_voice_record_time, cfp); cfwrite_int(plr->multi_time_limit, cfp); cfwrite_int(plr->multi_kill_limit, cfp); // local options cfwrite_int(plr->multi_local_flags, cfp); cfwrite_int(plr->multi_local_update_level, cfp); // netgame protocol cfwrite_int(plr->net_protocol, cfp); endSection(); }
void pilotfile_convert::csg_export_cutscenes() { SCP_vector<cutscene_info>::iterator cut; startSection(Section::Cutscenes); // convert the old int bitfield to the new vector // the 32 is the size-in-bits of the old int on all platforms // supported by FSO prior to 3.7.0 size_t size = Cutscenes.size(); size_t viewableScenes = 0; for (size_t j=0; j<size && j<32; ++j) { if ( csg->cutscenes & (1<<j) ) { Cutscenes.at(j).viewable = true; viewableScenes++; } } // Check for possible overflow because we can only write 32 bit integers Assertion(viewableScenes <= std::numeric_limits<uint>::max(), "Too many viewable cutscenes! Maximum is %ud!", std::numeric_limits<uint>::max()); // output cutscene data in new format cfwrite_uint((uint)viewableScenes, cfp); for(cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut) { if(cut->viewable) cfwrite_string_len(cut->filename, cfp); } endSection(); }
void pilotfile::plr_write_stats_multi() { int idx, list_size = 0; startSection(Section::ScoringMulti); // global, all-time stats cfwrite_int(multi_stats.score, cfp); cfwrite_int(multi_stats.rank, cfp); cfwrite_int(multi_stats.assists, cfp); cfwrite_int(multi_stats.kill_count, cfp); cfwrite_int(multi_stats.kill_count_ok, cfp); cfwrite_int(multi_stats.bonehead_kills, cfp); cfwrite_uint(multi_stats.p_shots_fired, cfp); cfwrite_uint(multi_stats.p_shots_hit, cfp); cfwrite_uint(multi_stats.p_bonehead_hits, cfp); cfwrite_uint(multi_stats.s_shots_fired, cfp); cfwrite_uint(multi_stats.s_shots_hit, cfp); cfwrite_uint(multi_stats.s_bonehead_hits, cfp); cfwrite_uint(multi_stats.flight_time, cfp); cfwrite_uint(multi_stats.missions_flown, cfp); cfwrite_int((int)multi_stats.last_flown, cfp); cfwrite_int((int)multi_stats.last_backup, cfp); // ship kills (contains medals across all mods, not just current) list_size = (int)multi_stats.ship_kills.size(); cfwrite_int(list_size, cfp); for (idx = 0; idx < list_size; idx++) { cfwrite_string_len(multi_stats.ship_kills[idx].name.c_str(), cfp); cfwrite_int(multi_stats.ship_kills[idx].val, cfp); } // medals earned (contains medals across all mods, not just current) list_size = (int)multi_stats.medals_earned.size(); cfwrite_int(list_size, cfp); for (idx = 0; idx < list_size; idx++) { cfwrite_string_len(multi_stats.medals_earned[idx].name.c_str(), cfp); cfwrite_int(multi_stats.medals_earned[idx].val, cfp); } endSection(); }
void pilotfile::csg_write_cutscenes() { SCP_vector<cutscene_info>::iterator cut; startSection(Section::Cutscenes); size_t viewableScenes = 0; for(cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut) { if(cut->viewable) viewableScenes ++; } cfwrite_uint(viewableScenes, cfp); for(cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut) { if(cut->viewable) cfwrite_string_len(cut->filename, cfp); } endSection(); }
void pilotfile::csg_write_stats() { int idx; startSection(Section::Scoring); // scoring stats cfwrite_int(p->stats.score, cfp); cfwrite_int(p->stats.rank, cfp); cfwrite_int(p->stats.assists, cfp); cfwrite_int(p->stats.kill_count, cfp); cfwrite_int(p->stats.kill_count_ok, cfp); cfwrite_int(p->stats.bonehead_kills, cfp); cfwrite_uint(p->stats.p_shots_fired, cfp); cfwrite_uint(p->stats.p_shots_hit, cfp); cfwrite_uint(p->stats.p_bonehead_hits, cfp); cfwrite_uint(p->stats.s_shots_fired, cfp); cfwrite_uint(p->stats.s_shots_hit, cfp); cfwrite_uint(p->stats.s_bonehead_hits, cfp); cfwrite_uint(p->stats.flight_time, cfp); cfwrite_uint(p->stats.missions_flown, cfp); cfwrite_int((int)p->stats.last_flown, cfp); cfwrite_int((int)p->stats.last_backup, cfp); // ship kills (scoring) for (idx = 0; idx < static_cast<int>(Ship_info.size()); idx++) { cfwrite_int(p->stats.kills[idx], cfp); } // medals earned (scoring) for (idx = 0; idx < Num_medals; idx++) { cfwrite_int(p->stats.medal_counts[idx], cfp); } endSection(); }
void pilotfile_convert::csg_export_stats() { startSection(Section::Scoring); // scoring stats cfwrite_int(csg->stats.score, cfp); cfwrite_int(csg->stats.rank, cfp); cfwrite_int(csg->stats.assists, cfp); cfwrite_int(csg->stats.kill_count, cfp); cfwrite_int(csg->stats.kill_count_ok, cfp); cfwrite_int(csg->stats.bonehead_kills, cfp); cfwrite_uint(csg->stats.p_shots_fired, cfp); cfwrite_uint(csg->stats.p_shots_hit, cfp); cfwrite_uint(csg->stats.p_bonehead_hits, cfp); cfwrite_uint(csg->stats.s_shots_fired, cfp); cfwrite_uint(csg->stats.s_shots_hit, cfp); cfwrite_uint(csg->stats.s_bonehead_hits, cfp); cfwrite_uint(csg->stats.flight_time, cfp); cfwrite_uint(csg->stats.missions_flown, cfp); cfwrite_int((int)csg->stats.last_flown, cfp); cfwrite_int((int)csg->stats.last_backup, cfp); // ship kills (scoring) size_t list_size = csg->stats.ship_kills.size(); for (size_t idx = 0; idx < list_size; idx++) { cfwrite_int(csg->stats.ship_kills[idx].val, cfp); } // medals earned (scoring) list_size = csg->stats.medals_earned.size(); for (size_t idx = 0; idx < list_size; idx++) { cfwrite_int(csg->stats.medals_earned[idx].val, cfp); } endSection(); }
void pilotfile::csg_write_cutscenes() { SCP_vector<cutscene_info>::iterator cut; startSection(Section::Cutscenes); size_t viewableScenes = 0; for(cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut) { if(cut->viewable) viewableScenes ++; } // Check for possible overflow because we can only write 32 bit integers Assertion(viewableScenes <= std::numeric_limits<uint>::max(), "Too many viewable cutscenes! Maximum is %ud!", std::numeric_limits<uint>::max()); cfwrite_uint((uint)viewableScenes, cfp); for(cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut) { if(cut->viewable) cfwrite_string_len(cut->filename, cfp); } endSection(); }
void pilotfile::csg_write_missions() { int idx, j; cmission *missionp; startSection(Section::Missions); for (idx = 0; idx < MAX_CAMPAIGN_MISSIONS; idx++) { if (Campaign.missions[idx].completed) { missionp = &Campaign.missions[idx]; cfwrite_int(idx, cfp); // flags cfwrite_int(missionp->flags, cfp); // goals cfwrite_int(missionp->num_goals, cfp); for (j = 0; j < missionp->num_goals; j++) { cfwrite_string_len(missionp->goals[j].name, cfp); cfwrite_char(missionp->goals[j].status, cfp); } // events cfwrite_int(missionp->num_events, cfp); for (j = 0; j < missionp->num_events; j++) { cfwrite_string_len(missionp->events[j].name, cfp); cfwrite_char(missionp->events[j].status, cfp); } // variables cfwrite_int(missionp->num_variables, cfp); for (j = 0; j < missionp->num_variables; j++) { cfwrite_int(missionp->variables[j].type, cfp); cfwrite_string_len(missionp->variables[j].text, cfp); cfwrite_string_len(missionp->variables[j].variable_name, cfp); } // scoring stats cfwrite_int(missionp->stats.score, cfp); cfwrite_int(missionp->stats.rank, cfp); cfwrite_int(missionp->stats.assists, cfp); cfwrite_int(missionp->stats.kill_count, cfp); cfwrite_int(missionp->stats.kill_count_ok, cfp); cfwrite_int(missionp->stats.bonehead_kills, cfp); cfwrite_uint(missionp->stats.p_shots_fired, cfp); cfwrite_uint(missionp->stats.p_shots_hit, cfp); cfwrite_uint(missionp->stats.p_bonehead_hits, cfp); cfwrite_uint(missionp->stats.s_shots_fired, cfp); cfwrite_uint(missionp->stats.s_shots_hit, cfp); cfwrite_uint(missionp->stats.s_bonehead_hits, cfp); // ship kills (scoring) for (j = 0; j < static_cast<int>(Ship_info.size()); j++) { cfwrite_int(missionp->stats.kills[j], cfp); } // medals earned (scoring) for (j = 0; j < Num_medals; j++) { cfwrite_int(missionp->stats.medal_counts[j], cfp); } } } endSection(); }
void pilot::BinaryFileHandler::writeUInt(const char*, std::uint32_t value) { cfwrite_uint(value, _cfp); }
void pilotfile_convert::csg_export_missions() { startSection(Section::Missions); size_t list_size = csg->missions.size(); for (size_t idx = 0; idx < list_size; idx++) { cfwrite_int(csg->missions[idx].index, cfp); // flags cfwrite_int(csg->missions[idx].flags, cfp); // goals size_t count = csg->missions[idx].goals.size(); cfwrite_int((int)count, cfp); for (size_t j = 0; j < count; j++) { cfwrite_string_len(csg->missions[idx].goals[j].name, cfp); cfwrite_char(csg->missions[idx].goals[j].status, cfp); } // events count = csg->missions[idx].events.size(); cfwrite_int((int)count, cfp); for (size_t j = 0; j < count; j++) { cfwrite_string_len(csg->missions[idx].events[j].name, cfp); cfwrite_char(csg->missions[idx].events[j].status, cfp); } // variables count = csg->missions[idx].variables.size(); cfwrite_int((int)count, cfp); for (size_t j = 0; j < count; j++) { cfwrite_int(csg->missions[idx].variables[j].type, cfp); cfwrite_string_len(csg->missions[idx].variables[j].text, cfp); cfwrite_string_len(csg->missions[idx].variables[j].variable_name, cfp); } // scoring stats cfwrite_int(csg->missions[idx].stats.score, cfp); cfwrite_int(csg->missions[idx].stats.rank, cfp); cfwrite_int(csg->missions[idx].stats.assists, cfp); cfwrite_int(csg->missions[idx].stats.kill_count, cfp); cfwrite_int(csg->missions[idx].stats.kill_count_ok, cfp); cfwrite_int(csg->missions[idx].stats.bonehead_kills, cfp); cfwrite_uint(csg->missions[idx].stats.p_shots_fired, cfp); cfwrite_uint(csg->missions[idx].stats.p_shots_hit, cfp); cfwrite_uint(csg->missions[idx].stats.p_bonehead_hits, cfp); cfwrite_uint(csg->missions[idx].stats.s_shots_fired, cfp); cfwrite_uint(csg->missions[idx].stats.s_shots_hit, cfp); cfwrite_uint(csg->missions[idx].stats.s_bonehead_hits, cfp); // ship kills (scoring) count = csg->missions[idx].stats.ship_kills.size(); for (size_t j = 0; j < count; j++) { cfwrite_int(csg->missions[idx].stats.ship_kills[j].val, cfp); } // medals earned (scoring) count = csg->missions[idx].stats.medals_earned.size(); for (size_t j = 0; j < count; j++) { cfwrite_int(csg->missions[idx].stats.medals_earned[j].val, cfp); } } endSection(); }