]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
moved calls of CL_ReadDemoMessage and CL_SendMove from CL_ReadFromServer
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Apr 2007 11:50:04 +0000 (11:50 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Apr 2007 11:50:04 +0000 (11:50 +0000)
to the main loop
renamed CL_ReadFromServer to CL_UpdateWorld, and it is now called even
if not connected (to clear the r_refdef entities/lights info, and the
num_brushmodels)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7116 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
client.h
host.c

index e1b288aad8c611ead22c1f6163bc00da75adfcbe..179ad70c13b0f292f1281df80ae220464c3fab16 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1682,17 +1682,13 @@ void CSQC_RelinkAllEntities (int drawmask)
 
 /*
 ===============
-CL_ReadFromServer
+CL_UpdateWorld
 
-Read all incoming data from the server
+Update client game world for a new frame
 ===============
 */
-int CL_ReadFromServer(void)
+void CL_UpdateWorld(void)
 {
-       CL_ReadDemoMessage();
-       CL_SendMove();
-
-       r_refdef.time = cl.time;
        r_refdef.extraupdate = !r_speeds.integer;
        r_refdef.numentities = 0;
        r_refdef.numlights = 0;
@@ -1735,13 +1731,9 @@ int CL_ReadFromServer(void)
                // move particles
                CL_MoveParticles();
                R_MoveExplosions();
-
-               // update the r_refdef time again because cl.time may have changed in
-               // CL_LerpPoint()
-               r_refdef.time = cl.time;
        }
 
-       return 0;
+       r_refdef.time = cl.time;
 }
 
 // LordHavoc: pausedemo command
index 03b574fa8a5a0f447b551f207bcafa372be92c52..4252da919bfeb237c945a93d2887b8aad0f8f375 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1097,7 +1097,7 @@ void CL_ExpandEntities(int num);
 void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet);
 
 
-int  CL_ReadFromServer (void);
+void CL_UpdateWorld (void);
 void CL_WriteToServer (void);
 void CL_Input (void);
 extern qboolean cl_ignoremousemove;
diff --git a/host.c b/host.c
index 455f55d5b4e9b5093a8df0fe1d8635e28af9bd2b..d1a9032f65d50d1bea254db2f8107edf6cf0aecb 100644 (file)
--- a/host.c
+++ b/host.c
@@ -789,16 +789,17 @@ void Host_Main(void)
                        // Collect input into cmd
                        CL_Input();
 
+                       // check for new packets
                        NetConn_ClientFrame();
 
-                       if (cls.state == ca_connected)
-                       {
-                               CL_ReadFromServer();
-                               // if running the server remotely, send intentions now after
-                               // the incoming messages have been read
-                               //if (!cl.islocalgame)
-                               //      CL_SendCmd();
-                       }
+                       // read a new frame from a demo if needed
+                       CL_ReadDemoMessage();
+
+                       // now that packets have been read, send input to server
+                       CL_SendMove();
+
+                       // update client world (interpolate entities, create trails, etc)
+                       CL_UpdateWorld();
 
                        // update video
                        if (host_speeds.integer)