removed unused net_vcr (and all other traces of vcr system), apparently a predecessor...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 28 Apr 2001 06:07:51 +0000 (06:07 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 28 Apr 2001 06:07:51 +0000 (06:07 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@194 d7cf8633-e32d-0410-b094-e92efae38249

host.c
net_main.c
net_vcr.c [deleted file]
net_vcr.h [deleted file]
sys_linux.c

diff --git a/host.c b/host.c
index 7c165ad..92177df 100644 (file)
--- a/host.c
+++ b/host.c
@@ -755,69 +755,6 @@ void Host_Frame (float time)
 
 //============================================================================
 
-
-extern int vcrFile;
-#define        VCR_SIGNATURE   0x56435231
-// "VCR1"
-
-void Host_InitVCR ()
-{
-       int             i, len, n;
-       char    *p;
-       
-       if (COM_CheckParm("-playback"))
-       {
-               if (com_argc != 2)
-                       Sys_Error("No other parameters allowed with -playback\n");
-
-               Sys_FileOpenRead("quake.vcr", &vcrFile);
-               if (vcrFile == -1)
-                       Sys_Error("playback file not found\n");
-
-               Sys_FileRead (vcrFile, &i, sizeof(int));
-               if (i != VCR_SIGNATURE)
-                       Sys_Error("Invalid signature in vcr file\n");
-
-               Sys_FileRead (vcrFile, &com_argc, sizeof(int));
-               com_argv = qmalloc(com_argc * sizeof(char *));
-               com_argv[0] = host_parms.argv[0];
-               for (i = 0; i < com_argc; i++)
-               {
-                       Sys_FileRead (vcrFile, &len, sizeof(int));
-                       p = qmalloc(len);
-                       Sys_FileRead (vcrFile, p, len);
-                       com_argv[i+1] = p;
-               }
-               com_argc++; /* add one for arg[0] */
-               host_parms.argc = com_argc;
-               host_parms.argv = com_argv;
-       }
-
-       if ( (n = COM_CheckParm("-record")) != 0)
-       {
-               vcrFile = Sys_FileOpenWrite("quake.vcr");
-
-               i = VCR_SIGNATURE;
-               Sys_FileWrite(vcrFile, &i, sizeof(int));
-               i = com_argc - 1;
-               Sys_FileWrite(vcrFile, &i, sizeof(int));
-               for (i = 1; i < com_argc; i++)
-               {
-                       if (i == n)
-                       {
-                               len = 10;
-                               Sys_FileWrite(vcrFile, &len, sizeof(int));
-                               Sys_FileWrite(vcrFile, "-playback", len);
-                               continue;
-                       }
-                       len = strlen(com_argv[i]) + 1;
-                       Sys_FileWrite(vcrFile, &len, sizeof(int));
-                       Sys_FileWrite(vcrFile, com_argv[i], len);
-               }
-       }
-       
-}
-
 void Render_Init();
 
 /*
@@ -867,7 +804,6 @@ void Host_Init ()
        Cmd_Init ();    
        V_Init ();
        Chase_Init ();
-       Host_InitVCR ();
        COM_Init (host_parms.basedir);
        Host_InitLocal ();
        W_LoadWadFile ("gfx.wad");
index 0add1f2..3fa471c 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // net_main.c
 
 #include "quakedef.h"
-#include "net_vcr.h"
 
 qsocket_t      *net_activeSockets = NULL;
 qsocket_t      *net_freeSockets = NULL;
@@ -76,9 +75,6 @@ cvar_t        config_modem_clear = {"_config_modem_clear", "ATZ", true};
 cvar_t config_modem_init = {"_config_modem_init", "", true};
 cvar_t config_modem_hangup = {"_config_modem_hangup", "AT H", true};
 
-int    vcrFile = -1;
-qboolean recording = false;
-
 // these two macros are to make the code more readable
 #define sfunc  net_drivers[sock->driver]
 #define dfunc  net_drivers[net_driverlevel]
@@ -446,13 +442,6 @@ NET_CheckNewConnections
 ===================
 */
 
-struct
-{
-       double  time;
-       int             op;
-       long    session;
-} vcrConnect;
-
 qsocket_t *NET_CheckNewConnections (void)
 {
        qsocket_t       *ret;
@@ -467,25 +456,7 @@ qsocket_t *NET_CheckNewConnections (void)
                        continue;
                ret = dfunc.CheckNewConnections ();
                if (ret)
-               {
-                       if (recording)
-                       {
-                               vcrConnect.time = host_time;
-                               vcrConnect.op = VCR_OP_CONNECT;
-                               vcrConnect.session = (long)ret;
-                               Sys_FileWrite (vcrFile, &vcrConnect, sizeof(vcrConnect));
-                               Sys_FileWrite (vcrFile, ret->address, NET_NAMELEN);
-                       }
                        return ret;
-               }
-       }
-       
-       if (recording)
-       {
-               vcrConnect.time = host_time;
-               vcrConnect.op = VCR_OP_CONNECT;
-               vcrConnect.session = 0;
-               Sys_FileWrite (vcrFile, &vcrConnect, sizeof(vcrConnect));
        }
 
        return NULL;
@@ -525,15 +496,6 @@ returns -1 if connection is invalid
 =================
 */
 
-struct
-{
-       double  time;
-       int             op;
-       long    session;
-       int             ret;
-       int             len;
-} vcrGetMessage;
-
 extern void PrintStats(qsocket_t *s);
 
 int    NET_GetMessage (qsocket_t *sock)
@@ -574,28 +536,6 @@ int        NET_GetMessage (qsocket_t *sock)
                        else if (ret == 2)
                                unreliableMessagesReceived++;
                }
-
-               if (recording)
-               {
-                       vcrGetMessage.time = host_time;
-                       vcrGetMessage.op = VCR_OP_GETMESSAGE;
-                       vcrGetMessage.session = (long)sock;
-                       vcrGetMessage.ret = ret;
-                       vcrGetMessage.len = net_message.cursize;
-                       Sys_FileWrite (vcrFile, &vcrGetMessage, 24);
-                       Sys_FileWrite (vcrFile, net_message.data, net_message.cursize);
-               }
-       }
-       else
-       {
-               if (recording)
-               {
-                       vcrGetMessage.time = host_time;
-                       vcrGetMessage.op = VCR_OP_GETMESSAGE;
-                       vcrGetMessage.session = (long)sock;
-                       vcrGetMessage.ret = ret;
-                       Sys_FileWrite (vcrFile, &vcrGetMessage, 20);
-               }
        }
 
        return ret;
