Skip to content
Merged
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
33 changes: 33 additions & 0 deletions src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,38 @@ extern IGameSystem *ViewportClientSystem();
//-----------------------------------------------------------------------------
ISourceVirtualReality *g_pSourceVR = NULL;

#ifdef NEO
// Restrict external cheaty ConVars or ConCommands, where we don't have ctor access to set the flags.
static void RestrictNeoClientCheats()
{
if (!g_pCVar)
{
Assert(false);
return;
}

// NEO TODO (Rain): list currently incomplete...
// These cheat names can be either ConVars or ConCommands
constexpr const char* cheats[]{
"building_cubemaps",
"cl_showerror",
"net_showmsg",
};

constexpr auto flags = FCVAR_CHEAT;
for (int i = 0; i < ARRAYSIZE(cheats); ++i)
{
const char* cheatName = cheats[i];
if (auto* var = g_pCVar->FindVar(cheatName))
var->AddFlags(flags);
else if (auto* cmd = g_pCVar->FindCommand(cheatName))
cmd->AddFlags(flags);
else
AssertMsg(false, "convar or concmd named \"%s\" was not found\n", cheatName);
}
}
#endif

// Purpose: Called when the DLL is first loaded.
// Input : engineFactory -
// Output : int
Expand Down Expand Up @@ -1342,6 +1374,7 @@ void CHLClient::PostInit()
g_pCVar->FindVar("neo_clantag")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<NEO_MAX_CLANTAG_LENGTH>);
g_pCVar->FindVar("cl_neo_crosshair")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<NEO_XHAIR_SEQMAX>);
g_pCVar->FindVar("sv_use_steam_networking")->SetValue(false);
RestrictNeoClientCheats();
}
else
{
Expand Down