From 51c1580da9a9d055bb0853e81968f1e114dc2ae1 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Wed, 10 Aug 2022 14:21:17 +0200 Subject: [PATCH] Harsher (but also more compatible) player still deceleration. (maaaaybe inspired by how Hands of Necromancy implemented it) --- language.version | 4 ++-- zscript/swwm_player.zsc | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/language.version b/language.version index 75604080b..0dfb7598d 100644 --- a/language.version +++ b/language.version @@ -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-"; diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index c6a8857eb..ea44e80cc 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -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;