From e0279920c7bf32b9a67c6c383cff90a32a99d573 Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Fri, 30 Dec 2022 13:14:00 +0300 Subject: [PATCH] Access m_rawinput cvar via pointer instead of CVAR_GET_FLOAT --- cl_dll/input_goldsource.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index a11d26b1..615cb3d6 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -150,6 +150,7 @@ extern cvar_t *cl_pitchspeed; extern cvar_t *cl_movespeedkey; #if _WIN32 +static cvar_t* m_rawinput = NULL; static double s_flRawInputUpdateTime = 0.0f; static bool m_bRawInput = false; static bool m_bMouseThread = false; @@ -385,7 +386,7 @@ void IN_SetMouseMode(bool enable) if (mouseparmsvalid) restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bRawInput = m_rawinput->value != 0; if(m_bRawInput) { #if USE_SDL2 @@ -787,7 +788,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY) bool lockEntered = MouseThread_ActiveLock_Enter(); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bRawInput = m_rawinput->value != 0; if(m_bRawInput && !isMouseRelative) { @@ -1571,7 +1572,8 @@ void GoldSourceInput::IN_Init (void) m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE ); #if _WIN32 - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_rawinput = gEngfuncs.pfnGetCvarPointer("m_rawinput"); + m_bRawInput = m_rawinput->value != 0; m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "1", FCVAR_ARCHIVE ); // default to less than 1000 Hz