Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/game/client/neo/ui/neo_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,14 @@ void CNeoRoot::MainLoopSettings(const MainLoopParam param)
if (NeoUI::Button(NeoUI::HintAlt(L"Accept (F8)", L"Accept (START)")).bPressed
|| NeoUI::Bind(BTNCODES_ACCEPT, ARRAYSIZE(BTNCODES_ACCEPT)))
{
NeoSettingsSave(&m_ns);
if (m_ns.general.iFov > maxSupportedFov)
{
m_state = STATE_CONFIRMSETTINGS;
}
else
{
NeoSettingsSave(&m_ns);
}
}
}
}
Expand Down Expand Up @@ -2291,6 +2298,17 @@ void CNeoRoot::MainLoopPopup(const MainLoopParam param)
L"Settings changed: Do you want to apply the settings?" :
L"Error: Invalid settings, cannot save.");
NeoUI::SwapFont(NeoUI::FONT_NTNORMAL);

if (m_ns.general.iFov > maxSupportedFov)
{
wchar_t warning[77+1];
V_snwprintf(warning, ARRAYSIZE(warning),
L"WARNING: Current FOV value is %d%cvalues above %d may cause visual artifacts!",
m_ns.general.iFov, wint_t(8212) /* em dash */, maxSupportedFov);
NeoUI::Label(warning);
g_uiCtx.iLayoutY += (g_uiCtx.layout.iRowTall / 2);
}

NeoUI::SetPerRowLayout(3);
{
g_uiCtx.iLayoutX = (g_uiCtx.iMarginX / 2);
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/neo/ui/neo_root_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ void NeoSettings_General(NeoSettings *ns)
NeoUI::EndOverrideFgColor();
}

NeoUI::SliderInt(L"FOV", &pGeneral->iFov, 75, 110);
NeoUI::SliderInt(L"FOV", &pGeneral->iFov, MIN_FOV, MAX_FOV);
NeoUI::SliderInt(L"Viewmodel FOV Offset", &pGeneral->iViewmodelFov, -20, 40);
NeoUI::RingBoxBool(L"Reload empty", &pGeneral->bReloadEmpty);
NeoUI::RingBoxBool(L"Right hand viewmodel", &pGeneral->bViewmodelRighthand);
Expand Down
7 changes: 7 additions & 0 deletions src/game/client/neo/ui/neo_root_settings.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "shareddefs.h"
#include "tier1/convar.h"
#include "neo_player_shared.h"
#include "neo_hud_crosshair.h"
Expand Down Expand Up @@ -37,6 +38,12 @@ enum XHairExportNotify

#define NEO_BINDS_TOTAL 96

// Note that this is not necessarily the same as "neo_fov" cvar max value.
// We are restricted to supporting a max of 90 due to an engine limitation.
constexpr auto maxSupportedFov = 90;
static_assert(MIN_FOV <= maxSupportedFov);
static_assert(MAX_FOV >= maxSupportedFov);

struct NeoSettings
{
enum EquipUtilityPriorityType
Expand Down
10 changes: 9 additions & 1 deletion src/game/client/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#endif

#ifdef NEO
#include "neo/ui/neo_root_settings.h"
#include "vgui_controls/pch_vgui_controls.h"
#endif // NEO

Expand All @@ -75,7 +76,14 @@ extern ConVar default_fov;
extern bool g_bRenderingScreenshot;

#ifdef NEO
ConVar neo_fov("neo_fov", V_STRINGIFY(DEFAULT_FOV), FCVAR_ARCHIVE | FCVAR_USERINFO, "Set the normal FOV.", true, static_cast<float>(MIN_FOV), true, static_cast<float>(MAX_FOV));
ConVar neo_fov("neo_fov", V_STRINGIFY(DEFAULT_FOV), FCVAR_ARCHIVE | FCVAR_USERINFO, "Set the normal FOV.", true, static_cast<float>(MIN_FOV), true, static_cast<float>(MAX_FOV),
[](IConVar* var, const char* pOldValue, float flOldValue) {
int newVal = ((ConVar*)var)->GetInt();
if (newVal > maxSupportedFov)
{
Warning("Current FOV value is %d - values above %d may cause visual artifacts!\n", newVal, maxSupportedFov);
}
});
ConVar neo_fov_relay_spec("neo_fov_relay_spec", "0", FCVAR_ARCHIVE | FCVAR_USERINFO,
"If enabled, during first-person spectating, it will relay the target player's neo_fov to the spectator."
" This ConVar is controlled by the spectator, not the target player.", true, 0.0f, true, 1.0f);
Expand Down