mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
[qw] Fix a bunch of punchangle issues
punchangle wasn't getting decayed for two reasons: I had forgotten to set the flag in qw, and the decayed value was not getting written to viewstate. Also, the rotation was misapplied (I had the two quaternions swapped) so punchangle was being applied to world Y instead of local Y, thus the seemingly random rolls.
This commit is contained in:
parent
962438bddc
commit
e978234018
2 changed files with 8 additions and 2 deletions
|
@ -873,8 +873,9 @@ V_CalcRefdef (viewstate_t *vs)
|
|||
renderer->skin = 0;
|
||||
|
||||
// set up the refresh position
|
||||
rotation = Transform_GetWorldRotation (vs->camera_transform);
|
||||
Transform_SetWorldRotation (vs->camera_transform,
|
||||
qmulf (vs->punchangle, rotation));
|
||||
qmulf (rotation, vs->punchangle));
|
||||
|
||||
// smooth out stair step ups
|
||||
if ((vs->onground != -1) && (gun_origin[2] - oldz > 0)) {
|
||||
|
@ -907,8 +908,9 @@ DropPunchAngle (viewstate_t *vs)
|
|||
float ps = magnitude3f (punch)[0];
|
||||
if (ps < 1e-3) {
|
||||
// < 0.2 degree rotation, not worth worrying about
|
||||
//ensure the quaternion is normalized
|
||||
//ensure the quaternion is identity
|
||||
vs->punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
vs->decay_punchangle = 0;
|
||||
return;
|
||||
}
|
||||
float pc = punch[3];
|
||||
|
@ -918,9 +920,11 @@ DropPunchAngle (viewstate_t *vs)
|
|||
float c = pc * dc + ps * ds;
|
||||
if (s <= 0 || c >= 1) {
|
||||
vs->punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
vs->decay_punchangle = 0;
|
||||
} else {
|
||||
punch *= s / ps;
|
||||
punch[3] = c;
|
||||
vs->punchangle = punch;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1491,6 +1491,7 @@ CL_ParseServerMessage (void)
|
|||
// svc_cutscene (same value as svc_smallkick)
|
||||
|
||||
case svc_smallkick:
|
||||
cl.viewstate.decay_punchangle = 1;
|
||||
cl.viewstate.punchangle = (vec4f_t) {
|
||||
// -2 degrees pitch
|
||||
0, -0.0174524064, 0, 0.999847695
|
||||
|
@ -1498,6 +1499,7 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_bigkick:
|
||||
cl.viewstate.decay_punchangle = 1;
|
||||
cl.viewstate.punchangle = (vec4f_t) {
|
||||
// -4 degrees pitch
|
||||
0, -0.0348994967, 0, 0.999390827
|
||||
|
|
Loading…
Reference in a new issue