Fixed: don't interpolate view movements if a key press didn't result in any changes.

This commit is contained in:
Leonard2 2017-10-11 17:22:22 +02:00 committed by Christoph Oelckers
parent 7d67d5e998
commit 80701927e8
3 changed files with 8 additions and 14 deletions

View File

@ -328,12 +328,12 @@ void D_PostEvent (const event_t *ev)
int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0);
if (invertmouse)
look = -look;
G_AddViewPitch (look);
G_AddViewPitch (look, true);
events[eventhead].y = 0;
}
if (!Button_Strafe.bDown && !lookstrafe)
{
G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0));
G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0), true);
events[eventhead].x = 0;
}
if ((events[eventhead].x | events[eventhead].y) == 0)

View File

@ -608,24 +608,20 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (Button_Right.bDown)
{
G_AddViewAngle (angleturn[tspeed]);
LocalKeyboardTurner = true;
}
if (Button_Left.bDown)
{
G_AddViewAngle (-angleturn[tspeed]);
LocalKeyboardTurner = true;
}
}
if (Button_LookUp.bDown)
{
G_AddViewPitch (lookspeed[speed]);
LocalKeyboardTurner = true;
}
if (Button_LookDown.bDown)
{
G_AddViewPitch (-lookspeed[speed]);
LocalKeyboardTurner = true;
}
if (Button_MoveUp.bDown)
@ -701,12 +697,10 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (joyaxes[JOYAXIS_Pitch] != 0)
{
G_AddViewPitch(joyint(joyaxes[JOYAXIS_Pitch] * 2048));
LocalKeyboardTurner = true;
}
if (joyaxes[JOYAXIS_Yaw] != 0)
{
G_AddViewAngle(joyint(-1280 * joyaxes[JOYAXIS_Yaw]));
LocalKeyboardTurner = true;
}
side -= joyint(sidemove[speed] * joyaxes[JOYAXIS_Side]);
@ -794,7 +788,7 @@ void G_BuildTiccmd (ticcmd_t *cmd)
//[Graf Zahl] This really helps if the mouse update rate can't be increased!
CVAR (Bool, smooth_mouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
void G_AddViewPitch (int look)
void G_AddViewPitch (int look, bool mouse)
{
if (gamestate == GS_TITLELEVEL)
{
@ -837,11 +831,11 @@ void G_AddViewPitch (int look)
}
if (look != 0)
{
LocalKeyboardTurner = smooth_mouse;
LocalKeyboardTurner = (!mouse || smooth_mouse);
}
}
void G_AddViewAngle (int yaw)
void G_AddViewAngle (int yaw, bool mouse)
{
if (gamestate == GS_TITLELEVEL)
{
@ -857,7 +851,7 @@ void G_AddViewAngle (int yaw)
LocalViewAngle -= yaw;
if (yaw != 0)
{
LocalKeyboardTurner = smooth_mouse;
LocalKeyboardTurner = (!mouse || smooth_mouse);
}
}

View File

@ -89,10 +89,10 @@ void G_DoReborn (int playernum, bool freshbot);
void G_DoPlayerPop(int playernum);
// Adds pitch to consoleplayer's viewpitch and clamps it
void G_AddViewPitch (int look);
void G_AddViewPitch (int look, bool mouse = false);
// Adds to consoleplayer's viewangle if allowed
void G_AddViewAngle (int yaw);
void G_AddViewAngle (int yaw, bool mouse = false);
#define BODYQUESIZE 32
class AActor;