From d3deefd7b62634d4a714ee7d6abd25b9c049d01c Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 1 Jun 2020 00:55:35 +1000 Subject: [PATCH] Implement wrath's workaround for #136: don't clear the onground flag from view smoothing and bobbing for a short time --- client.h | 1 + view.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client.h b/client.h index e7684bb4..686ec947 100644 --- a/client.h +++ b/client.h @@ -1168,6 +1168,7 @@ typedef struct client_state_s qboolean oldonground; double lastongroundtime; double hitgroundtime; + double bobongroundtime; float bob2_smooth; float bobfall_speed; float bobfall_swing; diff --git a/view.c b/view.c index 7bea5a96..dd2afe13 100644 --- a/view.c +++ b/view.c @@ -507,6 +507,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa float vieworg[3], viewangles[3], smoothtime; float gunorg[3], gunangles[3]; matrix4x4_t tmpmatrix; + qboolean realonground; static float viewheightavg; float viewheight; @@ -518,6 +519,15 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa #endif trace_t trace; + // save the "true" onground time + if (clonground) + cl.bobongroundtime = cl.movecmd[0].time; + realonground = clonground; + + // if nogravityonground is enabled, use a "delayed" onground flag + if ((cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND) && !clonground && (cl.time - cl.bobongroundtime < 0.2)) + clonground = true; + // react to clonground state changes (for gun bob) if (clonground) { @@ -572,7 +582,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa else { // smooth stair stepping, but only if clonground and enabled - if (!clonground || cl_stairsmoothspeed.value <= 0 || teleported) + if (!realonground || cl_stairsmoothspeed.value <= 0 || teleported) cl.stairsmoothz = vieworg[2]; else { -- 2.39.2