diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/cdll_bounded_cvars.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/cdll_bounded_cvars.cpp')
| -rw-r--r-- | mp/src/game/client/cdll_bounded_cvars.cpp | 288 |
1 files changed, 144 insertions, 144 deletions
diff --git a/mp/src/game/client/cdll_bounded_cvars.cpp b/mp/src/game/client/cdll_bounded_cvars.cpp index 90f17b44..0928b774 100644 --- a/mp/src/game/client/cdll_bounded_cvars.cpp +++ b/mp/src/game/client/cdll_bounded_cvars.cpp @@ -1,144 +1,144 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//===========================================================================//
-
-#include "cbase.h"
-#include "cdll_bounded_cvars.h"
-#include "convar_serverbounded.h"
-#include "tier0/icommandline.h"
-
-
-bool g_bForceCLPredictOff = false;
-
-// ------------------------------------------------------------------------------------------ //
-// cl_predict.
-// ------------------------------------------------------------------------------------------ //
-
-class CBoundedCvar_Predict : public ConVar_ServerBounded
-{
-public:
- CBoundedCvar_Predict() :
- ConVar_ServerBounded( "cl_predict",
- "1.0",
-#if defined(DOD_DLL) || defined(CSTRIKE_DLL)
- FCVAR_USERINFO | FCVAR_CHEAT,
-#else
- FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
-#endif
- "Perform client side prediction." )
- {
- }
-
- virtual float GetFloat() const
- {
- // Used temporarily for CS kill cam.
- if ( g_bForceCLPredictOff )
- return 0;
-
- static const ConVar *pClientPredict = g_pCVar->FindVar( "sv_client_predict" );
- if ( pClientPredict && pClientPredict->GetInt() != -1 )
- {
- // Ok, the server wants to control this value.
- return pClientPredict->GetFloat();
- }
- else
- {
- return GetBaseFloatValue();
- }
- }
-};
-
-static CBoundedCvar_Predict cl_predict_var;
-ConVar_ServerBounded *cl_predict = &cl_predict_var;
-
-
-
-// ------------------------------------------------------------------------------------------ //
-// cl_interp_ratio.
-// ------------------------------------------------------------------------------------------ //
-
-class CBoundedCvar_InterpRatio : public ConVar_ServerBounded
-{
-public:
- CBoundedCvar_InterpRatio() :
- ConVar_ServerBounded( "cl_interp_ratio",
- "2.0",
- FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
- "Sets the interpolation amount (final amount is cl_interp_ratio / cl_updaterate)." )
- {
- }
-
- virtual float GetFloat() const
- {
- static const ConVar *pMin = g_pCVar->FindVar( "sv_client_min_interp_ratio" );
- static const ConVar *pMax = g_pCVar->FindVar( "sv_client_max_interp_ratio" );
- if ( pMin && pMax && pMin->GetFloat() != -1 )
- {
- return clamp( GetBaseFloatValue(), pMin->GetFloat(), pMax->GetFloat() );
- }
- else
- {
- return GetBaseFloatValue();
- }
- }
-};
-
-static CBoundedCvar_InterpRatio cl_interp_ratio_var;
-ConVar_ServerBounded *cl_interp_ratio = &cl_interp_ratio_var;
-
-
-// ------------------------------------------------------------------------------------------ //
-// cl_interp
-// ------------------------------------------------------------------------------------------ //
-
-class CBoundedCvar_Interp : public ConVar_ServerBounded
-{
-public:
- CBoundedCvar_Interp() :
- ConVar_ServerBounded( "cl_interp",
- "0.1",
- FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
- "Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f )
- {
- }
-
- virtual float GetFloat() const
- {
- static const ConVar *pUpdateRate = g_pCVar->FindVar( "cl_updaterate" );
- static const ConVar *pMin = g_pCVar->FindVar( "sv_client_min_interp_ratio" );
- if ( pUpdateRate && pMin && pMin->GetFloat() != -1 )
- {
- return MAX( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() );
- }
- else
- {
- return GetBaseFloatValue();
- }
- }
-};
-
-static CBoundedCvar_Interp cl_interp_var;
-ConVar_ServerBounded *cl_interp = &cl_interp_var;
-
-float GetClientInterpAmount()
-{
- static const ConVar *pUpdateRate = g_pCVar->FindVar( "cl_updaterate" );
- if ( pUpdateRate )
- {
- // #define FIXME_INTERP_RATIO
- return MAX( cl_interp->GetFloat(), cl_interp_ratio->GetFloat() / pUpdateRate->GetFloat() );
- }
- else
- {
- if (!CommandLine()->FindParm("-hushasserts"))
- {
- AssertMsgOnce( false, "GetInterpolationAmount: can't get cl_updaterate cvar." );
- }
-
- return 0.1;
- }
-}
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#include "cbase.h" +#include "cdll_bounded_cvars.h" +#include "convar_serverbounded.h" +#include "tier0/icommandline.h" + + +bool g_bForceCLPredictOff = false; + +// ------------------------------------------------------------------------------------------ // +// cl_predict. +// ------------------------------------------------------------------------------------------ // + +class CBoundedCvar_Predict : public ConVar_ServerBounded +{ +public: + CBoundedCvar_Predict() : + ConVar_ServerBounded( "cl_predict", + "1.0", +#if defined(DOD_DLL) || defined(CSTRIKE_DLL) + FCVAR_USERINFO | FCVAR_CHEAT, +#else + FCVAR_USERINFO | FCVAR_NOT_CONNECTED, +#endif + "Perform client side prediction." ) + { + } + + virtual float GetFloat() const + { + // Used temporarily for CS kill cam. + if ( g_bForceCLPredictOff ) + return 0; + + static const ConVar *pClientPredict = g_pCVar->FindVar( "sv_client_predict" ); + if ( pClientPredict && pClientPredict->GetInt() != -1 ) + { + // Ok, the server wants to control this value. + return pClientPredict->GetFloat(); + } + else + { + return GetBaseFloatValue(); + } + } +}; + +static CBoundedCvar_Predict cl_predict_var; +ConVar_ServerBounded *cl_predict = &cl_predict_var; + + + +// ------------------------------------------------------------------------------------------ // +// cl_interp_ratio. +// ------------------------------------------------------------------------------------------ // + +class CBoundedCvar_InterpRatio : public ConVar_ServerBounded +{ +public: + CBoundedCvar_InterpRatio() : + ConVar_ServerBounded( "cl_interp_ratio", + "2.0", + FCVAR_USERINFO | FCVAR_NOT_CONNECTED, + "Sets the interpolation amount (final amount is cl_interp_ratio / cl_updaterate)." ) + { + } + + virtual float GetFloat() const + { + static const ConVar *pMin = g_pCVar->FindVar( "sv_client_min_interp_ratio" ); + static const ConVar *pMax = g_pCVar->FindVar( "sv_client_max_interp_ratio" ); + if ( pMin && pMax && pMin->GetFloat() != -1 ) + { + return clamp( GetBaseFloatValue(), pMin->GetFloat(), pMax->GetFloat() ); + } + else + { + return GetBaseFloatValue(); + } + } +}; + +static CBoundedCvar_InterpRatio cl_interp_ratio_var; +ConVar_ServerBounded *cl_interp_ratio = &cl_interp_ratio_var; + + +// ------------------------------------------------------------------------------------------ // +// cl_interp +// ------------------------------------------------------------------------------------------ // + +class CBoundedCvar_Interp : public ConVar_ServerBounded +{ +public: + CBoundedCvar_Interp() : + ConVar_ServerBounded( "cl_interp", + "0.1", + FCVAR_USERINFO | FCVAR_NOT_CONNECTED, + "Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f ) + { + } + + virtual float GetFloat() const + { + static const ConVar *pUpdateRate = g_pCVar->FindVar( "cl_updaterate" ); + static const ConVar *pMin = g_pCVar->FindVar( "sv_client_min_interp_ratio" ); + if ( pUpdateRate && pMin && pMin->GetFloat() != -1 ) + { + return MAX( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() ); + } + else + { + return GetBaseFloatValue(); + } + } +}; + +static CBoundedCvar_Interp cl_interp_var; +ConVar_ServerBounded *cl_interp = &cl_interp_var; + +float GetClientInterpAmount() +{ + static const ConVar *pUpdateRate = g_pCVar->FindVar( "cl_updaterate" ); + if ( pUpdateRate ) + { + // #define FIXME_INTERP_RATIO + return MAX( cl_interp->GetFloat(), cl_interp_ratio->GetFloat() / pUpdateRate->GetFloat() ); + } + else + { + if (!CommandLine()->FindParm("-hushasserts")) + { + AssertMsgOnce( false, "GetInterpolationAmount: can't get cl_updaterate cvar." ); + } + + return 0.1; + } +} + |