diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 37656925b..4da460fd8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D2X-Rebirth Changelog -------- arch/sdl/jukebox.c: Make sure read_m3u won't read past the end of the buffer, causing a crash main/inferno.c: If it can't find descent2.hog/d2demo.hog, still print some useful info +main/multi.c, main/multi.h, main/net_ipx.c, main/net_udp.c: Took over variable VerifyPlayerJoined for UDP protocol usage as well to get object and extra packet sending in order as well as regulary resending UPID_SYNC for latecoming players. Should resolve problems when joining already running UDP games 20101120 -------- diff --git a/main/multi.c b/main/multi.c index 698969dd4..9230e1f93 100644 --- a/main/multi.c +++ b/main/multi.c @@ -158,6 +158,7 @@ int Network_send_objnum = -1; // What object are we sending next? int Network_rejoined = 0; // Did WE rejoin this game? int Network_new_game = 0; // Is this the first level of a new game? int Network_sending_extras=0; +int VerifyPlayerJoined=-1; // Player (num) to enter game before any ingame/extra stuff is being sent int Player_joining_extras=-1; // This is so we know who to send 'latecomer' packets to. int Network_player_added = 0; // Is this a new player or a returning player? diff --git a/main/multi.h b/main/multi.h index e938b038f..ea96612d6 100644 --- a/main/multi.h +++ b/main/multi.h @@ -298,6 +298,7 @@ extern int Network_send_objnum; extern int Network_rejoined; extern int Network_new_game; extern int Network_sending_extras; +extern int VerifyPlayerJoined; extern int Player_joining_extras; extern int Network_player_added; diff --git a/main/net_ipx.c b/main/net_ipx.c index b010075df..a4aae7bb0 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -116,7 +116,6 @@ int num_active_ipx_changed = 0; int IPX_allow_socket_changes = 1; int NetSecurityFlag=NETSECURITY_OFF; int NetSecurityNum=0; -int VerifyPlayerJoined=-1; IPX_sequence_packet IPX_sync_player; // Who is rejoining now? int IPX_TotalMissedPackets=0,IPX_TotalPacketsGot=0; IPX_frame_info MySyncPack,UrgentSyncPack; diff --git a/main/net_udp.c b/main/net_udp.c index bf7cc0429..0c21e3465 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -743,6 +743,7 @@ void net_udp_list_join_game() change_playernum_to(1); N_players = 0; Network_send_objects = 0; + Network_sending_extras=0; Network_rejoined=0; Network_status = NETSTAT_BROWSING; // We are looking at a game menu @@ -1029,6 +1030,9 @@ net_udp_disconnect_player(int playernum) Players[playernum].connected = CONNECT_DISCONNECTED; Netgame.players[playernum].connected = CONNECT_DISCONNECTED; + if (VerifyPlayerJoined==playernum) + VerifyPlayerJoined=-1; + if (Network_status == NETSTAT_PLAYING) { multi_make_player_ghost(playernum); @@ -1684,6 +1688,7 @@ void net_udp_send_objects(void) // Send sync packet which tells the player who he is and to start! net_udp_send_rejoin_sync(player_num); + VerifyPlayerJoined=player_num; // Turn off send object mode Network_send_objnum = -1; @@ -1756,6 +1761,31 @@ void net_udp_send_rejoin_sync(int player_num) return; } +void net_udp_resend_sync_due_to_packet_loss() +{ + int i,j; + + if (!multi_i_am_master()) + return; + + net_udp_update_netgame(); + + // Fill in the kill list + for (j=0; jPlayer_num; TheirObjnum = Players[pd->Player_num].objnum; + if (VerifyPlayerJoined!=-1 && TheirPlayernum==VerifyPlayerJoined) + { + // Hurray! Someone really really got in the game (I think). + VerifyPlayerJoined=-1; + } + if (!multi_quit_game && (TheirPlayernum >= N_players)) { if (Network_status!=NETSTAT_WAITING) @@ -4979,7 +5017,6 @@ int net_udp_get_new_player_num (UDP_sequence_packet *their) void net_udp_send_extras () { -#if 0 // let's try somethign new Assert (Player_joining_extras>-1); if (Network_sending_extras==40) @@ -5002,20 +5039,6 @@ void net_udp_send_extras () Network_sending_extras--; if (!Network_sending_extras) Player_joining_extras=-1; -#endif - net_udp_send_fly_thru_triggers(Player_joining_extras); - net_udp_send_door_updates(Player_joining_extras); - net_udp_send_markers(); - if (Game_mode & GM_MULTI_ROBOTS) - multi_send_stolen_items(); - if (Netgame.PlayTimeAllowed || Netgame.KillGoal) - multi_send_kill_goal_counts(); - net_udp_send_smash_lights(Player_joining_extras); - net_udp_send_player_flags(); - multi_send_powerup_update(); - - Network_sending_extras = 0; - Player_joining_extras = -1; } void net_udp_check_for_old_version (char pnum)