shithub: choc

Download patch

ref: cb142afe2e4bfa756249cd0e7e17ddd3ec820a87
parent: a1c823693b136d4534a4dec4307a27411a37dd4a
author: Simon Howard <[email protected]>
date: Thu Oct 13 15:46:45 EDT 2011

Update Strife main loop code to use d_loop.c common main loop code.
Working multiplayer!

Subversion-branch: /branches/v2-branch
Subversion-revision: 2416

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -171,9 +171,13 @@
 @PROGRAM_PREFIX@hexen_LDADD = hexen/libhexen.a $(EXTRA_LIBS)
 
 if HAVE_WINDRES
-@PROGRAM_PREFIX@strife_SOURCES=$(SOURCE_FILES_WITH_DEH) resource.rc
+@PROGRAM_PREFIX@strife_SOURCES=$(SOURCE_FILES_WITH_DEH) resource.rc \
+               d_loop.c d_loop.h \
+               $(FEATURE_MULTIPLAYER_SOURCE_FILES)
 else
-@PROGRAM_PREFIX@strife_SOURCES=$(SOURCE_FILES_WITH_DEH)
+@PROGRAM_PREFIX@strife_SOURCES=$(SOURCE_FILES_WITH_DEH) \
+               d_loop.c d_loop.h \
+               $(FEATURE_MULTIPLAYER_SOURCE_FILES)
 endif
 
 @PROGRAM_PREFIX@strife_LDADD = strife/libstrife.a $(EXTRA_LIBS)
--- a/src/strife/Makefile.am
+++ b/src/strife/Makefile.am
@@ -7,7 +7,7 @@
                    d_englsh.h   \
 d_items.c          d_items.h    \
 d_main.c           d_main.h     \
-d_net.c            d_net.h      \
+d_net.c                         \
                    doomdata.h   \
 doomdef.c          doomdef.h    \
 doomstat.c         doomstat.h   \
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -40,7 +40,6 @@
 
 #include "dstrings.h"
 #include "doomfeatures.h"
-#undef FEATURE_MULTIPLAYER // TODO: Temporary disable for Strife
 #include "sounds.h"
 
 #include "d_iwad.h"
@@ -114,7 +113,6 @@
 boolean         flipparm;       // [STRIFE] haleyjd 20110629: checkparm of -flip
 
 boolean         showintro = true;   // [STRIFE] checkparm of -nograph, disables intro
-boolean         singletics = false; // debug flag to cancel adaptiveness
 
 
 //extern int soundVolume;
@@ -163,7 +161,6 @@
 
 void D_CheckNetGame (void);
 void D_ProcessEvents (void);
-void G_BuildTiccmd (ticcmd_t* cmd);
 void D_DoAdvanceDemo (void);
 
 
@@ -521,22 +518,7 @@
         I_StartFrame ();
 
         // process one or more tics
-        if (singletics)
-        {
-            I_StartTic ();
-            D_ProcessEvents ();
-            G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
-            if (advancedemo)
-                D_DoAdvanceDemo ();
-            M_Ticker ();
-            G_Ticker ();
-            gametic++;
-            maketic++;
-        }
-        else
-        {
-            TryRunTics (); // will run at least one tic
-        }
+        TryRunTics (); // will run at least one tic
 
         S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
 
@@ -1383,9 +1365,7 @@
 
     if (M_CheckParm("-search"))
     {
-        printf("\nSearching for servers on Internet ...\n");
-        p = NET_MasterQuery(NET_QueryPrintCallback, NULL);
-        printf("\n%i server(s) found.\n", p);
+        NET_MasterQuery();
         exit(0);
     }
 
@@ -1413,9 +1393,7 @@
 
     if (M_CheckParm("-localsearch"))
     {
-        printf("\nSearching for servers on local LAN ...\n");
-        p = NET_LANQuery(NET_QueryPrintCallback, NULL);
-        printf("\n%i server(s) found.\n", p);
+        NET_LANQuery();
         exit(0);
     }
 
@@ -1975,4 +1953,3 @@
 
     D_DoomLoop ();  // never returns
 }
-
--- a/src/strife/d_net.c
+++ b/src/strife/d_net.c
@@ -25,10 +25,9 @@
 //
 //-----------------------------------------------------------------------------
 
+#include <stdlib.h>
 
-
 #include "doomfeatures.h"
-#undef FEATURE_MULTIPLAYER // TODO: Temporary disable for Strife
 
 #include "d_main.h"
 #include "m_argv.h"
