Skip to content

Commit e30a217

Browse files
committed
fix inconsistencies with ragdoll settings
g_ragdoll_fadespeed was not being used in TF2 ragdolls despite being used in other games fix cl_ragdoll_forcefade not working on the same frame if delay is 0 fix cosmetics not respecting ragdoll fade settings
1 parent 48f2dbd commit e30a217

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

src/game/client/tf/c_tf_player.cpp

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,9 @@ bool C_TFRagdoll::IsRagdollVisible()
16351635
#define DISSOLVE_FADE_OUT_START_TIME 2.0f
16361636
#define DISSOLVE_FADE_OUT_END_TIME 2.0f
16371637

1638+
extern ConVar g_ragdoll_lvfadespeed;
1639+
extern ConVar g_ragdoll_fadespeed;
1640+
16381641
void C_TFRagdoll::ClientThink( void )
16391642
{
16401643
SetNextClientThink( CLIENT_THINK_ALWAYS );
@@ -1776,9 +1779,16 @@ void C_TFRagdoll::ClientThink( void )
17761779
if ( m_bFadingOut == true )
17771780
{
17781781
int iAlpha = GetRenderColor().a;
1779-
int iFadeSpeed = 600.0f;
1782+
int iFadeSpeed = ( g_RagdollLVManager.IsLowViolence() ) ? g_ragdoll_lvfadespeed.GetInt() : g_ragdoll_fadespeed.GetInt();
17801783

1781-
iAlpha = MAX( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );
1784+
if (iFadeSpeed < 1)
1785+
{
1786+
iAlpha = 0;
1787+
}
1788+
else
1789+
{
1790+
iAlpha = MAX( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );
1791+
}
17821792

17831793
SetRenderMode( kRenderTransAlpha );
17841794
SetRenderColorA( iAlpha );
@@ -1797,15 +1807,22 @@ void C_TFRagdoll::ClientThink( void )
17971807
if ( cl_ragdoll_forcefade.GetBool() )
17981808
{
17991809
m_bFadingOut = true;
1800-
float flDelay = cl_ragdoll_fade_time.GetFloat() * 0.33f;
1801-
m_fDeathTime = gpGlobals->curtime + flDelay;
1802-
18031810
RemoveAllDecals();
1804-
}
18051811

1806-
// Fade out after the specified delay.
1807-
StartFadeOut( cl_ragdoll_fade_time.GetFloat() * 0.33f );
1808-
return;
1812+
float flDelay = cl_ragdoll_fade_time.GetFloat() * 0.33f;
1813+
if (flDelay > 0.01f)
1814+
{
1815+
m_fDeathTime = gpGlobals->curtime + flDelay;
1816+
return;
1817+
}
1818+
m_fDeathTime = -1;
1819+
}
1820+
else
1821+
{
1822+
// Fade out after the specified delay.
1823+
StartFadeOut( cl_ragdoll_fade_time.GetFloat() * 0.33f );
1824+
return;
1825+
}
18091826
}
18101827

18111828
// Remove us if our death time has passed.
@@ -8023,7 +8040,7 @@ void C_TFPlayer::DropWearable( C_TFWearable *pItem, const breakablepropparams_t
80238040
}
80248041

80258042
pEntity->m_nSkin = m_nSkin;
8026-
pEntity->StartFadeOut( 15.0f );
8043+
pEntity->StartFadeOut( cl_ragdoll_fade_time.GetFloat() );
80278044

80288045
IPhysicsObject *pPhysicsObject = pEntity->VPhysicsGetObject();
80298046
if ( !pPhysicsObject )

0 commit comments

Comments
 (0)