shithub: choc

Download patch

ref: f540202d2a114b3b44cc7f6379e8e59cfa73eff5
parent: b0d1d3ba2cf621625268f38722b1f6aa819b7c79
author: Simon Howard <[email protected]>
date: Fri Feb 24 14:14:59 EST 2006

Fix -extratics

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 389

--- 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,7 +395,6 @@
     // Fill in game settings structure with appropriate parameters
     // for the new game
 
-    settings.extratics = 0;
     settings.deathmatch = deathmatch;
     settings.episode = startepisode;
     settings.map = startmap;
@@ -399,6 +401,13 @@
     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 @@
 {
     net_ticdiff_t diff;
     net_server_send_t *sendobj;
+    int starttic, endtic;
     
     // Calculate the difference to the last ticcmd
 
@@ -482,7 +492,13 @@
 
     // 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 @@
 
     deathmatch = settings.deathmatch;
     ticdup = settings.ticdup;
-//    extratic = settings.extratics;
+    extratics = settings.extratics;
     startepisode = settings.episode;
     startmap = settings.map;
     startskill = settings.skill;
--- 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 @@
     net_full_ticcmd_t cmd;
     int recv_index;
     int i;
+    int starttic, endtic;
 
     recv_index = client->sendseq - recvwindow_start;
 
@@ -1238,9 +1242,14 @@
     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;
 }