@@ -613,14 +553,6 @@ returns 1 if the message was sent properly
 returns -1 if the connection died
 ==================
 */
-struct
-{
-       double  time;
-       int             op;
-       long    session;
-       int             r;
-} vcrSendMessage;
-
 int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
 {
        int             r;
@@ -638,15 +570,6 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
        r = sfunc.QSendMessage(sock, data);
        if (r == 1 && sock->driver)
                messagesSent++;
-
-       if (recording)
-       {
-               vcrSendMessage.time = host_time;
-               vcrSendMessage.op = VCR_OP_SENDMESSAGE;
-               vcrSendMessage.session = (long)sock;
-               vcrSendMessage.r = r;
-               Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
-       }
        
        return r;
 }
@@ -670,15 +593,6 @@ int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
        if (r == 1 && sock->driver)
                unreliableMessagesSent++;
 
-       if (recording)
-       {
-               vcrSendMessage.time = host_time;
-               vcrSendMessage.op = VCR_OP_SENDMESSAGE;
-               vcrSendMessage.session = (long)sock;
-               vcrSendMessage.r = r;
-               Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
-       }
-       
        return r;
 }
 
@@ -705,15 +619,6 @@ qboolean NET_CanSendMessage (qsocket_t *sock)
 
        r = sfunc.CanSendMessage(sock);
        
-       if (recording)
-       {
-               vcrSendMessage.time = host_time;
-               vcrSendMessage.op = VCR_OP_CANSENDMESSAGE;
-               vcrSendMessage.session = (long)sock;
-               vcrSendMessage.r = r;
-               Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
-       }
-       
        return r;
 }
 
@@ -806,15 +711,6 @@ void NET_Init (void)
        int                     controlSocket;
        qsocket_t       *s;
 
-       if (COM_CheckParm("-playback"))
-       {
-               net_numdrivers = 1;
-               net_drivers[0].Init = VCR_Init;
-       }
-
-       if (COM_CheckParm("-record"))
-               recording = true;
-
        i = COM_CheckParm ("-port");
        if (!i)
                i = COM_CheckParm ("-udpport");
@@ -909,12 +805,6 @@ void               NET_Shutdown (void)
                        net_drivers[net_driverlevel].initialized = false;
                }
        }
-
-       if (vcrFile != -1)
-       {
-               Con_Printf ("Closing vcrfile.\n");
-               Sys_FileClose(vcrFile);
-       }
 }
 
 
