Skip to content

Commit

Permalink
[FIXME] HUD lag value is dependent on resolution
Browse files Browse the repository at this point in the history
With debugger
  • Loading branch information
sabianroberts committed Oct 26, 2024
1 parent de88a85 commit 67d130f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 0 additions & 1 deletion cl_dll/hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions cl_dll/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.



//=============================================================================
/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}


Expand Down

0 comments on commit 67d130f

Please sign in to comment.