From: havoc Date: Tue, 17 Apr 2007 11:50:04 +0000 (+0000) Subject: moved calls of CL_ReadDemoMessage and CL_SendMove from CL_ReadFromServer X-Git-Tag: xonotic-v0.1.0preview~3314 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e949596a177cb35c6d5b3e9d6f25e187e546a82a;p=xonotic%2Fdarkplaces.git moved calls of CL_ReadDemoMessage and CL_SendMove from CL_ReadFromServer 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 --- diff --git a/cl_main.c b/cl_main.c index e1b288aa..179ad70c 100644 --- 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 diff --git a/client.h b/client.h index 03b574fa..4252da91 100644 --- 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 455f55d5..d1a9032f 100644 --- 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)