]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Implement wrath's workaround for #136: don't clear the onground flag from view smooth...
authorMario <mario@smbclan.net>
Sun, 31 May 2020 14:55:35 +0000 (00:55 +1000)
committerMario <mario@smbclan.net>
Sun, 31 May 2020 14:55:35 +0000 (00:55 +1000)
client.h
view.c

index e7684bb43fd8e806c3b1418461737036ecb1bdba..686ec947e9e12dfc466c98a915f5d8e4d6cf181e 100644 (file)
--- 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 7bea5a969752fc7c8ff521bfa476ef290d7c13d5..dd2afe13b2adeb906e1d0ff204886137e59916cc 100644 (file)
--- 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
                {