From: divverent Date: Mon, 12 Jul 2010 18:03:02 +0000 (+0000) Subject: Fix centering, works exactly as intended now X-Git-Tag: xonotic-v0.1.0preview~230^2~198 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=91d848f0a2225b47721e2f0f55f1b2c57c5fbfed;p=xonotic%2Fdarkplaces.git Fix centering, works exactly as intended now From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10280 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/view.c b/view.c index 22ccda2c..26f73644 100644 --- a/view.c +++ b/view.c @@ -666,7 +666,7 @@ void V_CalcRefdef (void) } // view rolling code - // TODO 1: Make it work around the center rather than the left side + // TODO 1 (DONE): Make it work around the center rather than the left side // TODO 2: Make the roll smoothly return to 0 when you stop touching the ground, rather than instantly // TODO 3: Write cvars to darkplaces.txt, set better defaults and possibly disable by default once the first TODOs are ready if (cl_bobroll.value && cl_bobrollcycle.value) @@ -674,14 +674,13 @@ void V_CalcRefdef (void) { cycle2 = cl.time / cl_bobrollcycle.value; cycle2 -= (int) cycle2; - if (cycle2 < cl_bobrollup.value) - cycle2 = sin(M_PI * cycle2 / cl_bobrollup.value); + if (cycle2 < 0.5) + cycle2 = sin(M_PI * cycle2 / 0.5); else - cycle2 = sin(M_PI + M_PI * (cycle2-cl_bobrollup.value)/(1.0 - cl_bobrollup.value)); - - bobroll = xyspeed * cl_bobroll.value; - bobroll = bobroll*0.3 + bobroll*0.7*cycle2; - viewangles[2] = bound(-5, bobroll, 5); + cycle2 = sin(M_PI + M_PI * (cycle2-0.5)/0.5); + cycle2 *= cl_bobrollup.value; + bobroll = xyspeed * cl_bobroll.value * cycle2; + viewangles[2] = bound(-45, bobroll, 45); } // gun model bobbing code