]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
this patch may break things and needs testing
[xonotic/darkplaces.git] / cl_main.c
index f7c5ecabde03681bfdf55dba92cb2c1800fae25d..f36205328df60526603af849368fb62d130e17c5 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -500,14 +500,11 @@ static float CL_LerpPoint(void)
 {
        float f;
 
-       // dropped packet, or start of demo
-       if (cl.mtime[1] < cl.mtime[0] - 0.1)
-               cl.mtime[1] = cl.mtime[0] - 0.1;
-
-       cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
+       if (cl_nettimesyncmode.integer == 3)
+               cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
 
        // LordHavoc: lerp in listen games as the server is being capped below the client (usually)
-       if (cl.mtime[0] <= cl.mtime[1] || cl_nolerp.integer || cls.timedemo || (cl.islocalgame && !sv_fixedframeratesingleplayer.integer))
+       if (cl.mtime[0] <= cl.mtime[1])
        {
                cl.time = cl.mtime[0];
                return 1;
@@ -769,7 +766,6 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit)
 {
        const matrix4x4_t *matrix;
        matrix4x4_t blendmatrix, tempmatrix, matrix2;
-       //matrix4x4_t dlightmatrix;
        int j, k, l;
        float origin[3], angles[3], delta[3], lerp, d;
        entity_t *t;
@@ -877,7 +873,7 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit)
        // if it's the player entity, update according to client movement
        if (e == cl.entities + cl.playerentity && cl.movement_predicted)
        {
-               lerp = (cl.timenonlerp - cl.movement_time[2]) / (cl.movement_time[0] - cl.movement_time[1]);
+               lerp = (cl.time - cl.movement_time[2]) / (cl.movement_time[0] - cl.movement_time[1]);
                lerp = bound(0, lerp, 1);
                if (cl_nolerp.integer)
                        lerp = 1;
@@ -995,7 +991,6 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit)
 // creates light and trails from an entity
 void CL_UpdateNetworkEntityTrail(entity_t *e)
 {
-       //matrix4x4_t dlightmatrix;
        effectnameindex_t trailtype;
        vec3_t origin;
 
@@ -1007,6 +1002,8 @@ void CL_UpdateNetworkEntityTrail(entity_t *e)
                VectorMAM(0.5f, e->render.model->normalmins, 0.5f, e->render.model->normalmaxs, o);
                Matrix4x4_Transform(&e->render.matrix, o, origin);
        }
+       else
+               Matrix4x4_OriginFromMatrix(&e->render.matrix, origin);
 
        // handle particle trails and such effects now that we know where this
        // entity is in the world...
@@ -1233,7 +1230,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                trace_t trace;
                matrix4x4_t tempmatrix;
                Matrix4x4_Transform(&e->render.matrix, muzzleflashorigin, v2);
-               trace = CL_TraceBox(origin, vec3_origin, vec3_origin, v2, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_SKY, false);
+               trace = CL_Move(origin, vec3_origin, vec3_origin, v2, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_SKY, true, false, NULL, false);
                Matrix4x4_Normalize(&tempmatrix, &e->render.matrix);
                Matrix4x4_SetOrigin(&tempmatrix, trace.endpos[0], trace.endpos[1], trace.endpos[2]);
                Matrix4x4_Scale(&tempmatrix, 150, 1);
@@ -1732,6 +1729,11 @@ static void CL_TimeRefresh_f (void)
        Con_Printf("%f seconds (%f fps)\n", timedelta, 128/timedelta);
 }
 
+void CL_AreaStats_f(void)
+{
+       World_PrintAreaStats(&cl.world, "client");
+}
+
 /*
 ===========
 CL_Shutdown
@@ -1806,6 +1808,8 @@ void CL_Init (void)
        // LordHavoc: added pausedemo
        Cmd_AddCommand ("pausedemo", CL_PauseDemo_f, "pause demo playback (can also safely pause demo recording if using QUAKE, QUAKEDP or NEHAHRAMOVIE protocol, useful for making movies)");
 
+       Cmd_AddCommand ("cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces");
+
        Cvar_RegisterVariable(&r_draweffects);
        Cvar_RegisterVariable(&cl_explosions_alpha_start);
        Cvar_RegisterVariable(&cl_explosions_alpha_end);