Tweak viewbob and deceleration.

This commit is contained in:
Mari the Deer 2022-12-28 21:31:00 +01:00
commit 22179fdcd8
2 changed files with 6 additions and 7 deletions

View file

@ -62,9 +62,8 @@ extend Class Demolitionist
}
// apply bobbing (formula adapted from Unreal)
oldbobtime = bobtime;
double vel2d = vel.xy.length();
if ( vel2d < .25 ) bobtime += .2/GameTicRate;
else bobtime += (.5+.8*min(vel2d/10.,3.))/GameTicRate;
double vel2d = vel.xy dot vel.xy;
bobtime += (1.25+.25*min(vel2d/100.,3.))/GameTicRate;
Vector2 bob = (sin(bobtime*180.),sin(bobtime*360.))*player.bob*.25;
if ( player.morphtics )
bob = (0.,0.);
@ -262,8 +261,8 @@ extend Class Demolitionist
else if ( player.onground && ShouldDecelerate(floorsector) )
{
// quickly decelerate if we're not holding movement keys
// (account for slippery floors, and assume approx .9 friction as "midpoint" for 85% reduction)
double fact = clamp(floorsector.GetFriction(0)*.95,.5,1.);
// (account for slippery floors, and assume approx .9 friction as "midpoint" for 70% reduction)
double fact = clamp(floorsector.GetFriction(0)*.8,.5,1.);
vel *= fact;
player.vel *= fact;
}