Harsher (but also more compatible) player still deceleration.

(maaaaybe inspired by how Hands of Necromancy implemented it)
This commit is contained in:
Mari the Deer 2022-08-10 14:21:17 +02:00
commit 51c1580da9
2 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r285 \cu(Tue 9 Aug 18:00:51 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r285 \cu(2022-08-09 18:00:51)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r286 \cu(Wed 10 Aug 14:21:17 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r286 \cu(2022-08-10 14:21:17)\c-";

View file

@ -151,6 +151,7 @@ Class Demolitionist : PlayerPawn
+DONTMORPH;
+DONTDRAIN;
+DONTCORPSE;
-WINDTHRUST; // too heavy
}
private int GetRandom()
@ -1959,6 +1960,16 @@ Class Demolitionist : PlayerPawn
else sendtoground = false;
Super.CheckMoveUpDown();
}
private bool ShouldDecelerate( Sector s )
{
// check if we can apply fast decel while standing on this sector
// (important to not break certain intended vanilla effects)
if ( bWINDTHRUST && (s.special >= 40) && (s.special <= 51) )
return false; // wind
if ( (s.special == 84) || (s.special == 118) || (s.special >= 201) && (s.special <= 244) )
return false; // current
return true;
}
override void MovePlayer()
{
if ( !player || (player.mo != self) || (player.cheats&(CF_FROZEN|CF_TOTALLYFROZEN)) )
@ -2081,7 +2092,14 @@ Class Demolitionist : PlayerPawn
player.camera = player.mo;
}
}
else if ( player.onground ) vel *= .95; // quickly decelerate if we're not holding movement keys
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 75% reductrion)
double fact = clamp(floorsector.GetFriction(0)/1.2,.5,1.);
vel *= fact;
player.vel *= fact;
}
if ( abs(roll) > 0. ) A_SetRoll(roll+clamp(deltaangle(roll,0),-3.,3.),SPF_INTERPOLATE);
}
guideangle *= .9;