From 365e221966b15c24c6e2f4cbb6e619b0db443ebf Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 28 Sep 2021 09:50:35 +1000 Subject: [PATCH] Prevent players moving too far when stepping up 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 --- sv_phys.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sv_phys.c b/sv_phys.c index a918ea25..1669e682 100644 --- 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) { -- 2.39.2