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
6 changes: 5 additions & 1 deletion src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,15 +1276,19 @@ namespace game
}
if(crouching || d->crouching(true))
{
float zamt = zoff*curtime/float(PHYSMILLIS);
float crouchanimspeedscale = 0.35f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a game variable as requested


if(crouching)
{
// asymptoptic smoothing of crouch view height (smoother than linear interpolation)
float zamt = abs(d->height - zrad) * crouchanimspeedscale * zoff*curtime/float(PHYSMILLIS);
if(d->actiontime[AC_CROUCH] <= 0) d->actiontime[AC_CROUCH] = lastmillis;
if(d->height > zrad && ((d->height -= zamt) < zrad)) d->height = zrad;
else if(d->height < zrad && ((d->height += zamt) > zrad)) d->height = zrad;
}
else
{
float zamt = abs(d->height - d->zradius) * crouchanimspeedscale * zoff*curtime/float(PHYSMILLIS);
if(d->actiontime[AC_CROUCH] >= 0) d->actiontime[AC_CROUCH] = -lastmillis;
if(d->height < d->zradius && ((d->height += zamt) > d->zradius)) d->height = d->zradius;
else if(d->height > d->zradius && ((d->height -= zamt) < d->zradius)) d->height = d->zradius;
Expand Down