+ // view bobbing code 2
+ if (cl_bob_side.value && cl_bobcycle_side.value)
+ {
+ // LordHavoc: this code is *weird*, but not replacable (I think it
+ // should be done in QC on the server, but oh well, quake is quake)
+ // LordHavoc: figured out bobup: the time at which the sin is at 180
+ // degrees (which allows lengthening or squishing the peak or valley)
+ cycle = cl.time / cl_bobcycle_side.value;
+ cycle -= (int) cycle;
+ if (cycle < cl_bobup_side.value)
+ cycle = sin(M_PI * cycle / cl_bobup_side.value);
+ else
+ cycle = sin(M_PI + M_PI * (cycle-cl_bobup_side.value)/(1.0 - cl_bobup_side.value));
+ // bob is proportional to velocity in the xy plane
+ // (don't count Z, or jumping messes it up)
+ bob = xyspeed * cl_bob_side.value;
+ bob = bob*0.3 + bob*0.7*cycle;
+ vieworg[1] += bound(-7, bob, 4);
+ vieworg[0] += bound(-7, bob, 4);
+ // we also need to adjust gunorg, or this appears like pushing the gun!
+ // In the old code, this was applied to vieworg BEFORE copying to gunorg,
+ // but this is not viable with the new followmodel code as that would mean
+ // that followmodel would work on the munged-by-bob vieworg and do feedback
+ gunorg[1] += bound(-7, bob, 4);
+ gunorg[0] += bound(-7, bob, 4);
+ //vieworg[0] += bound(-7, bob, 4);
+ }
+