Merge PR 'sv_gameplayfix_stepmultipletimes 1: Make stepping up while jumping reliable'
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 16 Jan 2022 20:52:00 +0000 (06:52 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 16 Jan 2022 20:52:00 +0000 (06:52 +1000)
When the player is hard up against a solid surface trying to climb up, they are blocked from gaining any significant speed by the solid, so the distance they could potentially move into the solid at that speed can be well under 0.03125 units, causing the step up to fail.

The same can happen when the player is stepping up with less than 0.03125 units of distance left on their move, causing them to stop dead when climbing stairs at speed with sv_gameplayfix_stepmultipletimes 1.

https://github.com/DarkPlacesEngine/darkplaces/pull/11

branch: bones_was_here/stepup_reliability
commits: 4c6cb7882855468365644ac65b6eb86a3e82a812

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

diff --combined sv_phys.c
index b26ebe225e90f6020e8411a7d6491565605a320b,eb04a6dcb647a4bc357e184570af19c761e7de39..2e61888d5bba7b669f56e7bf3dd20874e32a5291
+++ b/sv_phys.c
@@@ -1303,7 -1303,8 +1303,8 @@@ static int SV_FlyMove (prvm_edict_t *en
                        }
                        //Con_Printf("%f %f %f : ", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]);
                        // accept the new position if it made some progress...
-                       if (fabs(PRVM_serveredictvector(ent, origin)[0] - org[0]) >= 0.03125 || fabs(PRVM_serveredictvector(ent, origin)[1] - org[1]) >= 0.03125)
+                       // previously this checked if absolute distance >= 0.03125 which made stepping up unreliable
+                       if (PRVM_serveredictvector(ent, origin)[0] - org[0] || PRVM_serveredictvector(ent, origin)[1] - org[1])
                        {
                                //Con_Printf("accepted (delta %f %f %f)\n", PRVM_serveredictvector(ent, origin)[0] - org[0], PRVM_serveredictvector(ent, origin)[1] - org[1], PRVM_serveredictvector(ent, origin)[2] - org[2]);
                                trace = steptrace2;
@@@ -2350,11 -2351,7 +2351,11 @@@ static void SV_WalkMove (prvm_edict_t *
                VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs);
                trace = SV_TraceBox(upmove, entmins, entmaxs, downmove, type, ent, SV_GenericHitSuperContentsMask(ent), skipsupercontentsmask, skipmaterialflagsmask, collision_extendmovelength.value);
                if(trace.fraction < 1 && trace.plane.normal[2] > 0.7)
 +              {
                        clip |= 1; // but we HAVE found a floor
 +                      // set groundentity so we get carried when walking onto a mover with sv_gameplayfix_nogravityonground
 +                      PRVM_serveredictedict(ent, groundentity) = PRVM_EDICT_TO_PROG(trace.ent);
 +              }
        }
  
        // if the move did not hit the ground at any point, we're not on ground