]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
Prevent players moving too far when stepping up
[xonotic/darkplaces.git] / sv_phys.c
index 5633a1d33a5d9c160b964f3b544bd73ec08a83c3..1669e682c487590f003f7a5585ed32b01cd54808 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1255,6 +1255,9 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float
 
                if (trace.fraction == 1)
                        break;
+
+               time_left *= 1 - trace.fraction;
+
                if (trace.plane.normal[2])
                {
                        if (trace.plane.normal[2] > 0.7)
@@ -1282,6 +1285,7 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float
                        trace_t steptrace3;
                        //Con_Printf("step %f %f %f : ", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]);
                        VectorSet(steppush, 0, 0, stepheight);
+                       VectorScale(PRVM_serveredictvector(ent, velocity), time_left, push);
                        VectorCopy(PRVM_serveredictvector(ent, origin), org);
                        if(!SV_PushEntity(&steptrace, ent, steppush, false))
                        {
@@ -1333,8 +1337,6 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float
                        numplanes = 0;
                }
 
-               time_left *= 1 - trace.fraction;
-
                // clipped to another plane
                if (numplanes >= MAX_CLIP_PLANES)
                {
@@ -3176,8 +3178,10 @@ void SV_Physics (void)
        PRVM_serverglobalfloat(frametime) = sv.frametime;
        prog->ExecuteProgram(prog, PRVM_serverfunction(StartFrame), "QC function StartFrame is missing");
 
+#ifdef USEODE
        // run physics engine
        World_Physics_Frame(&sv.world, sv.frametime, sv_gravity.value);
+#endif
 
 //
 // treat each object in turn