@@ -42,347 +41,241 @@
 
 #include "deh_main.h"
 
-#include "net_client.h"
-#include "net_gui.h"
-#include "net_io.h"
-#include "net_query.h"
-#include "net_server.h"
-#include "net_sdl.h"
-#include "net_loop.h"
+#include "d_loop.h"
 
-//
-// NETWORKING
-//
-// gametic is the tic about to (or currently being) run
-// maketic is the tick that hasn't had control made for it yet
-// nettics[] has the maketics for all players 
-//
-// a gametic cannot be run until nettics[] > gametic for all players
-//
+ticcmd_t *netcmds;
 
-ticcmd_t        netcmds[MAXPLAYERS][BACKUPTICS];
-int             nettics[MAXPLAYERS];
+// Called when a player leaves the game
 
-int             maketic;
+static void PlayerQuitGame(player_t *player)
+{
+    static char exitmsg[80];
+    unsigned int player_num;
 
-// Used for original sync code.
+    player_num = player - players;
 
-int		lastnettic;
-int             skiptics = 0;
+    // Do this the same way as Vanilla Doom does, to allow dehacked
+    // replacements of this message
 
-// Reduce the bandwidth needed by sampling game input less and transmitting
-// less.  If ticdup is 2, sample half normal, 3 = one third normal, etc.
+    strncpy(exitmsg, DEH_String("Player 1 left the game"), sizeof(exitmsg));
+    exitmsg[sizeof(exitmsg) - 1] = '\0';
 
-int		ticdup;
+    exitmsg[7] += player_num;
 
-// Send this many extra (backup) tics in each packet.
+    playeringame[player_num] = false;
+    players[consoleplayer].message = exitmsg;
 
-int             extratics;
+    // TODO: check if it is sensible to do this:
 
-// Amount to offset the timer for game sync.
+    if (demorecording) 
+    {
+        G_CheckDemoStatus ();
+    }
+}
 
-fixed_t         offsetms;
-
-// Use new client syncronisation code
-
-boolean         net_cl_new_sync = true;
-
-// Connected but not participating in the game (observer)
-
-boolean drone = false;
-
-// 35 fps clock adjusted by offsetms milliseconds
-
-static int GetAdjustedTime(void)
+static void RunTic(ticcmd_t *cmds, boolean *ingame)
 {
-    int time_ms;
+    extern boolean advancedemo;
+    unsigned int i;
 
-    time_ms = I_GetTimeMS();
+    // Check for player quits.
 
-    if (net_cl_new_sync)
+    for (i = 0; i < MAXPLAYERS; ++i)
     {
-	// Use the adjustments from net_client.c only if we are
-	// using the new sync mode.
-
-        time_ms += (offsetms / FRACUNIT);
+        if (playeringame[i] && !ingame[i])
+        {
+            PlayerQuitGame(&players[i]);
+        }
     }
 
-    return (time_ms * TICRATE) / 1000;
-}
+    netcmds = cmds;
 
-//
-// NetUpdate
-// Builds ticcmds for console player,
-// sends out a packet
-//
-int      lasttime;
+    // check that there are players in the game.  if not, we cannot
+    // run a tic.
 
-void NetUpdate (void)
-{
-    int nowtime;
-    int newtics;
-    int	i;
-    int	gameticdiv;
+    if (advancedemo)
+        D_DoAdvanceDemo ();
 
-    // If we are running with singletics (timing a demo), this
-    // is all done separately.
+    M_Ticker();
+    G_Ticker();
+}
 
-    if (singletics)
-        return;
-    
-#ifdef FEATURE_MULTIPLAYER
+static void NullMenuTicker()
+{
+    // no-op.
+}
 
-    // Run network subsystems
+static loop_interface_t strife_loop_interface = {
+    D_ProcessEvents,
+    G_BuildTiccmd,
+    RunTic,
+    NullMenuTicker
+};
 
-    NET_CL_Run();
-    NET_SV_Run();
 
-#endif
+// Load game settings from the specified structure and 
+// set global variables.
 
