VectorAdd(vieworg, cl.punchvector, vieworg);
if (cl.stats[STAT_HEALTH] > 0)
{
- // gun model bobbing code
double xyspeed, bob;
vec_t d;
vec_t ef_speed = cl.realframetime;
if(cl.viewmodel_push_x - cl.viewangles[PITCH] >= 180)
cl.viewmodel_push_x -= 360;
- d = cl.viewmodel_push_x - cl.viewangles[PITCH];
+ d = cl.viewangles[PITCH] - cl.viewmodel_push_x;
cl.viewmodel_push_x = bound(cl.viewangles[PITCH] - cl_leanmodel_up_limit.value, cl.viewmodel_push_x + d * cl_leanmodel_up_speed.value * ef_speed, cl.viewangles[PITCH] + cl_leanmodel_up_limit.value);
}
else
if(cl.viewmodel_push_y - cl.viewangles[YAW] >= 180)
cl.viewmodel_push_y -= 360;
- d = cl.viewmodel_push_y - cl.viewangles[YAW];
+ d = cl.viewangles[YAW] - cl.viewmodel_push_y;
cl.viewmodel_push_y = bound(cl.viewangles[YAW] - cl_leanmodel_side_limit.value, cl.viewmodel_push_y + d * cl_leanmodel_side_speed.value * ef_speed, cl.viewangles[YAW] + cl_leanmodel_side_limit.value);
}
else
VectorSet(gunangles, cl.viewmodel_push_x, cl.viewmodel_push_y, viewangles[2]);
// gun model following code
- // TODO: make the weapon model not shake when looking around horizontally (due to X axis vs. Y axis)
if(cl_followmodel_side.value && cl_followmodel_side_speed.value * ef_speed < 1) // bad things happen if this goes over 1, so prevent the effect
{
vec_t d0 = vieworg[0] - cl.gunorg_follow[0];
VectorCopy(cl.gunorg_follow, gunorg);
+ // gun model bobbing code
xyspeed = sqrt(cl.movement_velocity[0]*cl.movement_velocity[0] + cl.movement_velocity[1]*cl.movement_velocity[1]);
if (cl_bob.value && cl_bobcycle.value)
{
bob = xyspeed * cl_bob.value;
bob = bob*0.3 + bob*0.7*cycle;
vieworg[2] += 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[2] += bound(-7, bob, 4);
}
if (cl_bob.value && cl_bobmodel.value)