Skip to content

Commit 76b975a

Browse files
committed
dynamic FOV slider
1 parent d49ffef commit 76b975a

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

gameui/OptionsSubVideo.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,29 @@ class COptionsSubVideoAdvancedDlg : public vgui::Frame
435435
m_pColorCorrection->SetEnabled( mat_dxlevel.GetInt() >= 90 );
436436
m_pMotionBlur->SetEnabled( mat_dxlevel.GetInt() >= 90 );
437437

438-
if ( g_pCVar->FindVar( "fov_desired" ) == NULL )
438+
if ( ConVar* fovVar = g_pCVar->FindVar( "fov_desired" ) )
439439
{
440-
Panel *pFOV = FindChildByName( "FovSlider" );
441-
if ( pFOV )
440+
CCvarSlider* pFOV = (CCvarSlider*)FindChildByName("FovSlider");
441+
if (pFOV)
442442
{
443-
pFOV->SetVisible( false );
443+
float minVar, maxVar;
444+
fovVar->GetMin(minVar);
445+
fovVar->GetMax(maxVar);
446+
pFOV->SetMinMaxValues(max(75.0f, minVar), maxVar);
447+
}
448+
}
449+
else
450+
{
451+
Panel* pFOV = FindChildByName("FovSlider");
452+
if (pFOV)
453+
{
454+
pFOV->SetVisible(false);
444455
}
445456

446-
pFOV = FindChildByName( "FovLabel" );
447-
if ( pFOV )
457+
pFOV = FindChildByName("FovLabel");
458+
if (pFOV)
448459
{
449-
pFOV->SetVisible( false );
460+
pFOV->SetVisible(false);
450461
}
451462
}
452463

0 commit comments

Comments
 (0)