-    // check time
-    nowtime = GetAdjustedTime() / ticdup;
-    newtics = nowtime - lasttime;
+static void LoadGameSettings(net_gamesettings_t *settings,
+                             net_connect_data_t *connect_data)
+{
+    unsigned int i;
 
-    lasttime = nowtime;
+    deathmatch = settings->deathmatch;
+    ticdup = settings->ticdup;
+    startepisode = settings->episode;
+    startmap = settings->map;
+    startskill = settings->skill;
+    startloadgame = settings->loadgame;
+    lowres_turn = settings->lowres_turn;
+    nomonsters = settings->nomonsters;
+    fastparm = settings->fast_monsters;
+    respawnparm = settings->respawn_monsters;
+    timelimit = settings->timelimit;
 
-    if (skiptics <= newtics)
+    if (lowres_turn)
     {
-        newtics -= skiptics;
-        skiptics = 0;
+        printf("NOTE: Turning resolution is reduced; this is probably "
+               "because there is a client recording a Vanilla demo.\n");
     }
+
+    if (!connect_data->drone)
+    {
+        consoleplayer = settings->consoleplayer;
+    }
     else
     {
-        skiptics -= newtics;
-        newtics = 0;
+        consoleplayer = 0;
     }
-
-    // build new ticcmds for console player
-    gameticdiv = gametic/ticdup;
-
-    for (i=0 ; i<newtics ; i++)
+    
+    for (i=0; i<MAXPLAYERS; ++i) 
     {
-        ticcmd_t cmd;
-
-	I_StartTic ();
-	D_ProcessEvents ();
-
-#if 0
-        // Always run the menu
-        // - jhaley 20110629 [CHOCOFIX] - sure, if you want to cause serious 
-        //   problems. See TryRunTics for where the call to M_Ticker belongs.
-
-        M_Ticker ();
-#endif
-        if (drone)
-        {
-            // In drone mode, do not generate any ticcmds.
-
-            continue;
-        }
-	
-        if (net_cl_new_sync)
-        { 
-           // If playing single player, do not allow tics to buffer
-           // up very far
-
-           if ((!netgame || demoplayback) && maketic - gameticdiv > 2)
-               break;
-
-           // Never go more than ~200ms ahead
-
-           if (maketic - gameticdiv > 8)
-               break;
-        }
-	else
-	{
-           if (maketic - gameticdiv >= 5)
-               break;
-	}
-
-	//printf ("mk:%i ",maketic);
-	G_BuildTiccmd(&cmd);
-
-#ifdef FEATURE_MULTIPLAYER
-        
-        if (netgame && !demoplayback)
-        {
-            NET_CL_SendTiccmd(&cmd, maketic);
-        }
-
-#endif
-        netcmds[consoleplayer][maketic % BACKUPTICS] = cmd;
-
-	++maketic;
-        nettics[consoleplayer] = maketic;
+        playeringame[i] = i < settings->num_players;
     }
 }
 
-//
-// Start game loop
-//
-// Called after the screen is set but before the game starts running.
-//  
+// Save the game settings from global variables to the specified
+// game settings structure.
 
-void D_StartGameLoop(void)
+static void SaveGameSettings(net_gamesettings_t *settings,
+                             net_connect_data_t *connect_data)
 {
-    lasttime = GetAdjustedTime() / ticdup;
-}
+    // Fill in game settings structure with appropriate parameters
+    // for the new game
 
+    settings->deathmatch = deathmatch;
+    settings->episode = startepisode;
+    settings->map = startmap;
+    settings->skill = startskill;
+    settings->loadgame = startloadgame;
+    settings->gameversion = gameversion;
+    settings->nomonsters = nomonsters;
+    settings->fast_monsters = fastparm;
+    settings->respawn_monsters = respawnparm;
+    settings->timelimit = timelimit;
 
-//
-// D_CheckNetGame
-// Works out player numbers among the net participants
-//
-extern	int			viewangleoffset;
+    settings->lowres_turn = M_CheckParm("-record") > 0
+                         && M_CheckParm("-longtics") == 0;
 
