Use gpGlobals->interval_per_tick instead of DEFAULT_TICK_INTERVAL

This commit is contained in:
tyabus 2021-08-16 00:21:34 +06:00
parent 0d8dceea43
commit 7091e9b9eb
4 changed files with 8 additions and 8 deletions

View file

@ -177,7 +177,7 @@ void PhysicsLevelInit( void )
physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) ); physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) );
// 15 ms per tick // 15 ms per tick
// NOTE: Always run client physics at this rate - helps keep ragdolls stable // NOTE: Always run client physics at this rate - helps keep ragdolls stable
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : DEFAULT_TICK_INTERVAL ); physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : gpGlobals->interval_per_tick );
physenv->SetCollisionEventHandler( &g_Collisions ); physenv->SetCollisionEventHandler( &g_Collisions );
physenv->SetCollisionSolver( &g_Collisions ); physenv->SetCollisionSolver( &g_Collisions );

View file

@ -243,7 +243,7 @@ void CPhysicsHook::LevelInitPreEntity()
physenv->SetObjectEventHandler( &g_Collisions ); physenv->SetObjectEventHandler( &g_Collisions );
physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
// HL Game gravity, not real-world gravity // HL Game gravity, not real-world gravity
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) ); physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
g_PhysAverageSimTime = 0; g_PhysAverageSimTime = 0;
@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
float totalTime = 0.f; float totalTime = 0.f;
g_Collisions.BufferTouchEvents( true ); g_Collisions.BufferTouchEvents( true );
float full = engine->Time(); float full = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL ); physenv->Simulate( gpGlobals->interval_per_tick );
full = engine->Time() - full; full = engine->Time() - full;
float lastTime = full; float lastTime = full;
@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() ); PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
} }
float start = engine->Time(); float start = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL ); physenv->Simulate( gpGlobals->interval_per_tick );
float end = engine->Time(); float end = engine->Time();
float elapsed = end - start; float elapsed = end - start;

View file

@ -177,7 +177,7 @@ void PhysicsLevelInit( void )
physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) ); physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) );
// 15 ms per tick // 15 ms per tick
// NOTE: Always run client physics at this rate - helps keep ragdolls stable // NOTE: Always run client physics at this rate - helps keep ragdolls stable
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : DEFAULT_TICK_INTERVAL ); physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : gpGlobals->interval_per_tick );
physenv->SetCollisionEventHandler( &g_Collisions ); physenv->SetCollisionEventHandler( &g_Collisions );
physenv->SetCollisionSolver( &g_Collisions ); physenv->SetCollisionSolver( &g_Collisions );

View file

@ -243,7 +243,7 @@ void CPhysicsHook::LevelInitPreEntity()
physenv->SetObjectEventHandler( &g_Collisions ); physenv->SetObjectEventHandler( &g_Collisions );
physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
// HL Game gravity, not real-world gravity // HL Game gravity, not real-world gravity
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) ); physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
g_PhysAverageSimTime = 0; g_PhysAverageSimTime = 0;
@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
float totalTime = 0.f; float totalTime = 0.f;
g_Collisions.BufferTouchEvents( true ); g_Collisions.BufferTouchEvents( true );
float full = engine->Time(); float full = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL ); physenv->Simulate( gpGlobals->interval_per_tick );
full = engine->Time() - full; full = engine->Time() - full;
float lastTime = full; float lastTime = full;
@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() ); PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
} }
float start = engine->Time(); float start = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL ); physenv->Simulate( gpGlobals->interval_per_tick );
float end = engine->Time(); float end = engine->Time();
float elapsed = end - start; float elapsed = end - start;