Merge pull request #5 from dqus/pmove-clean-up

Pmove clean up
This commit is contained in:
Marco Cawthorne 2022-07-15 14:27:21 -07:00 committed by GitHub
commit 77a6b59bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -244,9 +244,9 @@ NSClientPlayer::Physics_WaterMove(void)
/* we've just exited water */
if (WaterLevel() != 3) {
if (m_flUnderwaterTime < time) {
Sound_Play(this, CHAN_BODY, "player.gasplight");
} else if (m_flUnderwaterTime < time + 9) {
Sound_Play(this, CHAN_BODY, "player.gaspheavy");
} else if (m_flUnderwaterTime < time + 9) {
Sound_Play(this, CHAN_BODY, "player.gasplight");
}
m_flUnderwaterTime = time + 12;
} else if (m_flUnderwaterTime < time) {
@ -299,7 +299,9 @@ NSClientPlayer::Physics_WaterMove(void)
float
NSClientPlayer::Physics_MaxSpeed(void)
{
return (GetFlags() & FL_CROUCHING) ? 135 : 270;
float maxspeed = serverkeyfloat("phy_maxspeed");
float desiredspeed = (GetFlags() & FL_CROUCHING) ? PMOVE_STEP_WALKSPEED : maxspeed;
return min(desiredspeed, maxspeed);
}
void

View File

@ -241,6 +241,10 @@ PMoveCustom_AccelFriction(float move_time, float premove, vector wish_dir, float
vecTemp[2] = 0;
flFriction = vlen(vecTemp);
/* Next few lines of code assumes self is using player's hull, however it could be a monster
who use differen hull size, therefore it is invalid, so we probably better of using mins/maxs,
on the other hand edge friction is probably not that important. */
// if the leading edge is over a dropoff, increase friction
vecTemp = self.origin + normalize(vecTemp) * 16 + [0,0,1] * PHY_HULL_MIN[2];
traceline(vecTemp, vecTemp + [0,0,-34], TRUE, self);
@ -592,6 +596,7 @@ PMoveCustom_RunPlayerPhysics(entity target)
self = oldself;
}
/* Next code assumes self is using player's hull, so it should not be used for monsters who use different hull size. */
void
PMoveCustom_RunCrouchPhysics(entity target)
{