}
// 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)
{
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