-void D_CheckNetGame (void)
-{
-    int i;
-    int num_players;
+    connect_data->drone = false;
 
-    // Call D_QuitNetGame on exit 
+    //!
+    // @category net
+    //
+    // Run as the left screen in three screen mode.
+    //
 
-    I_AtExit(D_QuitNetGame, true);
-
-    // default values for single player
-
-    consoleplayer = 0;
-    netgame = false;
-    ticdup = 1;
-    extratics = 1;
-    lowres_turn = false;
-    offsetms = 0;
-    
-    for (i=0; i<MAXPLAYERS; i++)
+    if (M_CheckParm("-left") > 0)
     {
-        playeringame[i] = false;
-        nettics[i] = 0;
+        viewangleoffset = ANG90;
+        connect_data->drone = true;
     }
 
-    playeringame[0] = true;
+    //! 
+    // @category net
+    //
+    // Run as the right screen in three screen mode.
+    //
 
-#ifdef FEATURE_MULTIPLAYER
-
+    if (M_CheckParm("-right") > 0)
     {
-        net_addr_t *addr = NULL;
+        viewangleoffset = ANG270;
+        connect_data->drone = true;
+    }
 
-        //!
-        // @category net
-        //
-        // Start a multiplayer server, listening for connections.
-        //
+    //
+    // Connect data
+    //
 
-        if (M_CheckParm("-server") > 0)
-        {
-            NET_SV_Init();
-            NET_SV_AddModule(&net_loop_server_module);
-            NET_SV_AddModule(&net_sdl_module);
+    // Game type fields:
 
-            net_loop_client_module.InitClient();
-            addr = net_loop_client_module.ResolveAddress(NULL);
-        }
-        else
-        {
-            //! 
-            // @category net
-            //
-            // Automatically search the local LAN for a multiplayer
-            // server and join it.
-            //
+    connect_data->gamemode = gamemode;
+    connect_data->gamemission = gamemission;
 
-            i = M_CheckParm("-autojoin");
+    // Are we recording a demo? Possibly set lowres turn mode
 
-            if (i > 0)
-            {
-                addr = NET_FindLANServer();
-                NET_SV_RegisterWithMaster();
-
-                if (addr == NULL)
-                {
-                    I_Error("No server found on local LAN");
-                }
-            }
+    connect_data->lowres_turn = settings->lowres_turn;
+}
 
-            //!
-            // @arg <address>
-            // @category net
-            //
-            // Connect to a multiplayer server running on the given 
-            // address.
-            //
-            
-            i = M_CheckParmWithArgs("-connect", 1);
-
-            if (i > 0)
-            {
-                net_sdl_module.InitClient();
-                addr = net_sdl_module.ResolveAddress(myargv[i+1]);
-
-                if (addr == NULL)
-                {
-                    I_Error("Unable to resolve '%s'\n", myargv[i+1]);
-                }
-            }
-        }
+void D_InitSinglePlayerGame(net_gamesettings_t *settings)
+{
+    // default values for single player
 
-        if (addr != NULL)
-        {
-            if (M_CheckParm("-drone") > 0)
-            {
-                drone = true;
-            }
+    settings->consoleplayer = 0;
+    settings->num_players = 1;
 
-            //!
-            // @category net
-            //
-            // Run as the left screen in three screen mode.
-            //
+    netgame = false;
 
-            if (M_CheckParm("-left") > 0)
-            {
-                viewangleoffset = ANG90;
-                drone = true;
-            }
+    //!
+    // @category net
+    //
+    // Start the game playing as though in a netgame with a single
+    // player.  This can also be used to play back single player netgame
+    // demos.
+    //
 
-            //! 
-            // @category net
-            //
-            // Run as the right screen in three screen mode.
-            //
+    if (M_CheckParm("-solo-net") > 0)
+    {
+        netgame = true;
+    }
+}
 
-            if (M_CheckParm("-right") > 0)
-            {
-                viewangleoffset = ANG270;
-                drone = true;
-            }
+//
+// D_CheckNetGame
+// Works out player numbers among the net participants
+//
+extern	int			viewangleoffset;
 
-            if (!NET_CL_Connect(addr))
-            {
-                I_Error("D_CheckNetGame: Failed to connect to %s\n", 
-                        NET_AddrToString(addr));
-            }
+void D_CheckNetGame (void)
+{
+    net_connect_data_t connect_data;
+    net_gamesettings_t settings;
 
-            printf("D_CheckNetGame: Connected to %s\n", NET_AddrToString(addr));
+    D_RegisterLoopCallbacks(&strife_loop_interface);
 
-            NET_WaitForStart();
-        }
-    }
+    // Call D_QuitNetGame on exit 
 
-#endif
+    I_AtExit(D_QuitNetGame, true);
 
-    num_players = 0;
+    SaveGameSettings(&settings, &connect_data);
 
-    for (i=0; i<MAXPLAYERS; ++i)
+    if (D_InitNetGame(&connect_data, &settings))
     {
-        if (playeringame[i])
-            ++num_players;
+        netgame = true;
+        autostart = true;
     }
+    else
+    {
+        D_InitSinglePlayerGame(&settings);
+    }
 
+    LoadGameSettings(&settings, &connect_data);
+
     DEH_printf("startskill %i  deathmatch: %i  startmap: %i  startepisode: %i\n",
                startskill, deathmatch, startmap, startepisode);
