1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Update CSGO's GetTickInterval and tickrate related constants (#92)

This commit is contained in:
zer0.k 2021-08-06 11:00:00 +02:00 committed by GitHub
parent 274b37b998
commit 259877ec43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -925,17 +925,25 @@ void CServerGameDLL::DLLShutdown( void )
//-----------------------------------------------------------------------------
float CServerGameDLL::GetTickInterval( void ) const
{
float tickinterval = DEFAULT_TICK_INTERVAL;
float tickinterval = 1.0 / 29.97; // 0.03336666
if ( !engine->IsDedicatedServerForXbox() )
{
tickinterval = 1.0 / 30.0; // 0.03333333
if ( !engine->IsDedicatedServerForPS3() )
{
tickinterval = DEFAULT_TICK_INTERVAL;
}
}
// override if tick rate specified in command line
if ( CommandLine()->CheckParm( "-tickrate" ) )
{
float tickrate = CommandLine()->ParmValue( "-tickrate", 0 );
if ( tickrate > 10 )
tickinterval = 1.0f / tickrate;
if ( tickrate > 0 )
{
tickinterval = floorf((1.0f / tickrate) * 512.0 + 0.5) / 512.0;
}
tickinterval = clamp(tickinterval, MINIMUM_TICK_INTERVAL, MAXIMUM_TICK_INTERVAL);
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
@ -25,9 +25,9 @@
#define INVALID_STEAM_LOGGED_IN_ELSEWHERE "This Steam account is being used in another location\n"
// This is the default, see shareddefs.h for mod-specific value, which can override this
#define DEFAULT_TICK_INTERVAL (1.0f / 60.0f) // 16.666667 msec is the default
#define MINIMUM_TICK_INTERVAL (0.001)
#define MAXIMUM_TICK_INTERVAL (0.1)
#define DEFAULT_TICK_INTERVAL (1.0f / 64.0f) // 0.015625
#define MINIMUM_TICK_INTERVAL (1.0f / 128.0f) // 0.0078125
#define MAXIMUM_TICK_INTERVAL (1.0f / 20.48f) // 0.048828125
// This is the max # of players the engine can handle
// Note, must be power of 2