]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
replaced cl_nettimesyncmode with 3 cvars cl_nettimesyncfactor,
[xonotic/darkplaces.git] / cl_main.c
index f41d1a1b5782da5c3ec40216547ebc6271ae3e40..e1b288aad8c611ead22c1f6163bc00da75adfcbe 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -52,7 +52,7 @@ cvar_t m_side = {CVAR_SAVE, "m_side","0.8","mouse side speed multiplier"};
 cvar_t freelook = {CVAR_SAVE, "freelook", "1","mouse controls pitch instead of forward/back"};
 
 cvar_t cl_autodemo = {CVAR_SAVE, "cl_autodemo", "0", "records every game played, using the date/time and map name to name the demo file" };
-cvar_t cl_autodemo_nameformat = {CVAR_SAVE, "cl_autodemo_nameformat", "%Y-%m-%d_%H-%M", "The format of the cl_autodemo filename, followed by the map name" };
+cvar_t cl_autodemo_nameformat = {CVAR_SAVE, "cl_autodemo_nameformat", "autodemos/%Y-%m-%d_%H-%M", "The format of the cl_autodemo filename, followed by the map name" };
 
 cvar_t r_draweffects = {0, "r_draweffects", "1","renders temporary sprite effects"};
 
@@ -67,7 +67,7 @@ cvar_t cl_stainmaps_clearonload = {CVAR_SAVE, "cl_stainmaps_clearonload", "1","c
 
 cvar_t cl_beams_polygons = {CVAR_SAVE, "cl_beams_polygons", "1","use beam polygons instead of models"};
 cvar_t cl_beams_quakepositionhack = {CVAR_SAVE, "cl_beams_quakepositionhack", "1", "makes your lightning gun appear to fire from your waist (as in Quake and QuakeWorld)"};
-cvar_t cl_beams_instantaimhack = {CVAR_SAVE, "cl_beams_instantaimhack", "1", "makes your lightning gun aiming update instantly"};
+cvar_t cl_beams_instantaimhack = {CVAR_SAVE, "cl_beams_instantaimhack", "0", "makes your lightning gun aiming update instantly"};
 cvar_t cl_beams_lightatend = {CVAR_SAVE, "cl_beams_lightatend", "0", "make a light at the end of the beam"};
 
 cvar_t cl_noplayershadow = {CVAR_SAVE, "cl_noplayershadow", "0","hide player shadow"};
@@ -338,9 +338,9 @@ void CL_Disconnect(void)
                        Con_DPrint("Sending clc_disconnect\n");
                        MSG_WriteByte(&buf, clc_disconnect);
                }
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol);
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol);
-               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
+               NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, 10000);
                NetConn_Close(cls.netcon);
                cls.netcon = NULL;
        }
@@ -503,7 +503,7 @@ static float CL_LerpPoint(void)
 {
        float f;
 
-       if (cl_nettimesyncmode.integer == 3)
+       if (cl_nettimesyncboundmode.integer == 1)
                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)
@@ -892,11 +892,13 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
        // also don't use the predicted location if fixangle was set on both of
        // the most recent server messages, as that cause means you are spectating
        // someone or watching a cutscene of some sort
+       if (cl_nolerp.integer || cls.timedemo)
+               interpolate = false;
        if (e == cl.entities + cl.playerentity && cl.movement_predicted && (!cl.fixangle[1] || !cl.fixangle[0]))
        {
                lerp = (cl.time - cl.movement_time[2]) / (cl.movement_time[0] - cl.movement_time[1]);
                lerp = bound(0, lerp, 1);
-               if (!interpolate || cl_nolerp.integer || cl.fixangle[0])
+               if (!interpolate)
                        lerp = 1;
                VectorLerp(cl.movement_oldorigin, lerp, cl.movement_origin, origin);
                VectorSet(angles, 0, cl.viewangles[1], 0);
@@ -1001,6 +1003,8 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
         && !(e->render.flags & RENDER_VIEWMODEL)
         && (!(e->render.flags & RENDER_EXTERIORMODEL) || (!cl.intermission && cls.protocol != PROTOCOL_NEHAHRAMOVIE && !cl_noplayershadow.integer)))
                e->render.flags |= RENDER_SHADOW;
+       if (e->render.flags & RENDER_VIEWMODEL)
+               e->render.flags |= RENDER_NOSELFSHADOW;
 }
 
 // creates light and trails from an entity
@@ -1119,7 +1123,7 @@ void CL_UpdateNetworkCollisionEntities(void)
 
        // start on the entity after the world
        cl.num_brushmodel_entities = 0;
-       for (i = 1;i < cl.num_entities;i++)
+       for (i = cl.maxclients + 1;i < cl.num_entities;i++)
        {
                if (cl.entities_active[i])
                {
@@ -1128,7 +1132,7 @@ void CL_UpdateNetworkCollisionEntities(void)
                        {
                                // do not interpolate the bmodels for this
                                CL_UpdateNetworkEntity(ent, 32, false);
-                               cl.brushmodel_entities[cl.num_brushmodel_entities++] = ent->state_current.number;
+                               cl.brushmodel_entities[cl.num_brushmodel_entities++] = i;
                        }
                }
        }
@@ -1368,7 +1372,6 @@ void CL_LinkNetworkEntity(entity_t *e)
 void CL_RelinkWorld(void)
 {
        entity_t *ent = &cl.entities[0];
-       cl.brushmodel_entities[cl.num_brushmodel_entities++] = 0;
        // FIXME: this should be done at load
        ent->render.matrix = identitymatrix;
        CL_UpdateRenderEntity(&ent->render);
@@ -1706,12 +1709,9 @@ int CL_ReadFromServer(void)
                V_DriftPitch();
                V_FadeViewFlashs();
 
-               if (cl.movement_predicted)
-               {
-                       // if prediction is enabled we have to update all the collidable
-                       // network entities before the prediction code can be run
-                       CL_UpdateNetworkCollisionEntities();
-               }
+               // if prediction is enabled we have to update all the collidable
+               // network entities before the prediction code can be run
+               CL_UpdateNetworkCollisionEntities();
 
                // now update the player prediction
                CL_ClientMovement_Replay();
@@ -1782,11 +1782,9 @@ For program optimization
 static void CL_TimeRefresh_f (void)
 {
        int i;
-       float timestart, timedelta, oldangles[3];
+       float timestart, timedelta;
 
        r_refdef.extraupdate = false;
-       VectorCopy(cl.viewangles, oldangles);
-       VectorClear(cl.viewangles);
 
        timestart = Sys_DoubleTime();
        for (i = 0;i < 128;i++)
@@ -1796,7 +1794,6 @@ static void CL_TimeRefresh_f (void)
        }
        timedelta = Sys_DoubleTime() - timestart;
 
-       VectorCopy(oldangles, cl.viewangles);
        Con_Printf("%f seconds (%f fps)\n", timedelta, 128/timedelta);
 }