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
This commit is contained in:
parent
6b8f64cca2
commit
c1f7442f23
|
@ -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
|
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/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
|
20101120
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -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_rejoined = 0; // Did WE rejoin this game?
|
||||||
int Network_new_game = 0; // Is this the first level of a new game?
|
int Network_new_game = 0; // Is this the first level of a new game?
|
||||||
int Network_sending_extras=0;
|
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 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?
|
int Network_player_added = 0; // Is this a new player or a returning player?
|
||||||
|
|
||||||
|
|
|
@ -298,6 +298,7 @@ extern int Network_send_objnum;
|
||||||
extern int Network_rejoined;
|
extern int Network_rejoined;
|
||||||
extern int Network_new_game;
|
extern int Network_new_game;
|
||||||
extern int Network_sending_extras;
|
extern int Network_sending_extras;
|
||||||
|
extern int VerifyPlayerJoined;
|
||||||
extern int Player_joining_extras;
|
extern int Player_joining_extras;
|
||||||
extern int Network_player_added;
|
extern int Network_player_added;
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,6 @@ int num_active_ipx_changed = 0;
|
||||||
int IPX_allow_socket_changes = 1;
|
int IPX_allow_socket_changes = 1;
|
||||||
int NetSecurityFlag=NETSECURITY_OFF;
|
int NetSecurityFlag=NETSECURITY_OFF;
|
||||||
int NetSecurityNum=0;
|
int NetSecurityNum=0;
|
||||||
int VerifyPlayerJoined=-1;
|
|
||||||
IPX_sequence_packet IPX_sync_player; // Who is rejoining now?
|
IPX_sequence_packet IPX_sync_player; // Who is rejoining now?
|
||||||
int IPX_TotalMissedPackets=0,IPX_TotalPacketsGot=0;
|
int IPX_TotalMissedPackets=0,IPX_TotalPacketsGot=0;
|
||||||
IPX_frame_info MySyncPack,UrgentSyncPack;
|
IPX_frame_info MySyncPack,UrgentSyncPack;
|
||||||
|
|
|
@ -743,6 +743,7 @@ void net_udp_list_join_game()
|
||||||
change_playernum_to(1);
|
change_playernum_to(1);
|
||||||
N_players = 0;
|
N_players = 0;
|
||||||
Network_send_objects = 0;
|
Network_send_objects = 0;
|
||||||
|
Network_sending_extras=0;
|
||||||
Network_rejoined=0;
|
Network_rejoined=0;
|
||||||
|
|
||||||
Network_status = NETSTAT_BROWSING; // We are looking at a game menu
|
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;
|
Players[playernum].connected = CONNECT_DISCONNECTED;
|
||||||
Netgame.players[playernum].connected = CONNECT_DISCONNECTED;
|
Netgame.players[playernum].connected = CONNECT_DISCONNECTED;
|
||||||
|
|
||||||
|
if (VerifyPlayerJoined==playernum)
|
||||||
|
VerifyPlayerJoined=-1;
|
||||||
|
|
||||||
if (Network_status == NETSTAT_PLAYING)
|
if (Network_status == NETSTAT_PLAYING)
|
||||||
{
|
{
|
||||||
multi_make_player_ghost(playernum);
|
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!
|
// Send sync packet which tells the player who he is and to start!
|
||||||
net_udp_send_rejoin_sync(player_num);
|
net_udp_send_rejoin_sync(player_num);
|
||||||
|
VerifyPlayerJoined=player_num;
|
||||||
|
|
||||||
// Turn off send object mode
|
// Turn off send object mode
|
||||||
Network_send_objnum = -1;
|
Network_send_objnum = -1;
|
||||||
|
@ -1756,6 +1761,31 @@ void net_udp_send_rejoin_sync(int player_num)
|
||||||
return;
|
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; j<MAX_PLAYERS; j++)
|
||||||
|
{
|
||||||
|
for (i=0; i<MAX_PLAYERS;i++)
|
||||||
|
Netgame.kills[j][i] = kill_matrix[j][i];
|
||||||
|
Netgame.killed[j] = Players[j].net_killed_total;
|
||||||
|
Netgame.player_kills[j] = Players[j].net_kills_total;
|
||||||
|
Netgame.player_score[j] = Players[j].score;
|
||||||
|
}
|
||||||
|
|
||||||
|
Netgame.level_time = Players[Player_num].time_level;
|
||||||
|
Netgame.monitor_vector = net_udp_create_monitor_vector();
|
||||||
|
|
||||||
|
net_udp_send_game_info(UDP_sync_player.player.protocol.udp.addr, UPID_SYNC);
|
||||||
|
}
|
||||||
|
|
||||||
char * net_udp_get_player_name( int objnum )
|
char * net_udp_get_player_name( int objnum )
|
||||||
{
|
{
|
||||||
if ( objnum < 0 ) return NULL;
|
if ( objnum < 0 ) return NULL;
|
||||||
|
@ -4140,9 +4170,11 @@ void net_udp_do_frame(int force, int listen)
|
||||||
{
|
{
|
||||||
net_udp_timeout_check(time);
|
net_udp_timeout_check(time);
|
||||||
net_udp_listen();
|
net_udp_listen();
|
||||||
|
if (VerifyPlayerJoined!=-1 && !(FrameCount & 63))
|
||||||
|
net_udp_resend_sync_due_to_packet_loss(); // This will resend to UDP_sync_player
|
||||||
if (Network_send_objects)
|
if (Network_send_objects)
|
||||||
net_udp_send_objects();
|
net_udp_send_objects();
|
||||||
if (Network_sending_extras)
|
if (Network_sending_extras && VerifyPlayerJoined==-1)
|
||||||
net_udp_send_extras();
|
net_udp_send_extras();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4682,6 +4714,12 @@ void net_udp_read_pdata_short_packet(UDP_frame_info *pd)
|
||||||
TheirPlayernum = pd->Player_num;
|
TheirPlayernum = pd->Player_num;
|
||||||
TheirObjnum = Players[pd->Player_num].objnum;
|
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 (!multi_quit_game && (TheirPlayernum >= N_players))
|
||||||
{
|
{
|
||||||
if (Network_status!=NETSTAT_WAITING)
|
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 ()
|
void net_udp_send_extras ()
|
||||||
{
|
{
|
||||||
#if 0 // let's try somethign new
|
|
||||||
Assert (Player_joining_extras>-1);
|
Assert (Player_joining_extras>-1);
|
||||||
|
|
||||||
if (Network_sending_extras==40)
|
if (Network_sending_extras==40)
|
||||||
|
@ -5002,20 +5039,6 @@ void net_udp_send_extras ()
|
||||||
Network_sending_extras--;
|
Network_sending_extras--;
|
||||||
if (!Network_sending_extras)
|
if (!Network_sending_extras)
|
||||||
Player_joining_extras=-1;
|
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)
|
void net_udp_check_for_old_version (char pnum)
|
||||||
|
|
Loading…
Reference in a new issue