From 7f8b1591644fa2fb43ad654f978e69e679533c83 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Thu, 10 Sep 2015 20:22:03 -0400 Subject: [PATCH] resolve various FS1 build issues --- include/gtrack.h | 8 ++++ include/multi_fstracker.h | 6 +-- include/ptrack.h | 22 +++++++---- src/launcher/launcher.cpp | 2 + src/menuui/optionsmenumulti.cpp | 4 +- src/menuui/techmenu.cpp | 16 ++++---- src/network/gtrack.cpp | 22 ++++++++++- src/network/multi_fstracker.cpp | 65 ++++++++++++++++++++++----------- src/network/multi_pxo.cpp | 8 ++-- src/network/ptrack.cpp | 58 +++++++++++++++++++---------- src/weapon/weapons.cpp | 13 ++++--- 11 files changed, 152 insertions(+), 72 deletions(-) diff --git a/include/gtrack.h b/include/gtrack.h index 180921b..43aeebf 100644 --- a/include/gtrack.h +++ b/include/gtrack.h @@ -12,7 +12,11 @@ //Game Tracker client code header +#ifdef MAKE_FS1 +#define GAMEPORT 3440 +#else #define GAMEPORT 7802 +#endif #define MAX_NET_RETRIES 30 #define NET_ACK_TIMEOUT 2500 @@ -78,6 +82,8 @@ typedef struct { char channel[CHANNEL_LEN]; } freespace_net_game_data; +#define pxo_net_game_data freespace_net_game_data + #else typedef struct { @@ -92,6 +98,8 @@ typedef struct { char pad[3]; // 3-byte padding for size/alignment } freespace2_net_game_data; +#define pxo_net_game_data freespace2_net_game_data + #endif typedef struct _active_games{ diff --git a/include/multi_fstracker.h b/include/multi_fstracker.h index f71fbaa..f7c605d 100644 --- a/include/multi_fstracker.h +++ b/include/multi_fstracker.h @@ -98,7 +98,7 @@ #define MSW_STATUS_VALID 0 #define MSW_STATUS_INVALID 1 -struct vmt_freespace2_struct; +//struct vmt_freespace2_struct; struct scoring_struct; struct squad_war_request; struct squad_war_result; @@ -147,10 +147,10 @@ void multi_fs_tracker_update_game(netgame_info *ng); int multi_fs_tracker_busy(); // copy a freespace stats struct to a tracker-freespace stats struct -void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_freespace2_struct *vmt, player *pl, int tracker_id); +void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_stats_struct *vmt, player *pl, int tracker_id); // copy a tracker-freespace stats struct to a freespace stats struct -void multi_stats_tracker_to_fs(vmt_freespace2_struct *vmt, scoring_struct *fs); +void multi_stats_tracker_to_fs(vmt_stats_struct *vmt, scoring_struct *fs); // return an MVALID_STATUS_* value, or -2 if the user has "cancelled" int multi_fs_tracker_validate_mission(char *filename); diff --git a/include/ptrack.h b/include/ptrack.h index 5487bd8..1718e9f 100644 --- a/include/ptrack.h +++ b/include/ptrack.h @@ -13,7 +13,9 @@ #include "scoring.h" // for medals count //Pilot tracker client header -#ifdef FS2_DEMO +#if defined(MAKE_FS1) + #define REGPORT 3493 +#elif defined(FS2_DEMO) #define REGPORT 7802 #else #define REGPORT 8811 @@ -201,6 +203,8 @@ typedef struct vmt_freespace_struct { char tracker_id[TRACKER_ID_LEN]; char pilot_name[PILOT_NAME_LEN]; + char pad_a[2]; // 2-bytes padding + int score; int rank; int medals[MAX_FS_MEDALS]; @@ -221,6 +225,9 @@ typedef struct vmt_freespace_struct { int security; unsigned char virgin_pilot; //This pilot was just created if TRUE + + char pad_b[3]; // 3-bytes padding + unsigned int checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded unsigned int missions_flown; // # of missions flown to completion @@ -229,6 +236,8 @@ typedef struct vmt_freespace_struct { } vmt_freespace_struct; #define FREESPACE_BLOCK_SIZE (sizeof(vmt_freespace_struct)) +#define vmt_stats_struct vmt_freespace_struct + #else // ------------------------------------------------------------------------------------------------------------ @@ -310,19 +319,16 @@ typedef struct vmt_freespace_struct { #endif #define FREESPACE2_BLOCK_SIZE (sizeof(vmt_freespace2_struct)) +#define vmt_stats_struct vmt_freespace2_struct + #endif // MAKE_FS1 //Function prototypes int InitPilotTrackerClient(); void AckServer(unsigned int sig); -#ifdef MAKE_FS1 -int SendFSPilotData(vmt_freespace2_struct *fs_pilot); -int GetFSPilotData(vmt_freespace2_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int update_security); -#else -int SendFSPilotData(vmt_freespace2_struct *fs_pilot); -int GetFSPilotData(vmt_freespace2_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int update_security); -#endif +int SendFSPilotData(vmt_stats_struct *fs_pilot); +int GetFSPilotData(vmt_stats_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int update_security); int SendSWData(squad_war_result *sw_res, squad_war_response *sw_resp); void PollPTrackNet(); diff --git a/src/launcher/launcher.cpp b/src/launcher/launcher.cpp index aa26f83..a314840 100644 --- a/src/launcher/launcher.cpp +++ b/src/launcher/launcher.cpp @@ -363,6 +363,7 @@ void Launcher::OnUpdate( wxCommandEvent& WXUNUSED(event) ) void Launcher::OnHelp( wxCommandEvent& WXUNUSED(event) ) { +#ifndef MAKE_FS1 wxDialog *help = new wxDialog(this, wxID_ANY, wxT("Launcher Help"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSYSTEM_MENU); wxBoxSizer* bSizer; @@ -390,6 +391,7 @@ void Launcher::OnHelp( wxCommandEvent& WXUNUSED(event) ) help->ShowModal(); help->Destroy(); +#endif } void Launcher::OnUninstall( wxCommandEvent& WXUNUSED(event) ) diff --git a/src/menuui/optionsmenumulti.cpp b/src/menuui/optionsmenumulti.cpp index fc42c07..2ee0e9c 100644 --- a/src/menuui/optionsmenumulti.cpp +++ b/src/menuui/optionsmenumulti.cpp @@ -1028,10 +1028,12 @@ void options_multi_load_protocol_controls() Om_ip_input.create(Om_window, Ip_input_coords[gr_screen.res][0], Ip_input_coords[gr_screen.res][1], Ip_input_coords[gr_screen.res][2], IP_STRING_LEN, IP_EMPTY_STRING, UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_ESC_CLR | UI_INPUTBOX_FLAG_KEYTHRU); Om_ip_input.hide(); Om_ip_input.disable(); - + +#ifndef MAKE_FS1 // disable IPX button Om_pro_buttons[gr_screen.res][OM_PRO_IPX].button.disable(); Om_pro_buttons[gr_screen.res][OM_PRO_IPX].button.hide(); +#endif // bogus control Om_pro_bogus.base_create(Om_window, UI_KIND_ICON, 0, 0, 0, 0); diff --git a/src/menuui/techmenu.cpp b/src/menuui/techmenu.cpp index 5658b7c..8bbbdc0 100644 --- a/src/menuui/techmenu.cpp +++ b/src/menuui/techmenu.cpp @@ -1124,7 +1124,10 @@ void techroom_start_anim() void techroom_change_tab(int num) { - int i, multi = 0, mask, font_height, max_num_entries_viewable; + int i, multi = 0, mask; +#ifndef MAKE_FS1 + int font_height, max_num_entries_viewable; +#endif Tab = num; // SDL_assert(Current_list_size >= 0); @@ -1172,9 +1175,9 @@ void techroom_change_tab(int num) Current_list = Ship_list; Current_list_size = Ship_list_size; +#ifndef MAKE_FS1 font_height = gr_get_font_height(); max_num_entries_viewable = Tech_list_coords[gr_screen.res][SHIP_H_COORD] / font_height; -#ifndef MAKE_FS1 Tech_slider.set_numberItems(Current_list_size > max_num_entries_viewable ? Current_list_size-max_num_entries_viewable : 0); #endif @@ -1278,9 +1281,9 @@ void techroom_change_tab(int num) Current_list = Weapon_list; Current_list_size = Weapon_list_size; +#ifndef MAKE_FS1 font_height = gr_get_font_height(); max_num_entries_viewable = Tech_list_coords[gr_screen.res][SHIP_H_COORD] / font_height; -#ifndef MAKE_FS1 Tech_slider.set_numberItems(Current_list_size > max_num_entries_viewable ? Current_list_size-max_num_entries_viewable : 0); #endif @@ -1328,9 +1331,9 @@ void techroom_change_tab(int num) Current_list = Intel_list; Current_list_size = Intel_list_size; +#ifndef MAKE_FS1 font_height = gr_get_font_height(); max_num_entries_viewable = Tech_list_coords[gr_screen.res][SHIP_H_COORD] / font_height; -#ifndef MAKE_FS1 Tech_slider.set_numberItems(Current_list_size > max_num_entries_viewable ? Current_list_size-max_num_entries_viewable : 0); #endif @@ -1811,11 +1814,6 @@ void techroom_tab_setup(int set_palette) { // char *pal; int i; - int flags[256]; - - for (i=0; i<256; i++){ - flags[i] = 0; - } // activate, deactivate any necessary controls for (i=0; idata; + pxo_net_game_data *game_data = (pxo_net_game_data *)&gph->data; PXO_ADD_DATA(game_data->game_name); PXO_ADD_INT(game_data->difficulty); @@ -126,8 +130,24 @@ static int SerializeGamePacket(const game_packet_header *gph, ubyte *data) PXO_ADD_INT(game_data->max_players); PXO_ADD_INT(game_data->current_num_players); PXO_ADD_DATA(game_data->mission_name); + +#ifdef MAKE_FS1 + int i; + + for (i = 0; i < MAX_FREESPACE_PLAYERS; i++) { + PXO_ADD_DATA(game_data->players[i]); + } + + for (i = 0; i < MAX_FREESPACE_PLAYERS; i++) { + PXO_ADD_INT(game_data->player_rank[i]); + } +#endif + PXO_ADD_DATA(game_data->channel); + +#ifndef MAKE_FS1 PXO_ADD_DATA(game_data->pad); // for sizing, so gph->len will match +#endif break; } diff --git a/src/network/multi_fstracker.cpp b/src/network/multi_fstracker.cpp index 723accb..b8130b8 100644 --- a/src/network/multi_fstracker.cpp +++ b/src/network/multi_fstracker.cpp @@ -330,7 +330,7 @@ int multi_fs_validate_process(); int Multi_store_stats_mode; // 0 == initial request for player stats, 1 == waiting for player stats, 2 == tallying stats locally, 3 == sending stats to tracker int Multi_store_stats_player_index; // player we're currently working with int Multi_store_stats_player_flag; // if we're finished with the current guy -vmt_freespace2_struct Multi_store_stats_stats; // +vmt_stats_struct Multi_store_stats_stats; // int multi_fs_store_stats_do(); // manage all master tracker stats storing int multi_fs_store_stats_get_next_player(int cur_player); @@ -338,10 +338,10 @@ int Multi_tracker_player_is_valid = 0; int Multi_tracker_got_response = 0; // copy a freespace stats struct to a tracker-freespace stats struct -void multi_stats_fs_to_tracker(scoring_struct *fs,vmt_freespace2_struct *vmt,player *pl,int tracker_id); +void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_stats_struct *vmt, player *pl, int tracker_id); // copy a tracker-freespace stats struct to a freespace stats struct -void multi_stats_tracker_to_fs(vmt_freespace2_struct *vmt,scoring_struct *fs); +void multi_stats_tracker_to_fs(vmt_stats_struct *vmt, scoring_struct *fs); // process an incoming active game item void multi_fs_tracker_process_game_item(game_list *gl); @@ -356,8 +356,8 @@ void multi_fs_tracker_check_dup_callsign(net_player *player,int player_index); void multi_fs_tracker_report_stats_results(); // tracker specific data structures -freespace2_net_game_data Multi_tracker_game_data; -vmt_freespace2_struct Multi_tracker_fs_pilot; +pxo_net_game_data Multi_tracker_game_data; +vmt_stats_struct Multi_tracker_fs_pilot; squad_war_response Multi_tracker_sw_response; // ----------------------------------------------------------------------------------- @@ -517,7 +517,7 @@ void multi_fs_tracker_login_freespace() } // pretty much all we do is make 1 call - memset(&Multi_tracker_game_data, 0, sizeof(freespace2_net_game_data)); + memset(&Multi_tracker_game_data, 0, sizeof(Multi_tracker_game_data)); SDL_strlcpy(Multi_tracker_game_data.game_name, Netgame.name, SDL_arraysize(Multi_tracker_game_data.game_name)); Multi_tracker_game_data.difficulty = 99; Multi_tracker_game_data.type = 0; @@ -731,7 +731,7 @@ void multi_fs_tracker_logout() SendGameOver(); // clear our data - memset(&Multi_tracker_game_data, 0, sizeof(freespace2_net_game_data)); + memset(&Multi_tracker_game_data, 0, sizeof(Multi_tracker_game_data)); Net_player->flags &= ~(NETINFO_FLAG_MT_CONNECTED); // NETLOG @@ -771,8 +771,6 @@ int multi_fs_tracker_inited() // update our settings on the tracker regarding the current netgame stuff void multi_fs_tracker_update_game(netgame_info *ng) { - // int idx,count; - if(!Multi_fs_tracker_inited){ return; } @@ -780,9 +778,10 @@ void multi_fs_tracker_update_game(netgame_info *ng) // copy in the relevant data Multi_tracker_game_data.max_players = ng->max_players; Multi_tracker_game_data.current_num_players = multi_num_players(); - /* + +#ifdef MAKE_FS1 memset(Multi_tracker_game_data.players, 0 ,MAX_FREESPACE_PLAYERS * MAX_FREESPACE_PLAYER_NAME_LEN); - count = 0; + int count = 0, idx; for(idx=0;idxcallsign); @@ -790,7 +789,8 @@ void multi_fs_tracker_update_game(netgame_info *ng) count++; } } - */ +#endif + SDL_strlcpy(Multi_tracker_game_data.mission_name, ng->name, SDL_arraysize(Multi_tracker_game_data.mission_name)); // NETLOG @@ -847,8 +847,8 @@ int multi_fs_validate_process() // get my tracker id# Multi_tracker_id = atoi(Multi_tracker_id_string); SDL_assert(Multi_tracker_id != -1); - - GetFSPilotData((vmt_freespace2_struct*)0xffffffff,NULL,NULL,0); + + GetFSPilotData((vmt_stats_struct*)0xffffffff,NULL,NULL,0); GetFSPilotData(&Multi_tracker_fs_pilot,Player->callsign,Multi_tracker_id_string,1); // set to mode 1 @@ -925,8 +925,8 @@ int multi_fs_store_stats_do() Net_players[Multi_store_stats_player_index].s_info.tracker_checksum = 0; // send the request itself - GetFSPilotData((vmt_freespace2_struct*)0xffffffff, NULL, NULL,0); - memset(&Multi_store_stats_stats, 0, sizeof(vmt_freespace2_struct)); + GetFSPilotData((vmt_stats_struct*)0xffffffff, NULL, NULL,0); + memset(&Multi_store_stats_stats, 0, sizeof(Multi_store_stats_stats)); if(GetFSPilotData(&Multi_store_stats_stats, Net_players[Multi_store_stats_player_index].player->callsign,tracker_id_string,1) != 0){ Int3(); @@ -957,7 +957,7 @@ int multi_fs_store_stats_do() { // debug code to check for bogus stats scoring_struct *ssp = &(Net_players[Multi_store_stats_player_index].player->stats); - vmt_freespace2_struct *vmt = &Multi_store_stats_stats; + vmt_stats_struct *vmt = &Multi_store_stats_stats; if ( (ssp->missions_flown < vmt->missions_flown) || (ssp->flight_time < ssp->flight_time) || (ssp->kill_count < vmt->kill_count) ) { Int3(); @@ -1020,7 +1020,7 @@ int multi_fs_store_stats_do() Multi_store_stats_player_flag = 0; // fill in the information - memset(&Multi_store_stats_stats,0,sizeof(vmt_freespace2_struct)); + memset(&Multi_store_stats_stats,0,sizeof(Multi_store_stats_stats)); SDL_assert(Net_players[Multi_store_stats_player_index].tracker_player_id > 0); @@ -1035,7 +1035,7 @@ int multi_fs_store_stats_do() Multi_store_stats_stats.checksum = Net_players[Multi_store_stats_player_index].s_info.tracker_checksum; // send the request - SendFSPilotData((vmt_freespace2_struct*)0xffffffff); + SendFSPilotData((vmt_stats_struct*)0xffffffff); if(SendFSPilotData(&Multi_store_stats_stats) != 0){ Int3(); @@ -1080,7 +1080,7 @@ int multi_fs_store_stats_do() } // copy a freespace stats struct to a tracker-freespace stats struct -void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_freespace2_struct *vmt, player *pl, int tracker_id) +void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_stats_struct *vmt, player *pl, int tracker_id) { char tracker_id_string[256]; @@ -1094,17 +1094,26 @@ void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_freespace2_struct *vmt, p // score, rank and medals vmt->score = fs->score; vmt->rank = fs->rank; +#ifndef MAKE_FS1 SDL_assert(MAX_FS2_MEDALS == NUM_MEDALS); memcpy(vmt->medals, fs->medals, sizeof(int) * MAX_FS2_MEDALS); vmt->num_medals = MAX_FS2_MEDALS; +#else + memcpy(vmt->medals, fs->medals, sizeof(int) * MAX_FS_MEDALS); +#endif // kills and assists +#ifndef MAKE_FS1 SDL_assert(MAX_FS2_SHIP_TYPES == MAX_SHIP_TYPES); memcpy(vmt->kills, fs->kills, sizeof(ushort) * MAX_FS2_SHIP_TYPES); + vmt->num_ship_types = MAX_FS2_SHIP_TYPES; +#else + memcpy(vmt->kills, fs->kills, sizeof(int) * MAX_FS_SHIP_TYPES); +#endif vmt->assists = fs->assists; vmt->kill_count = fs->kill_count; vmt->kill_count_ok = fs->kill_count_ok; - vmt->num_ship_types = MAX_FS2_SHIP_TYPES; + // shot statistics vmt->p_shots_fired = fs->p_shots_fired; @@ -1122,13 +1131,16 @@ void multi_stats_fs_to_tracker(scoring_struct *fs, vmt_freespace2_struct *vmt, p } // copy a tracker-freespace stats struct to a freespace stats struct -void multi_stats_tracker_to_fs(vmt_freespace2_struct *vmt,scoring_struct *fs) +void multi_stats_tracker_to_fs(vmt_stats_struct *vmt,scoring_struct *fs) { +#ifndef MAKE_FS1 int num_medals, num_ship_types; +#endif // score, rank and medals fs->score = vmt->score; fs->rank = vmt->rank; +#ifndef MAKE_FS1 num_medals = vmt->num_medals; if(num_medals > NUM_MEDALS){ Int3(); @@ -1136,8 +1148,13 @@ void multi_stats_tracker_to_fs(vmt_freespace2_struct *vmt,scoring_struct *fs) } memset(fs->medals, 0, sizeof(int) * NUM_MEDALS); memcpy(fs->medals, vmt->medals, sizeof(int) * num_medals); +#else + SDL_zero(fs->medals); + memcpy(fs->medals, vmt->medals, sizeof(int) * NUM_MEDALS); +#endif // kills and assists +#ifndef MAKE_FS1 num_ship_types = vmt->num_ship_types; if(num_ship_types > MAX_SHIP_TYPES){ Int3(); @@ -1145,6 +1162,10 @@ void multi_stats_tracker_to_fs(vmt_freespace2_struct *vmt,scoring_struct *fs) } memset(fs->kills, 0, sizeof(ushort) * MAX_SHIP_TYPES); memcpy(fs->kills, vmt->kills, sizeof(ushort) * num_ship_types); +#else + SDL_zero(fs->kills); + memcpy(fs->kills, vmt->kills, sizeof(int) * MAX_SHIP_TYPES); +#endif fs->assists = vmt->assists; fs->kill_count = vmt->kill_count; fs->kill_count_ok = vmt->kill_count_ok; diff --git a/src/network/multi_pxo.cpp b/src/network/multi_pxo.cpp index 39711fd..7fc0ea5 100644 --- a/src/network/multi_pxo.cpp +++ b/src/network/multi_pxo.cpp @@ -1146,7 +1146,7 @@ UI_XSTR Multi_pxo_pinfo_text[GR_NUM_RESOLUTIONS][MULTI_PXO_PINFO_NUM_TEXT] = { int Multi_pxo_pinfo_bitmap = -1; UI_WINDOW Multi_pxo_pinfo_window; -vmt_freespace2_struct Multi_pxo_pinfo; +vmt_stats_struct Multi_pxo_pinfo; player Multi_pxo_pinfo_player; int Multi_pxo_retrieve_mode = -1; @@ -4622,12 +4622,12 @@ int multi_pxo_pinfo_cond() popup_change_text(XSTR("Getting player stats",968)); // fill in the data - memset(&Multi_pxo_pinfo, 0, sizeof(vmt_freespace2_struct)); + memset(&Multi_pxo_pinfo, 0, sizeof(Multi_pxo_pinfo)); SDL_strlcpy(Multi_pxo_pinfo.pilot_name, Multi_pxo_retrieve_name, SDL_arraysize(Multi_pxo_pinfo.pilot_name)); SDL_strlcpy(Multi_pxo_pinfo.tracker_id, Multi_pxo_retrieve_id, SDL_arraysize(Multi_pxo_pinfo.tracker_id)); // make the initial call to the API - GetFSPilotData((vmt_freespace2_struct*)0xffffffff,NULL,NULL,0); + GetFSPilotData((vmt_stats_struct*)0xffffffff,NULL,NULL,0); if(GetFSPilotData(&Multi_pxo_pinfo,Multi_pxo_retrieve_name,Multi_pxo_retrieve_id,0) != 0){ return 2; } @@ -4704,7 +4704,7 @@ void multi_pxo_pinfo_show() // build the stats labels values void multi_pxo_pinfo_build_vals() { - vmt_freespace2_struct *fs = &Multi_pxo_pinfo; + vmt_stats_struct *fs = &Multi_pxo_pinfo; SDL_zero(Multi_pxo_pinfo_vals); diff --git a/src/network/ptrack.cpp b/src/network/ptrack.cpp index 32db999..ab5f2e3 100644 --- a/src/network/ptrack.cpp +++ b/src/network/ptrack.cpp @@ -25,7 +25,11 @@ // check structs for size compatibility SDL_COMPILE_TIME_ASSERT(udp_packet_header, sizeof(udp_packet_header) == 497); +#ifndef MAKE_FS1 SDL_COMPILE_TIME_ASSERT(vmt_freespace2_struct, sizeof(vmt_freespace2_struct) == 440); +#else +SDL_COMPILE_TIME_ASSERT(vmt_freespace_struct, sizeof(vmt_freespace_struct) == 468); +#endif SDL_COMPILE_TIME_ASSERT(validate_id_request, sizeof(validate_id_request) == 60); SDL_COMPILE_TIME_ASSERT(squad_war_request, sizeof(squad_war_request) == 104); SDL_COMPILE_TIME_ASSERT(squad_war_response, sizeof(squad_war_response) == 256); @@ -82,7 +86,7 @@ static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data) break; case UNT_PILOT_DATA_WRITE_NEW: { - vmt_freespace2_struct *fs2 = (vmt_freespace2_struct *)&uph->data; + vmt_stats_struct *fs2 = (vmt_stats_struct *)&uph->data; PXO_ADD_DATA(fs2->tracker_id); PXO_ADD_DATA(fs2->pilot_name); @@ -91,6 +95,17 @@ static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data) PXO_ADD_INT(fs2->score); PXO_ADD_INT(fs2->rank); + +#ifdef MAKE_FS1 + for (i = 0; i < MAX_FS_MEDALS; i++) { + PXO_ADD_INT(fs2->medals[i]); + } + + for (i = 0; i < MAX_FS_SHIP_TYPES; i++) { + PXO_ADD_INT(fs2->kills[i]); + } +#endif + PXO_ADD_INT(fs2->assists); PXO_ADD_INT(fs2->kill_count); PXO_ADD_INT(fs2->kill_count_ok); @@ -115,6 +130,7 @@ static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data) PXO_ADD_UINT(fs2->flight_time); PXO_ADD_UINT(fs2->last_flown); +#ifndef MAKE_FS1 PXO_ADD_USHORT(fs2->num_medals); PXO_ADD_USHORT(fs2->num_ship_types); @@ -122,9 +138,10 @@ static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data) PXO_ADD_INT(fs2->medals[i]); } - for (i =0; i < MAX_FS2_SHIP_TYPES; i++) { + for (i = 0; i < MAX_FS2_SHIP_TYPES; i++) { PXO_ADD_USHORT(fs2->kills[i]); } +#endif break; } @@ -211,7 +228,7 @@ static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_p break; case UNT_PILOT_DATA_RESPONSE: { - vmt_freespace2_struct *fs2 = (vmt_freespace2_struct *)&uph->data; + vmt_stats_struct *fs2 = (vmt_stats_struct *)&uph->data; PXO_GET_DATA(fs2->tracker_id); PXO_GET_DATA(fs2->pilot_name); @@ -220,6 +237,17 @@ static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_p PXO_GET_INT(fs2->score); PXO_GET_INT(fs2->rank); + +#ifdef MAKE_FS1 + for (i = 0; i < MAX_FS_MEDALS; i++) { + PXO_GET_INT(fs2->medals[i]); + } + + for (i =0; i < MAX_FS_SHIP_TYPES; i++) { + PXO_GET_INT(fs2->kills[i]); + } +#endif + PXO_GET_INT(fs2->assists); PXO_GET_INT(fs2->kill_count); PXO_GET_INT(fs2->kill_count_ok); @@ -244,6 +272,7 @@ static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_p PXO_GET_UINT(fs2->flight_time); PXO_GET_UINT(fs2->last_flown); +#ifndef MAKE_FS1 PXO_GET_USHORT(fs2->num_medals); PXO_GET_USHORT(fs2->num_ship_types); @@ -254,6 +283,7 @@ static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_p for (i =0; i < MAX_FS2_SHIP_TYPES; i++) { PXO_GET_USHORT(fs2->kills[i]); } +#endif break; } @@ -354,11 +384,7 @@ int InitPilotTrackerClient() // Call with NULL to poll // Call with -1 to cancel send // Call with valid pointer to a vmt_descent3_struct to initiate send -#ifdef MAKE_FS1 -int SendFSPilotData(vmt_freespace_struct *fs_pilot) -#else -int SendFSPilotData(vmt_freespace2_struct *fs_pilot) -#endif +int SendFSPilotData(vmt_stats_struct *fs_pilot) { //First check the network PollPTrackNet(); @@ -395,7 +421,7 @@ int SendFSPilotData(vmt_freespace2_struct *fs_pilot) } } - else if(fs_pilot == (vmt_freespace2_struct*)0xffffffff) + else if(fs_pilot == (vmt_stats_struct*)0xffffffff) { if(FSWriteState == STATE_IDLE) { @@ -421,14 +447,12 @@ int SendFSPilotData(vmt_freespace2_struct *fs_pilot) fs_pilot_write.type = UNT_PILOT_DATA_WRITE_NEW; #ifdef MAKE_FS1 - fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_freespace_struct); fs_pilot_write.code = CMD_GAME_FREESPACE; - memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_freespace_struct)); #else - fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_freespace2_struct); fs_pilot_write.code = CMD_GAME_FREESPACE2; - memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_freespace2_struct)); #endif + fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_stats_struct); + memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_stats_struct)); return 0; } @@ -531,11 +555,7 @@ int SendSWData(squad_war_result *sw_res, squad_war_response *sw_resp) // Call with NULL to poll // Call with -1 to cancel wait // Call with valid pointer to a vmt_descent3_struct to get a response -#ifdef MAKE_FS1 -int GetFSPilotData(vmt_freespace_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security) -#else -int GetFSPilotData(vmt_freespace2_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security) -#endif +int GetFSPilotData(vmt_stats_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security) { //First check the network PollPTrackNet(); @@ -573,7 +593,7 @@ int GetFSPilotData(vmt_freespace2_struct *fs_pilot, const char *pilot_name, cons } } - else if(fs_pilot == (vmt_freespace2_struct*)0xffffffff) + else if(fs_pilot == (vmt_stats_struct*)0xffffffff) { if(FSReadState == STATE_IDLE) { diff --git a/src/weapon/weapons.cpp b/src/weapon/weapons.cpp index 7020e96..21883df 100644 --- a/src/weapon/weapons.cpp +++ b/src/weapon/weapons.cpp @@ -3652,13 +3652,17 @@ DCF(pspew_scale, "How far away particles are from the weapon path") // return a scale factor for damage which should be applied for 2 collisions float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) { - weapon *wp; +#ifdef MAKE_FS1 + // don't do special damage scaling for capships in FS1 + return 1.0f; + +#else + + weapon *wp; int from_player = 0; float total_scale = 1.0f; -#ifndef MAKE_FS1 float hull_pct; int is_big_damage_ship = 0; -#endif // sanity if((wip == NULL) || (wep == NULL) || (target == NULL)){ @@ -3682,7 +3686,6 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) total_scale *= 0.1f; } -#ifndef MAKE_FS1 // don't do special damage scaling for capships in FS1 // if the hit object was a ship if(target->type == OBJ_SHIP){ ship_info *sip; @@ -3736,9 +3739,9 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) } } } -#endif return total_scale; +#endif } int weapon_get_expl_handle(int weapon_expl_index, vector *pos, float size) -- 2.39.2