diff --git a/net_vcr.c b/net_vcr.c
deleted file mode 100644 (file)
index ba8f40d..0000000
--- a/net_vcr.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-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.
-
-*/
-// net_vcr.c
-
-#include "quakedef.h"
-#include "net_vcr.h"
-
-extern int vcrFile;
-
-// This is the playback portion of the VCR.  It reads the file produced
-// by the recorder and plays it back to the host.  The recording contains
-// everything necessary (events, timestamps, and data) to duplicate the game
-// from the viewpoint of everything above the network layer.
-
-static struct
-{
-       double  time;
-       int             op;
-       long    session;
-}      next;
-
-int VCR_Init (void)
-{
-       net_drivers[0].Init = VCR_Init;
-
-       net_drivers[0].SearchForHosts = VCR_SearchForHosts;
-       net_drivers[0].Connect = VCR_Connect;
-       net_drivers[0].CheckNewConnections = VCR_CheckNewConnections;
-       net_drivers[0].QGetMessage = VCR_GetMessage;
-       net_drivers[0].QSendMessage = VCR_SendMessage;
-       net_drivers[0].CanSendMessage = VCR_CanSendMessage;
-       net_drivers[0].Close = VCR_Close;
-       net_drivers[0].Shutdown = VCR_Shutdown;
-
-       Sys_FileRead(vcrFile, &next, sizeof(next));
-       return 0;
-}
-
-void VCR_ReadNext (void)
-{
-       if (Sys_FileRead(vcrFile, &next, sizeof(next)) == 0)
-       {
-               next.op = 255;
-               Sys_Error ("=== END OF PLAYBACK===\n");
-       }
-       if (next.op < 1 || next.op > VCR_MAX_MESSAGE)
-               Sys_Error ("VCR_ReadNext: bad op");
-}
-
-
-void VCR_Listen (qboolean state)
-{
-}
-
-
-void VCR_Shutdown (void)
-{
-}
-
-
-int VCR_GetMessage (qsocket_t *sock)
-{
-       int     ret;
-       
-       if (host_time != next.time || next.op != VCR_OP_GETMESSAGE || next.session != *(long *)(&sock->driverdata))
-               Sys_Error ("VCR missmatch");
-
-       Sys_FileRead(vcrFile, &ret, sizeof(int));
-       if (ret != 1)
-       {
-               VCR_ReadNext ();
-               return ret;
-       }
-
-       Sys_FileRead(vcrFile, &net_message.cursize, sizeof(int));
-       Sys_FileRead(vcrFile, net_message.data, net_message.cursize);
-
-       VCR_ReadNext ();
-
-       return 1;
-}
-
-
-int VCR_SendMessage (qsocket_t *sock, sizebuf_t *data)
-{
-       int     ret;
-
-       if (host_time != next.time || next.op != VCR_OP_SENDMESSAGE || next.session != *(long *)(&sock->driverdata))
-               Sys_Error ("VCR missmatch");
-
-       Sys_FileRead(vcrFile, &ret, sizeof(int));
-
-       VCR_ReadNext ();
-
-       return ret;
-}
-
-
-qboolean VCR_CanSendMessage (qsocket_t *sock)
-{
-       qboolean        ret;
-
-       if (host_time != next.time || next.op != VCR_OP_CANSENDMESSAGE || next.session != *(long *)(&sock->driverdata))
-               Sys_Error ("VCR missmatch");
-
-       Sys_FileRead(vcrFile, &ret, sizeof(int));
-
-       VCR_ReadNext ();
-
-       return ret;
-}
-
-
-void VCR_Close (qsocket_t *sock)
-{
-}
-
-
-void VCR_SearchForHosts (qboolean xmit)
-{
-}
-
-
-qsocket_t *VCR_Connect (char *host)
-{
-       return NULL;
-}
-
-
-qsocket_t *VCR_CheckNewConnections (void)
-{
-       qsocket_t       *sock;
-
-       if (host_time != next.time || next.op != VCR_OP_CONNECT)
-               Sys_Error ("VCR missmatch");
-
-       if (!next.session)
-       {
-               VCR_ReadNext ();
-               return NULL;
-       }
-
-       sock = NET_NewQSocket ();
-       *(long *)(&sock->driverdata) = next.session;
-
-       Sys_FileRead (vcrFile, sock->address, NET_NAMELEN);
-       VCR_ReadNext ();
-
-       return sock;
-}
diff --git a/net_vcr.h b/net_vcr.h
deleted file mode 100644 (file)
index 95c2f34..0000000
--- a/net_vcr.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-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.
-
-*/
-// net_vcr.h
-
-#define VCR_OP_CONNECT                                 1
-#define VCR_OP_GETMESSAGE                              2
-#define VCR_OP_SENDMESSAGE                             3
-#define VCR_OP_CANSENDMESSAGE                  4
-#define VCR_MAX_MESSAGE                                        4
-
-int                    VCR_Init (void);
-void           VCR_Listen (qboolean state);
-void           VCR_SearchForHosts (qboolean xmit);
-qsocket_t      *VCR_Connect (char *host);
-qsocket_t      *VCR_CheckNewConnections (void);
-int                    VCR_GetMessage (qsocket_t *sock);
-int                    VCR_SendMessage (qsocket_t *sock, sizebuf_t *data);
-qboolean       VCR_CanSendMessage (qsocket_t *sock);
-void           VCR_Close (qsocket_t *sock);
-void           VCR_Shutdown (void);
index cc2ef24..ebf170f 100644 (file)
@@ -397,8 +397,6 @@ int main (int c, char **v)
 {
 
        double          time, oldtime, newtime;
-       extern int vcrFile;
-       extern int recording;
 
 //     static char cwd[1024];
 
@@ -439,8 +437,8 @@ int main (int c, char **v)
                time = newtime - oldtime;
 
                if (cls.state == ca_dedicated)
-               {   // play vcrfiles at max speed
-                       if (time < sys_ticrate.value && (vcrFile == -1 || recording) )
+               {
+                       if (time < sys_ticrate.value)
                        {
                                usleep(1);
                                continue;       // not time to run a server only tic yet