]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Place / move a speed bound, to avoid bobbing getting stronger if sv_maxspeed is over 400
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 12 Jul 2010 18:09:03 +0000 (18:09 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 12 Jul 2010 18:09:03 +0000 (18:09 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10310 d7cf8633-e32d-0410-b094-e92efae38249

view.c

diff --git a/view.c b/view.c
index 2f7e17f862904463eb11c64bc51ba4246ae0031c..276e9091b566eb996996ea9516c70a93e9cdaaad 100644 (file)
--- a/view.c
+++ b/view.c
@@ -638,8 +638,10 @@ void V_CalcRefdef (void)
                                        VectorAdd(vieworg, gunorg, gunorg);
                                        VectorAdd(viewangles, gunangles, gunangles);
 
+                                       // bounded XY speed calculation, used by several effects below
+                                       xyspeed = bound (0, sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]), 400);
+
                                        // vertical view bobbing code
-                                       xyspeed = sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]);
                                        if (cl_bob.value && cl_bobcycle.value)
                                        {
                                                // LordHavoc: this code is *weird*, but not replacable (I think it
@@ -745,7 +747,7 @@ void V_CalcRefdef (void)
                                                        t *= 5;
                                                }
 
-                                               bspeed = bound (0, xyspeed, 400) * 0.01f;
+                                               bspeed = xyspeed * 0.01f;
                                                AngleVectors (gunangles, forward, right, up);
                                                bob = bspeed * cl_bobmodel_side.value * cl_viewmodel_scale.value * sin (s) * t;
                                                VectorMA (gunorg, bob, right, gunorg);