-	
+
     DEH_printf("player %i of %i (%i nodes)\n",
-               consoleplayer+1, num_players, num_players);
+               consoleplayer+1, settings.num_players, settings.num_players);
 
     // Show players here; the server might have specified a time limit
 
@@ -404,241 +297,3 @@
         }
     }
 }
-
-
-//
-// D_QuitNetGame
-// Called before quitting to leave a net game
-// without hanging the other players
-//
-void D_QuitNetGame (void)
-{
-#ifdef FEATURE_MULTIPLAYER
-
-    NET_SV_Shutdown();
-    NET_CL_Disconnect();
-
-#endif
-
-}
-
-// Returns true if there are currently any players in the game.
-
-static boolean PlayersInGame(void)
-{
-    int i;
-
-    for (i=0; i<MAXPLAYERS; ++i)
-    {
-        if (playeringame[i])
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-static int GetLowTic(void)
-{
-    int lowtic;
-
-#ifdef FEATURE_MULTIPLAYER
-    if (net_client_connected)
-    {
-        int i;
-
-        lowtic = INT_MAX;
-    
-        for (i=0; i<MAXPLAYERS; ++i)
-        {
-            if (playeringame[i])
-            {
-                if (nettics[i] < lowtic)
-                    lowtic = nettics[i];
-            }
-        }
-    }
-    else
-#endif
-    {
-        lowtic = maketic;
-    }
-
-    return lowtic;
-}
-
-//
-// TryRunTics
-//
-int	oldnettics;
-int	frametics[4];
-int	frameon;
-int	frameskip[4];
-int	oldnettics;
-
-extern	boolean	advancedemo;
-
-void TryRunTics (void)
-{
-    int	i;
-    int	lowtic;
-    int	entertic;
-    static int oldentertics;
-    int realtics;
-    int	availabletics;
-    int	counts;
-
-    // get real tics		
-    entertic = I_GetTime() / ticdup;
-    realtics = entertic - oldentertics;
-    oldentertics = entertic;
-    
-    // get available tics
-    NetUpdate ();
-	
-    lowtic = GetLowTic();
-
-    availabletics = lowtic - gametic/ticdup;
-    
-    // decide how many tics to run
-    
-    if (net_cl_new_sync)
-    {
-	counts = availabletics;
-    }
-    else
-    {
-        // decide how many tics to run
-        if (realtics < availabletics-1)
-            counts = realtics+1;
-        else if (realtics < availabletics)
-            counts = realtics;
-        else
-            counts = availabletics;
-        
-        if (counts < 1)
-            counts = 1;
-                    
-        frameon++;
-
-        if (!demoplayback)
-        {
-	    int keyplayer = -1;
-
-            // ideally maketic should be 1 - 3 tics above lowtic
-            // if we are consistantly slower, speed up time
-
-            for (i=0 ; i<MAXPLAYERS ; i++)
-	    {
-                if (playeringame[i])
-		{
-		    keyplayer = i;
-                    break;
-		}
-	    }
-
-	    if (keyplayer < 0)
-	    {
-		// If there are no players, we can never advance anyway
-
-		return;
-	    }
-
-            if (consoleplayer == keyplayer)
-            {
-                // the key player does not adapt
-            }
-            else
-            {
-                if (maketic <= nettics[keyplayer])
-                {
-                    lasttime--;
-                    // printf ("-");
-                }
-
-                frameskip[frameon & 3] = (oldnettics > nettics[keyplayer]);
-                oldnettics = maketic;
-
-                if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
-                {
-                    skiptics = 1;
-                    // printf ("+");
-                }
-            }
-        }
-    }
-
-    if (counts < 1)
-	counts = 1;
-		
-    // wait for new tics if needed
-
-    while (!PlayersInGame() || lowtic < gametic/ticdup + counts)	
-    {
-	NetUpdate ();   
-
-        lowtic = GetLowTic();
-	
-	if (lowtic < gametic/ticdup)
-	    I_Error ("TryRunTics: lowtic < gametic");
-    
-        // Don't stay in this loop forever.  The menu is still running,
-        // so return to update the screen
-
-	if (I_GetTime() / ticdup - entertic > 0)
-	{
-	    return;
-	} 
-
-        I_Sleep(1);
-    }
-    
-    // run the count * ticdup dics
-    while (counts--)
-    {
-	for (i=0 ; i<ticdup ; i++)
-	{
-            // check that there are players in the game.  if not, we cannot
-            // run a tic.
-        
-            if (!PlayersInGame())
-            {
-                return;
-            }
-    
-	    if (gametic/ticdup > lowtic)
-		I_Error ("gametic>lowtic");
-	    if (advancedemo)
-		D_DoAdvanceDemo ();
-
-            // [STRIFE]/[CHOCOFIX] jhaley 20110629 Chocolate compatibility problem!
-            // *Somebody* moved M_Ticker to NetUpdate where it specifically does not
-            // belong. It *must* be here. All it ever does is animate the cursor
-            // anyway so there is absolutely no reason to run it from NetUpdate.
-            M_Ticker (); 
-	    G_Ticker ();
-	    gametic++;
-	    
-
-	    // modify command for duplicated tics
-	    if (i != ticdup-1)
-	    {
-		ticcmd_t	*cmd;
-		int			buf;
-		int			j;
-				
-		buf = (gametic/ticdup)%BACKUPTICS; 
-		for (j=0 ; j<MAXPLAYERS ; j++)
-		{
-		    cmd = &netcmds[j][buf];
-		    cmd->chatchar = 0;
-		    if (cmd->buttons & BT_SPECIAL)
-			cmd->buttons = 0;
-		}
-	    }
-	}
-	NetUpdate ();	// check for new console commands
-    }
-}
-
--- a/src/strife/d_net.h
+++ /dev/null
@@ -1,52 +1,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// Copyright(C) 1993-1996 Id Software, Inc.
-// Copyright(C) 2005 Simon Howard
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-//
-// DESCRIPTION:
-//	Networking stuff.
-//
-//-----------------------------------------------------------------------------
-
-
-#ifndef __D_NET__
-#define __D_NET__
-
-#include "d_player.h"
-
-extern int extratics;
-
-// Create any new ticcmds and broadcast to other players.
-void NetUpdate (void);
-
-// Broadcasts special packets to other players
-//  to notify of game exit
-void D_QuitNetGame (void);
-
-//? how many ticks to run?
-void TryRunTics (void);
-
-// Called at start of game loop to initialize timers
-void D_StartGameLoop(void);
-
-extern boolean drone;
-extern boolean net_cl_new_sync;
-
-#endif
-
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -36,7 +36,7 @@
 // We need globally shared data structures,
 //  for defining the global state variables.
 #include "doomdata.h"
-#include "d_net.h"
+#include "d_loop.h"
 
 // We need the playr data structure as well.
 #include "d_player.h"
@@ -296,10 +296,7 @@
 
 extern	int		rndindex;
 
-extern	int		maketic;
-extern  int             nettics[MAXPLAYERS];
-
-extern  ticcmd_t        netcmds[MAXPLAYERS][BACKUPTICS];
+extern  ticcmd_t        *netcmds;
 extern	int		ticdup;
 
 
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -334,7 +334,7 @@
 // or reads it from the demo buffer. 
 // If recording a demo, write it out 
 // 
-void G_BuildTiccmd (ticcmd_t* cmd) 
+void G_BuildTiccmd (ticcmd_t* cmd, int maketic) 
 { 
     int		i; 
     boolean	strafe;
@@ -963,7 +963,7 @@
         { 
             cmd = &players[i].cmd; 
 
-            memcpy (cmd, &netcmds[i][buf], sizeof(ticcmd_t)); 
+            memcpy (cmd, &netcmds[i], sizeof(ticcmd_t)); 
 
             if (demoplayback)
                 G_ReadDemoTiccmd (cmd); 
@@ -2472,6 +2472,3 @@
 
     return false; 
 } 
- 
-  
- 
--- a/src/strife/g_game.h
+++ b/src/strife/g_game.h
@@ -79,7 +79,7 @@
 
 // Read current data from inputs and build a player movement command.
 
-void G_BuildTiccmd (ticcmd_t *cmd); 
+void G_BuildTiccmd (ticcmd_t *cmd, int maketic);
 
 void G_Ticker (void);
 boolean G_Responder (event_t*	ev);
@@ -95,4 +95,3 @@
 extern int vanilla_savegame_limit;
 extern int vanilla_demo_limit;
 #endif
-
--- a/src/strife/r_main.c
+++ b/src/strife/r_main.c
@@ -37,7 +37,6 @@
 #include "doomdef.h"
 #include "doomstat.h"   // villsa [STRIFE]
 #include "d_main.h"
-#include "d_net.h"
 
 #include "m_bbox.h"
 #include "m_menu.h"
@@ -951,4 +950,3 @@
     // Check for new console commands.
     NetUpdate ();				
 }
-