From: bones_was_here Date: Mon, 27 Sep 2021 23:50:35 +0000 (+1000) Subject: Prevent players moving too far when stepping up X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=365e221966b15c24c6e2f4cbb6e619b0db443ebf;hp=97820be04836873cca98fddf52c1901e430d9bee 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 --- 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) {