Skip to content
Merged
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
25 changes: 15 additions & 10 deletions src/game/shared/neo/neo_player_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,21 @@ namespace

bool CNEO_Player::IsMakingFootstepSounds(float* pVelRun, float* pSpeed, int* pLadder) const
{
// UpdateStepSound reads the out parameters even for a silent step, so they are written before any early return
const Vector& absVel = GetAbsVelocity();
const float speed = absVel.Length();
if (pSpeed) *pSpeed = speed;
const bool isOnLadder = (GetMoveType() == MOVETYPE_LADDER);
if (pLadder) *pLadder = isOnLadder;

float velwalk, velrun;
GetStepSoundVelocities(&velwalk, &velrun);
if (pVelRun) *pVelRun = velrun;

// Dead players make no footsteps. Other clients keep the speed a player died with until that player is an observer
if (m_lifeState != LIFE_ALIVE)
return false;

if (GetFlags() & (FL_FROZEN|FL_ATCONTROLS))
return false;

Expand All @@ -390,17 +405,7 @@ bool CNEO_Player::IsMakingFootstepSounds(float* pVelRun, float* pSpeed, int* pLa
if (!sv_footsteps.GetFloat())
return false;

const Vector& absVel = GetAbsVelocity();
const float speed = absVel.Length();
if (pSpeed) *pSpeed = speed;
const float groundspeed = absVel.AsVector2D().Length();
const bool isOnLadder = (GetMoveType() == MOVETYPE_LADDER);
if (pLadder) *pLadder = isOnLadder;

float velwalk, velrun;
GetStepSoundVelocities(&velwalk, &velrun);
if (pVelRun) *pVelRun = velrun;

bool onground = (GetFlags() & FL_ONGROUND);
bool movingalongground = (groundspeed > 0.0001f);
// Below this nothing plays, on a ladder or off. It catches drift that is not movement at all, such as being
Expand Down
Loading