input: mlook/lookspring fix

Call V_StartPitchDrift only if lookspring has been turned on, then make
sure to call V_StopPitchDrift if mlook is on and the mouse is moved.

From Jacques Krige's tutorial, see http://www.quake-1.com/docs/quakesrc.org/1.html

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
svdijk 2013-04-04 21:08:53 +02:00 committed by Kevin Shanahan
parent 4a4ea5367c
commit 0dc82b6d60
5 changed files with 14 additions and 23 deletions

View File

@ -208,9 +208,10 @@ V_DriftPitch(void)
else
cl.driftmove += host_frametime;
if (cl.driftmove > v_centermove.value) {
V_StartPitchDrift();
}
if (cl.driftmove > v_centermove.value)
if (lookspring.value)
V_StartPitchDrift();
return;
}

View File

@ -211,9 +211,10 @@ V_DriftPitch(void)
else
cl.driftmove += host_frametime;
if (cl.driftmove > v_centermove.value) {
V_StartPitchDrift();
}
if (cl.driftmove > v_centermove.value)
if (lookspring.value)
V_StartPitchDrift();
return;
}

View File

@ -643,7 +643,8 @@ IN_MouseMove(usercmd_t *cmd)
else
cl.viewangles[YAW] -= m_yaw.value * mouse_x;
if (in_mlook.state & 1)
V_StopPitchDrift();
if (mouse_x || mouse_y)
V_StopPitchDrift();
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
cl.viewangles[PITCH] += m_pitch.value * mouse_y;

View File

@ -680,7 +680,8 @@ IN_MouseMove(usercmd_t *cmd)
cl.viewangles[YAW] -= m_yaw.value * mouse_x;
if (in_mlook.state & 1)
V_StopPitchDrift();
if (mouse_x || mouse_y)
V_StopPitchDrift();
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
cl.viewangles[PITCH] += m_pitch.value * mouse_y;
@ -1081,13 +1082,6 @@ IN_JoyMove(usercmd_t *cmd)
aspeed * cl_pitchspeed.value;
}
V_StopPitchDrift();
} else {
// no pitch movement
// disable pitch return-to-center unless requested by user
// *** this code can be removed when the lookspring bug is fixed
// *** the bug always has the lookspring feature on
if (lookspring.value == 0.0)
V_StopPitchDrift();
}
} else {
// user wants forward control to be forward control
@ -1147,13 +1141,6 @@ IN_JoyMove(usercmd_t *cmd)
speed * 180.0;
}
V_StopPitchDrift();
} else {
// no pitch movement
// disable pitch return-to-center unless requested by user
// *** this code can be removed when the lookspring bug is fixed
// *** the bug always has the lookspring feature on
if (lookspring.value == 0.0)
V_StopPitchDrift();
}
}
break;

View File

@ -298,7 +298,8 @@ IN_MouseMove(usercmd_t *cmd)
cl.viewangles[YAW] -= m_yaw.value * mouse_x;
if (in_mlook.state & 1)
V_StopPitchDrift ();
if (mouse_x || mouse_y)
V_StopPitchDrift ();
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
cl.viewangles[PITCH] += m_pitch.value * mouse_y;