diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 24b70d3..ad88471 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -25,7 +25,6 @@ #define RGB_GREY 0x008e8f91 //255,160,0 #define RGB_GREENISH 0x0000A000 //0,160,0 #define RGB_REDISH 0x00FF0000 -#define HUD_LAG_VALUE 17 // The sensitivity of the HUD-sway effect. #ifndef _WIN32 #define _cdecl diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 8e964fc..a6c790d 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -126,6 +126,9 @@ cvar_t v_ipitch_level = { "v_ipitch_level", "0.3", 0, 0.3 }; float v_idlescale; // used by TFC for concussion grenade effect cvar_s* crosshair_low; +int HUD_LAG_VALUE; // The sensitivity of the HUD-sway effect is dependent on the screen resolution. + + //============================================================================= /* @@ -877,6 +880,15 @@ void V_CalcViewModelLag(ref_params_t* pparams, Vector& origin, Vector& angles, V origin = origin + (vDifference * -1.0f) * m_flScale; + if (ScreenWidth > 2560 && ScreenHeight > 1600) + HUD_LAG_VALUE = 17; + else if (ScreenWidth >= 1280 && ScreenHeight > 720) + HUD_LAG_VALUE = 13; + else if (ScreenWidth >= 640) + HUD_LAG_VALUE = 8; + else + HUD_LAG_VALUE = 2; + // HUD lag gHUD.m_flHudLagOfs[0] += V_CalcRoll(vOriginalAngles, ((vDifference * -1.0f) * m_flScale), HUD_LAG_VALUE, 500) * 280.0f; gHUD.m_flHudLagOfs[1] += V_CalcRoll(vOriginalAngles, ((vDifference * 1.0f) * m_flScale), HUD_LAG_VALUE, 500, 2) * 280.0f; @@ -938,6 +950,11 @@ void V_RetractWeapon(ref_params_t* pparams, cl_entity_s* view) gEngfuncs.pEventAPI->EV_PopPMStates(); } +void ReturnLagValue() +{ + gEngfuncs.Con_Printf("%s\n", HUD_LAG_VALUE); +} + /* ================== V_CalcRefdef @@ -2067,6 +2084,8 @@ void V_Init(void) cl_shockrifle_punch_enabled = gEngfuncs.pfnRegisterVariable("cl_shockrifle_punch_enabled", "1", FCVAR_ARCHIVE); crosshair_low = gEngfuncs.pfnRegisterVariable("crosshair_low", "0", FCVAR_ARCHIVE); + + gEngfuncs.pfnAddCommand("hud_lag_value", ReturnLagValue); }