From f540202d2a114b3b44cc7f6379e8e59cfa73eff5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 24 Feb 2006 19:14:59 +0000 Subject: Fix -extratics Subversion-branch: /trunk/chocolate-doom Subversion-revision: 389 --- src/net_client.c | 24 ++++++++++++++++++++---- src/net_server.c | 15 ++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/net_client.c b/src/net_client.c index 627561c4..4a52c62b 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_client.c 383 2006-02-23 20:53:03Z fraggle $ +// $Id: net_client.c 389 2006-02-24 19:14:59Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.32 2006/02/24 19:14:59 fraggle +// Fix -extratics +// // Revision 1.31 2006/02/23 20:53:03 fraggle // Detect when clients are disconnected from the server, recover cleanly // and display a message. @@ -392,13 +395,19 @@ void NET_CL_StartGame(void) // Fill in game settings structure with appropriate parameters // for the new game - settings.extratics = 0; settings.deathmatch = deathmatch; settings.episode = startepisode; settings.map = startmap; settings.skill = startskill; settings.gameversion = gameversion; + i = M_CheckParm("-extratics"); + + if (i > 0) + settings.extratics = atoi(myargv[i+1]); + else + settings.extratics = 1; + i = M_CheckParm("-dup"); if (i > 0) @@ -465,6 +474,7 @@ void NET_CL_SendTiccmd(ticcmd_t *ticcmd, int maketic) { net_ticdiff_t diff; net_server_send_t *sendobj; + int starttic, endtic; // Calculate the difference to the last ticcmd @@ -482,7 +492,13 @@ void NET_CL_SendTiccmd(ticcmd_t *ticcmd, int maketic) // Send to server. - NET_CL_SendTics(maketic, maketic); + starttic = maketic - extratics; + endtic = maketic; + + if (starttic < 0) + starttic = 0; + + NET_CL_SendTics(starttic, endtic); } // data received while we are waiting for the game to start @@ -576,7 +592,7 @@ static void NET_CL_ParseGameStart(net_packet_t *packet) deathmatch = settings.deathmatch; ticdup = settings.ticdup; -// extratic = settings.extratics; + extratics = settings.extratics; startepisode = settings.episode; startmap = settings.map; startskill = settings.skill; diff --git a/src/net_server.c b/src/net_server.c index a83edd72..ba64422d 100644 --- a/src/net_server.c +++ b/src/net_server.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_server.c 387 2006-02-24 08:19:45Z fraggle $ +// $Id: net_server.c 389 2006-02-24 19:14:59Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.35 2006/02/24 19:14:59 fraggle +// Fix -extratics +// // Revision 1.34 2006/02/24 08:19:45 fraggle // Only advance the receive window if we have received ticcmds from all // connected players. @@ -1171,6 +1174,7 @@ static void NET_SV_PumpSendQueue(net_client_t *client) net_full_ticcmd_t cmd; int recv_index; int i; + int starttic, endtic; recv_index = client->sendseq - recvwindow_start; @@ -1238,9 +1242,14 @@ static void NET_SV_PumpSendQueue(net_client_t *client) client->sendqueue[client->sendseq % BACKUPTICS] = cmd; // Transmit the new tic to the client - // TODO: extratics - NET_SV_SendTics(client, client->sendseq, client->sendseq); + starttic = client->sendseq - sv_settings.extratics; + endtic = client->sendseq; + + if (starttic < 0) + starttic = 0; + + NET_SV_SendTics(client, starttic, endtic); ++client->sendseq; } -- cgit v1.2.3