Skip to content

Commit

Permalink
Adjust gib's velocity limit according to sv_maxvelocity (#846)
Browse files Browse the repository at this point in the history
* Adjust gib's velocity limit according to sv_maxvelocity
* Gib max velocity adjusted to sv_maxvelocity
  • Loading branch information
dystopm authored Jul 14, 2023
1 parent 11d6b08 commit 8a8f348
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions regamedll/dlls/gib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ LINK_ENTITY_TO_CLASS(gib, CGib, CCSGib)
void CGib::LimitVelocity()
{
float length = pev->velocity.Length();
float topspeed = CVAR_GET_FLOAT("sv_maxvelocity") * 0.75f;

// ceiling at 1500. The gib velocity equation is not bounded properly. Rather than tune it
// ceiling at topspeed. The gib velocity equation is not bounded properly. Rather than tune it
// in 3 separate places again, I'll just limit it here.
if (length > 1500.0)
if (length > topspeed)
{
// This should really be sv_maxvelocity * 0.75 or something
pev->velocity = pev->velocity.Normalize() * 1500;
// DONE: This should really be sv_maxvelocity * 0.75 or something
pev->velocity = pev->velocity.Normalize() * topspeed;
}
}

Expand Down

0 comments on commit 8a8f348

Please sign in to comment.