Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/game/shared/tf/tf_gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ConVar tf_resolve_stuck_players( "tf_resolve_stuck_players", "1", FCVAR_REPLICA
ConVar tf_scout_hype_mod( "tf_scout_hype_mod", "55", FCVAR_REPLICATED | FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY );
ConVar tf_max_charge_speed( "tf_max_charge_speed", "750", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY );
ConVar tf_parachute_gravity( "tf_parachute_gravity", "0.2f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Gravity while parachute is deployed" );
ConVar tf_parachute_maxspeed_xy( "tf_parachute_maxspeed_xy", "300.0f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Max XY Speed while Parachute is deployed" );
ConVar tf_parachute_maxspeed_xy( "tf_parachute_maxspeed_xy", "350.0f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Max XY Speed while Parachute is deployed", true, 0.f, false, 0.f );
ConVar tf_parachute_maxspeed_z( "tf_parachute_maxspeed_z", "-100.0f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Max Z Speed while Parachute is deployed" );
ConVar tf_parachute_maxspeed_onfire_z( "tf_parachute_maxspeed_onfire_z", "-100.0f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Max Z Speed when on Fire and Parachute is deployed" );
ConVar tf_parachute_aircontrol( "tf_parachute_aircontrol", "2.5f", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Multiplier for how much air control players have when Parachute is deployed" );
Expand Down Expand Up @@ -2628,14 +2628,19 @@ void CTFGameMovement::FullWalkMove()
mv->m_vecVelocity[2] = Max( mv->m_vecVelocity[2], m_pTFPlayer->m_Shared.InCond( TF_COND_BURNING ) ? tf_parachute_maxspeed_onfire_z.GetFloat() : tf_parachute_maxspeed_z.GetFloat() );

float flDrag = tf_parachute_maxspeed_xy.GetFloat();
// Instead of clamping, we'll dampen
float flSpeedX = abs( mv->m_vecVelocity[0] );
float flSpeedY = abs( mv->m_vecVelocity[1] );
float flReductionX = flSpeedX > flDrag ? ( flSpeedX - flDrag ) / 3.0f - 10.0f : 0;
float flReductionY = flSpeedY > flDrag ? ( flSpeedY - flDrag ) / 3.0f - 10.0f : 0;

mv->m_vecVelocity[0] = Clamp( mv->m_vecVelocity[0], -flDrag - flReductionX, flDrag + flReductionX );
mv->m_vecVelocity[1] = Clamp( mv->m_vecVelocity[1], -flDrag - flReductionY, flDrag + flReductionY );
float flSpeedXY = mv->m_vecVelocity.Length2D();
if ( flSpeedXY > 0.0f && flSpeedXY > flDrag )
{
// Instead of clamping, we'll dampen
float flReduction = ( flSpeedXY - flDrag ) / 3.0f - 10.0f;
float flMaxSpeed = Max( flDrag, flDrag + flReduction );
if ( flMaxSpeed >= 0.0f && flSpeedXY > flMaxSpeed )
{
float flScale = flMaxSpeed / flSpeedXY;
mv->m_vecVelocity[0] *= flScale;
mv->m_vecVelocity[1] *= flScale;
}
}
}

StartGravity();
Expand Down