]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Prevent players moving too far when stepping up bones_was_here/stepup_distance
authorbones_was_here <bones_was_here@xa.org.au>
Mon, 27 Sep 2021 23:50:35 +0000 (09:50 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 9 Jan 2022 12:34:10 +0000 (22:34 +1000)
After the player made some horizontal progress, and before stepping up, it's necessary to recalculate the remaining time and distance for the move. Previously the step up made the player travel (up to) nearly the move's full distance, again.

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/9
sv_gameplayfix_stepmultipletimes 1: players travel further than their velocity should allow #9

Signed-off-by: bones_was_here <bones_was_here@xa.org.au>
sv_phys.c

index a918ea25603c7145aa59e09174643011a5e22152..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)
                {