eliminated most calls to Sys_DoubleTime (using realtime instead, or in one case a...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 Apr 2007 07:14:09 +0000 (07:14 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 Apr 2007 07:14:09 +0000 (07:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7050 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
host_cmd.c
lhnet.c
netconn.c
sbar.c

index 581852a..b268e84 100644 (file)
@@ -854,7 +854,7 @@ void SCR_CaptureVideo_BeginVideo(void)
        memset(&cls.capturevideo, 0, sizeof(cls.capturevideo));
        // soundrate is figured out on the first SoundFrame
        cls.capturevideo.active = true;
-       cls.capturevideo.starttime = Sys_DoubleTime();
+       cls.capturevideo.starttime = realtime;
        cls.capturevideo.framerate = bound(1, cl_capturevideo_fps.value, 1000);
        cls.capturevideo.soundrate = S_GetSoundRate();
        cls.capturevideo.frame = 0;
@@ -1210,7 +1210,7 @@ void SCR_CaptureVideo(void)
                if (cls.capturevideo.realtime)
                {
                        // preserve sound sync by duplicating frames when running slow
-                       newframenum = (int)((Sys_DoubleTime() - cls.capturevideo.starttime) * cls.capturevideo.framerate);
+                       newframenum = (int)((realtime - cls.capturevideo.starttime) * cls.capturevideo.framerate);
                }
                else
                        newframenum = cls.capturevideo.frame + 1;
index 5c4dfa5..f2078fa 100644 (file)
@@ -1400,7 +1400,7 @@ void Host_Spawn_f (void)
                prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
                PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing");
 
-               if ((Sys_DoubleTime() - host_client->connecttime) <= sv.time)
+               if (svs.maxclients > 1 || cls.state == ca_dedicated)
                        Con_Printf("%s entered the game\n", host_client->name);
 
                PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
diff --git a/lhnet.c b/lhnet.c
index b3f392d..65b9f82 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -157,7 +157,7 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def
 #ifdef STANDALONETEST
        if (i < MAX_NAMECACHE)
 #else
-       if (i < MAX_NAMECACHE && Sys_DoubleTime() < namecache[i].expirationtime)
+       if (i < MAX_NAMECACHE && realtime < namecache[i].expirationtime)
 #endif
        {
                *address = namecache[i].address;
@@ -188,7 +188,7 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def
                                namecache[namecacheposition].name[i] = name[i];
                        namecache[namecacheposition].name[i] = 0;
 #ifndef STANDALONETEST
-                       namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 12 * 3600; // 12 hours
+                       namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
 #endif
                        namecache[namecacheposition].address = *address;
                        namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
@@ -208,7 +208,7 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def
                                namecache[namecacheposition].name[i] = name[i];
                        namecache[namecacheposition].name[i] = 0;
 #ifndef STANDALONETEST
-                       namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 12 * 3600; // 12 hours
+                       namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
 #endif
                        namecache[namecacheposition].address = *address;
                        namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
@@ -225,7 +225,7 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def
                namecache[namecacheposition].name[i] = name[i];
        namecache[namecacheposition].name[i] = 0;
 #ifndef STANDALONETEST
-       namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 12 * 3600; // 12 hours
+       namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
 #endif
        namecache[namecacheposition].address.addresstype = LHNETADDRESSTYPE_NONE;
        namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
@@ -666,7 +666,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                                continue;
                        }
 #ifndef STANDALONETEST
-                       if (cl_netlocalping.value && (Sys_DoubleTime() - cl_netlocalping.value * (1.0 / 2000.0)) < p->sentdoubletime)
+                       if (cl_netlocalping.value && (realtime - cl_netlocalping.value * (1.0 / 2000.0)) < p->sentdoubletime)
                                continue;
 #endif
                        if (value == 0 && p->destinationport == lhnetsocket->address.addressdata.loop.port)
@@ -762,7 +762,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
                p->next->prev = p;
                p->prev->next = p;
 #ifndef STANDALONETEST
-               p->sentdoubletime = Sys_DoubleTime();
+               p->sentdoubletime = realtime;
 #endif
                value = contentlength;
        }
index 8dec086..c0c4c1e 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -404,8 +404,7 @@ static void _ServerList_Test(void)
 
 void ServerList_QueryList(qboolean querydp, qboolean queryqw)
 {
-       //masterquerytime = realtime;
-       masterquerytime = Sys_DoubleTime();
+       masterquerytime = realtime;
        masterquerycount = 0;
        masterreplycount = 0;
        serverquerycount = 0;
@@ -1138,8 +1137,7 @@ static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *address
                // store the data the engine cares about (address and ping)
                strlcpy(serverlist_cache[serverlist_cachecount].info.cname, addressstring, sizeof(serverlist_cache[serverlist_cachecount].info.cname));
                serverlist_cache[serverlist_cachecount].info.ping = 100000;
-               //serverlist_cache[serverlist_cachecount].querytime = realtime;
-               serverlist_cache[serverlist_cachecount].querytime = Sys_DoubleTime();
+               serverlist_cache[serverlist_cachecount].querytime = realtime;
                // if not in the slist menu we should print the server to console
                if (serverlist_consoleoutput)
                        Con_Printf("querying %s\n", addressstring);
@@ -1148,7 +1146,7 @@ static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *address
        // if this is the first reply from this server, count it as having replied
        if (serverlist_cache[n].info.ping == 100000)
                serverreplycount++;
-       pingtime = (int)((Sys_DoubleTime() - serverlist_cache[n].querytime) * 1000.0 + 0.5);
+       pingtime = (int)((realtime - serverlist_cache[n].querytime) * 1000.0 + 0.5);
        pingtime = bound(0, pingtime, 9999);
        // update the ping
        serverlist_cache[n].info.ping = min(serverlist_cache[n].info.ping, pingtime);
@@ -1590,8 +1588,7 @@ void NetConn_QueryQueueFrame(void)
                                        NetConn_WriteString(cl_sockets[socket], "\377\377\377\377getinfo", &address);
                        }
 
-                       //entry->querytime = realtime;
-                       entry->querytime = Sys_DoubleTime();
+                       entry->querytime = realtime;
                        entry->querycounter++;
 
                        // if not in the slist menu we should print the server to console
diff --git a/sbar.c b/sbar.c
index 95fb089..c8ebbd7 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1002,7 +1002,7 @@ void Sbar_ShowFPS(void)
                static double framerate = 0;
                static int framecount = 0;
                double newtime;
-               newtime = Sys_DoubleTime();
+               newtime = realtime;
                if (newtime >= nexttime)
                {
                        framerate = framecount / (newtime - lasttime);