Finer handling of slippery floors (reduce steering/speedup based on friction).
+ Don't play first person footsteps unless there's actual movement input.
This commit is contained in:
parent
1c2d229dfb
commit
d46641593d
2 changed files with 13 additions and 7 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1094 \cu(Thu 18 Jan 01:49:44 CET 2024)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1094 \cu(2024-01-18 01:49:44)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1095 \cu(Thu 18 Jan 13:17:52 CET 2024)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1095 \cu(2024-01-18 13:17:52)\c-";
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ extend Class Demolitionist
|
|||
if ( player.morphtics )
|
||||
bob = (0.,0.);
|
||||
else if ( player.bob && !multiplayer && !(player.cheats&CF_CHASECAM)
|
||||
&& player.onground && !bNoGravity && (player.crouchdir != -1) )
|
||||
&& player.onground && !bNoGravity && (player.crouchdir != -1)
|
||||
&& (player.cmd.forwardmove|player.cmd.sidemove) )
|
||||
{
|
||||
// bob-based footsteps in first person
|
||||
int m = int(2.*M_PI+oldbobtime);
|
||||
|
|
@ -264,10 +265,10 @@ extend Class Demolitionist
|
|||
}
|
||||
else angle += player.cmd.yaw*(360./65536.);
|
||||
player.onground = (pos.z<=floorz)||bOnMobj||bMBFBouncer||(player.cheats&CF_NOCLIP2);
|
||||
let [friction, movefactor] = GetFriction();
|
||||
if ( player.cmd.forwardmove|player.cmd.sidemove )
|
||||
{
|
||||
double bobfactor;
|
||||
let [friction, movefactor] = GetFriction();
|
||||
bobfactor = (friction<ORIG_FRICTION)?movefactor:ORIG_FRICTION_FACTOR;
|
||||
if ( !player.onground && !bNoGravity )
|
||||
{
|
||||
|
|
@ -320,15 +321,20 @@ extend Class Demolitionist
|
|||
if ( (waterlevel > 1) || (maxspd <= 0.) ) vel.xy += accel;
|
||||
else
|
||||
{
|
||||
// factors for slippery floors (make steering harder)
|
||||
double fact1 = SWWMUtility.MapRange(.90625,.97265625,2.,1.,friction);
|
||||
fact1 = clamp(fact1,1.,2.);
|
||||
double fact2 = SWWMUtility.MapRange(.90625,.97265625,1.,4.,friction);
|
||||
fact2 = clamp(fact2,1.,4.);
|
||||
if ( CanCrouch() && (player.crouchfactor != 1) ) maxspd *= player.crouchfactor;
|
||||
double spd = vel.xy.length();
|
||||
// quicker speedup
|
||||
spdup = clamp(maxspd/max(.01,spd),1.,2.);
|
||||
spdup = clamp(maxspd/max(.01,spd),1.,fact1);
|
||||
vel.xy += accel*spdup;
|
||||
// additional steering + quicker slow down
|
||||
spd = vel.xy.length();
|
||||
if ( spd > maxspd ) spd -= (spd-maxspd)*.1;
|
||||
vel.xy = (vel.xy+accel).unit()*spd;
|
||||
vel.xy = (vel.xy*fact2+accel).unit()*spd;
|
||||
}
|
||||
player.vel += RotateVector(nmove,angle)*bobfactor*16.*spdup;
|
||||
}
|
||||
|
|
@ -359,7 +365,7 @@ extend Class Demolitionist
|
|||
// quickly decelerate if we're not holding movement keys
|
||||
// the default friction is mapped to a 70% reduction,
|
||||
// while slippery floors (above 95%) will have no reduction at all
|
||||
double fact = SWWMUtility.MapRange(.90625,.97265625,.7,1.,floorsector.GetFriction(0));
|
||||
double fact = SWWMUtility.MapRange(.90625,.97265625,.7,1.,friction);
|
||||
fact = clamp(fact,.6,1.); // ensure this doesn't go too far out of range (especially, prevent endless acceleration)
|
||||
vel *= fact;
|
||||
player.vel *= fact;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue