]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix issues with V_CalcRefdef in CSQC and stereo view
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Jan 2012 13:29:32 +0000 (13:29 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Jan 2012 13:29:32 +0000 (13:29 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11641 d7cf8633-e32d-0410-b094-e92efae38249

client.h
view.c

index 711bb3ddafa9e39fe4f92dceb17ec139c7aaab8f..c7541f5239a4c4820b89d585436743694ea642e2 100644 (file)
--- a/client.h
+++ b/client.h
@@ -996,6 +996,7 @@ typedef struct client_state_s
        float bob2_smooth;
        float bobfall_speed;
        float bobfall_swing;
+       double calcrefdef_prevtime;
 
        // don't change view angle, full screen, etc
        int intermission;
diff --git a/view.c b/view.c
index 559ab97ee819ad952f2cb05c2245e3ccc502b814..770f85f9034d30a6ce054901c34b18043b5d9b0c 100644 (file)
--- a/view.c
+++ b/view.c
@@ -446,6 +446,7 @@ static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fra
  *   cl.oldongrounbd
  *   cl.stairsmoothtime
  *   cl.stairsmoothz
+ *   cl.calcrefdef_prevtime
  * Extra input:
  *   cl.movecmd[0].time
  *   cl.movevars_stepheight
@@ -490,6 +491,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                cl.lastongroundtime = cl.movecmd[0].time;
        }
        cl.oldonground = clonground;
+       cl.calcrefdef_prevtime = max(cl.calcrefdef_prevtime, cl.oldtime);
 
        VectorClear(gunorg);
        viewmodelmatrix_nobob = identitymatrix;
@@ -548,7 +550,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
 
                // apply the viewofs (even if chasecam is used)
                // Samual: Lets add smoothing for this too so that things like crouching are done with a transition.
-               viewheight = bound(0, (cl.time - cl.oldtime) / max(0.0001, cl_smoothviewheight.value), 1);
+               viewheight = bound(0, (cl.time - cl.calcrefdef_prevtime) / max(0.0001, cl_smoothviewheight.value), 1);
                viewheightavg = viewheightavg * (1 - viewheight) + clstatsviewheight * viewheight;
                vieworg[2] += viewheightavg;
 
@@ -657,7 +659,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                                float cycle;
                                vec_t frametime;
 
-                               frametime = (cl.time - cl.oldtime) * cl.movevars_timescale;
+                               frametime = (cl.time - cl.calcrefdef_prevtime) * cl.movevars_timescale;
 
                                // 1. if we teleported, clear the frametime... the lowpass will recover the previous value then
                                if(teleported)