]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
CSQC: support the sound pitch shift arg (NOT in SVQC yet)
[xonotic/darkplaces.git] / cl_input.c
index fee3b1df1ee66735a1f7b1de6097a74ea3799d06..c74b4ec0f57ac2fd3e90057cd84bda7be8b8ca9e 100644 (file)
@@ -883,6 +883,7 @@ qboolean CL_ClientMovement_Unstick(cl_clientmovement_state_t *s)
 
 void CL_ClientMovement_UpdateStatus(cl_clientmovement_state_t *s)
 {
+       vec_t f;
        vec3_t origin1, origin2;
        trace_t trace;
 
@@ -922,7 +923,17 @@ void CL_ClientMovement_UpdateStatus(cl_clientmovement_state_t *s)
        VectorSet(origin1, s->origin[0], s->origin[1], s->origin[2] + 1);
        VectorSet(origin2, s->origin[0], s->origin[1], s->origin[2] - 1); // -2 causes clientside doublejump bug at above 150fps, raising that to 300fps :)
        trace = CL_TraceBox(origin1, s->mins, s->maxs, origin2, MOVE_NORMAL, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_PLAYERCLIP, true, true, NULL, false);
-       s->onground = trace.fraction < 1 && trace.plane.normal[2] > 0.7;
+       if(trace.fraction < 1 && trace.plane.normal[2] > 0.7)
+       {
+               s->onground = true;
+
+               // this code actually "predicts" an impact; so let's clip velocity first
+               f = DotProduct(s->velocity, trace.plane.normal);
+               if(f < 0) // only if moving downwards actually
+                       VectorMA(s->velocity, -f, trace.plane.normal, s->velocity);
+       }
+       else
+               s->onground = false;
 
        // set watertype/waterlevel
        VectorSet(origin1, s->origin[0], s->origin[1], s->origin[2] + s->mins[2] + 1);
@@ -1621,14 +1632,14 @@ void CL_ClientMovement_Replay(void)
                                        CL_ClientMovement_PlayerMove(&s);
                                }
                                CL_ClientMovement_PlayerMove(&s);
-                               cl.movecmd[i].canjump = s.cmd.canjump;
                        }
                        else
                        {
                                // we REALLY need this handling to happen, even if the move is not executed
-                               if (!cl.movecmd[i].jump)
-                                       cl.movecmd[i].canjump = true;
+                               if (!s.cmd.jump)
+                                       s.cmd.canjump = true;
                        }
+                       cl.movecmd[i].canjump = s.cmd.canjump;
                }
                //Con_Printf("\n");
                CL_ClientMovement_UpdateStatus(&s);
@@ -1837,7 +1848,6 @@ void CL_SendMove(void)
                cl.cmd.forwardmove = cl.cmd.sidemove = cl.cmd.upmove = cl.cmd.impulse = cl.cmd.buttons = 0;
 
        cl.cmd.jump = (cl.cmd.buttons & 2) != 0;
-       cl.cmd.canjump = cl.movecmd[0].canjump;
        cl.cmd.crouch = 0;
        switch (cls.protocol)
        {