Fix initialization of gunorg/vieworg when cl_followmodel/cl_leanmodel are disabled.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Oct 2017 18:50:09 +0000 (18:50 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Oct 2017 18:50:09 +0000 (18:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12342 d7cf8633-e32d-0410-b094-e92efae38249

view.c

diff --git a/view.c b/view.c
index da80239..1102eff 100644 (file)
--- a/view.c
+++ b/view.c
@@ -670,7 +670,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
 
                                frametime = (cl.time - cl.calcrefdef_prevtime) * cl.movevars_timescale;
 
-                               if(cl_followmodel.value || cl_leanmodel.value)
+                               if(cl_followmodel.integer || cl_leanmodel.integer)
                                {
                                        // 1. if we teleported, clear the frametime... the lowpass will recover the previous value then
                                        if(teleported)
@@ -717,6 +717,12 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                                        VectorAdd(vieworg, gunorg, gunorg);
                                        VectorAdd(viewangles, gunangles, gunangles);
                                }
+                               else
+                               {
+                                       // Just initialize gunorg/gunangles.
+                                       VectorCopy(vieworg, gunorg);
+                                       VectorCopy(viewangles, gunangles);
+                               }
 
                                // bounded XY speed, used by several effects below
                                xyspeed = bound (0, sqrt(clvelocity[0]*clvelocity[0] + clvelocity[1]*clvelocity[1]), cl_bob_velocity_limit.value);