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
7 changes: 7 additions & 0 deletions src/game/client/cdll_bounded_cvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "convar_serverbounded.h"
#include "tier0/icommandline.h"

#ifdef NEO
#include "neo_player_shared.h"
#endif

bool g_bForceCLPredictOff = false;

Expand Down Expand Up @@ -65,7 +68,11 @@ class CBoundedCvar_InterpRatio : public ConVar_ServerBounded
public:
CBoundedCvar_InterpRatio() :
ConVar_ServerBounded( "cl_interp_ratio",
#ifdef NEO
NEO_CL_INTERP_RATIO_DEFAULT_STR,
#else
"2.0",
#endif
FCVAR_USERINFO | FCVAR_NOT_CONNECTED | FCVAR_ARCHIVE,
"Sets the interpolation amount (final amount is cl_interp_ratio / cl_updaterate)." )
{
Expand Down
55 changes: 34 additions & 21 deletions src/game/server/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,23 +565,6 @@ CBasePlayer *CBasePlayer::CreatePlayer( const char *className, edict_t *ed )
return player;
}

#ifdef NEO
template <class ConVarType=ConVar, typename T=float, auto& ConvertFunc=V_atof>
T GetConVarDefault(const char* name)
{
const auto* cvar = g_pCVar->FindVar(name);
if (!cvar)
{
Assert(false);
Warning( "%s failed to find var \"%s\"\n", __FUNCTION__, name);
return T{};
}
const auto* castCvar = assert_cast<const ConVarType*>(cvar);
const char* res = castCvar->GetDefault();
return ConvertFunc(res);
}
#endif

//-----------------------------------------------------------------------------
// Purpose:
// Input :
Expand Down Expand Up @@ -636,13 +619,43 @@ CBasePlayer::CBasePlayer( )

m_bPendingClientSettings = false;
#ifdef NEO
m_nUpdateRate = GetConVarDefault<ConVar_ServerBounded>("cl_updaterate");
Assert(m_nUpdateRate != 0);
m_fLerpTime = GetConVarDefault<ConVar_ServerBounded>("cl_interp_ratio") / m_nUpdateRate;
m_nUpdateRate = 0;
if (auto sv_maxupdaterate = g_pCVar->FindVar("sv_maxupdaterate"))
{
m_nUpdateRate = V_atoi(sv_maxupdaterate->GetDefault());
}
if (m_nUpdateRate == 0)
{
m_nUpdateRate = 66; // as changed in #1657
Assert(false);
}
m_fLerpTime = NEO_CL_INTERP_RATIO_DEFAULT / m_nUpdateRate;

#ifdef DBGFLAG_ASSERT
if (auto sv_client_min_interp_ratio = g_pCVar->FindVar("sv_client_min_interp_ratio"))
{
const float defaultMin = V_atof(sv_client_min_interp_ratio->GetDefault());
Assert(NEO_CL_INTERP_RATIO_DEFAULT >= defaultMin);
}
else
{
Assert(false);
}

if (auto sv_client_max_interp_ratio = g_pCVar->FindVar("sv_client_max_interp_ratio"))
{
const float defaultMax = V_atof(sv_client_max_interp_ratio->GetDefault());
Assert(NEO_CL_INTERP_RATIO_DEFAULT <= defaultMax);
}
else
{
Assert(false);
}
#endif // DBGFLAG_ASSERT
#else
m_nUpdateRate = 20; // cl_updaterate defualt
m_fLerpTime = 0.1f; // cl_interp default
#endif
#endif // NEO
m_bPredictWeapons = true;
m_bRequestPredict = true;
m_bLagCompensation = false;
Expand Down
10 changes: 10 additions & 0 deletions src/game/shared/neo/neo_player_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ COMPILE_TIME_ASSERT(NEO_ASSAULT_CROUCH_SPEED == NEO_VIP_CROUCH_SPEED);
#define NEO_ASSAULT_PLAYERMODEL_HEIGHT 67.0
#define NEO_ASSAULT_PLAYERMODEL_DUCK_HEIGHT 50.0

#define NEO_CL_INTERP_RATIO_DEFAULT 2.0
static_assert(NEO_CL_INTERP_RATIO_DEFAULT > 0);
#ifndef xstr
#define xstr(a) str(a)
#endif
#ifndef str
#define str(a) #a
#endif
#define NEO_CL_INTERP_RATIO_DEFAULT_STR xstr(NEO_CL_INTERP_RATIO_DEFAULT)

static constexpr int MAX_HEALTH_FOR_CLASS[NEO_CLASS__ENUM_COUNT] = {
100, // RECON
120, // ASSAULT
Expand Down
Loading