Skip to content

Commit d49ffef

Browse files
committed
unlikely optimization to host_timescale, add new violence control
1 parent bf46a4e commit d49ffef

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

engine/host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ void Host_AccumulateTime( float dt )
18961896
#if !defined(SWDS)
18971897
&& ( CanCheat() || demoplayer->IsPlayingBack() )
18981898
#endif
1899-
)
1899+
) [[unlikely]]
19001900
{
19011901
float fullscale = host_timescale.GetFloat();
19021902

engine/net_ws.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2960,10 +2960,14 @@ void NET_SetTime( double flRealtime )
29602960
}
29612961

29622962
// adjust network time so fakelag works with host_timescale
2963-
if (host_timescale.GetFloat() > 0)
2963+
if (host_timescale.GetFloat() > 0) [[unlikely]]
29642964
{
29652965
net_time += frametime * host_timescale.GetFloat();
29662966
}
2967+
else
2968+
{
2969+
net_time += frametime;
2970+
}
29672971
}
29682972

29692973
/*

game/client/tf/c_tf_player.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ END_RECV_TABLE()
619619
// Client ragdoll entity.
620620
// ----------------------------------------------------------------------------- //
621621
ConVar cl_ragdoll_physics_enable( "cl_ragdoll_physics_enable", "1", 0, "Enable/disable ragdoll physics." );
622+
ConVar cl_ragdoll_disable("cl_ragdoll_disable", "0", 0, "Disable spawning ragdolls/gibs.");
622623
ConVar cl_ragdoll_fade_time( "cl_ragdoll_fade_time", "15", FCVAR_CLIENTDLL );
623624
ConVar cl_ragdoll_forcefade( "cl_ragdoll_forcefade", "0", FCVAR_CLIENTDLL );
624625
ConVar cl_ragdoll_pronecheck_distance( "cl_ragdoll_pronecheck_distance", "64", FCVAR_GAMEDLL );
@@ -1406,6 +1407,11 @@ void C_TFRagdoll::OnDataChanged( DataUpdateType_t type )
14061407

14071408
if ( type == DATA_UPDATE_CREATED )
14081409
{
1410+
if (cl_ragdoll_disable.GetBool())
1411+
{
1412+
return;
1413+
}
1414+
14091415
bool bCreateRagdoll = true;
14101416

14111417
// Get the player.
@@ -1513,7 +1519,7 @@ void C_TFRagdoll::OnDataChanged( DataUpdateType_t type )
15131519
}
15141520
else
15151521
{
1516-
if ( !cl_ragdoll_physics_enable.GetBool() )
1522+
if ( !cl_ragdoll_physics_enable.GetBool() || cl_ragdoll_disable.GetBool() )
15171523
{
15181524
// Don't let it set us back to a ragdoll with data from the server.
15191525
m_nRenderFX = kRenderFxNone;

game/client/tf/tf_fx_blood.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@
2323
#include "c_basetempentity.h"
2424
#include "tier0/vprof.h"
2525

26+
static ConVar tf_fx_blood("tf_fx_blood", "1", 0, "Whether to spawn blood impact particle effects.");
27+
2628
//-----------------------------------------------------------------------------
2729
// Purpose: Intercepts the blood spray message.
2830
//-----------------------------------------------------------------------------
2931
void TFBloodSprayCallback( Vector vecOrigin, Vector vecNormal, ClientEntityHandle_t hEntity )
3032
{
33+
if (!tf_fx_blood.GetBool())
34+
{
35+
return;
36+
}
37+
3138
QAngle vecAngles;
3239
VectorAngles( -vecNormal, vecAngles );
3340

@@ -113,7 +120,6 @@ void TFBloodSprayCallback( Vector vecOrigin, Vector vecNormal, ClientEntityHandl
113120

114121
if ( flDistance < 400 )
115122
{
116-
117123
DispatchParticleEffect( UTIL_IsLowViolence() ? "lowV_blood_spray_red_01" : "blood_spray_red_01", vecOrigin, vecAngles, pPlayer );
118124
}
119125
else

0 commit comments

Comments
 (0)