- remove m_filter and simplify related code

This commit is contained in:
Rachael Alexanderson 2022-05-29 10:46:41 -04:00 committed by Christoph Oelckers
parent 0a6cd28af9
commit f1ad0961be
3 changed files with 2 additions and 18 deletions

View file

@ -52,7 +52,6 @@ event_t events[MAXEVENTS];
CVAR(Float, m_sensitivity_x, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Float, m_sensitivity_x, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, m_sensitivity_y, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Float, m_sensitivity_y, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
//========================================================================== //==========================================================================
@ -165,24 +164,11 @@ void D_PostEvent(event_t* ev)
void PostMouseMove(int xx, int yy) void PostMouseMove(int xx, int yy)
{ {
static float lastx = 0, lasty = 0;
event_t ev{}; event_t ev{};
float x = float(xx) * m_sensitivity_x; ev.x = float(xx) * m_sensitivity_x;
float y = -float(yy) * m_sensitivity_y; ev.y = -float(yy) * m_sensitivity_y;
if (m_filter)
{
ev.x = (x + lastx) / 2;
ev.y = (y + lasty) / 2;
}
else
{
ev.x = x;
ev.y = y;
}
lastx = x;
lasty = y;
if (ev.x || ev.y) if (ev.x || ev.y)
{ {
ev.type = EV_Mouse; ev.type = EV_Mouse;

View file

@ -82,7 +82,6 @@ protected:
void ClearButtonState(); void ClearButtonState();
int WheelMove[2]; int WheelMove[2];
int LastX, LastY; // for m_filter
int ButtonState; // bit mask of current button states (1=down, 0=up) int ButtonState; // bit mask of current button states (1=down, 0=up)
}; };

View file

@ -305,7 +305,6 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
FMouse::FMouse() FMouse::FMouse()
{ {
LastX = LastY = 0;
ButtonState = 0; ButtonState = 0;
WheelMove[0] = 0; WheelMove[0] = 0;
WheelMove[1] = 0; WheelMove[1] = 0;