diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index c66e6c79d..e33618567 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -137,16 +137,6 @@ inline bool PlayerUseItem(int pl, int num) return getPlayer(pl)->cmd.ucmd.isItemUsed(num - 1); } -inline double PlayerInputSideVel(int pl) -{ - return getPlayer(pl)->cmd.ucmd.vel.Y; -} - -inline double PlayerInputForwardVel(int pl) -{ - return getPlayer(pl)->cmd.ucmd.vel.X; -} - inline void clearfriction() { for (int i = 0; i != -1; i = connectpoint2[i]) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 5049b3f11..f07a57870 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1544,12 +1544,10 @@ void processinput_d(int snum) ESyncBits& actions = p->cmd.ucmd.actions; // Get strafe value before it's rotated by the angle. - const auto strafeVel = PlayerInputSideVel(snum); + const auto strafeVel = p->cmd.ucmd.vel.Y; constexpr auto maxVel = (117351124. / 10884538.); processinputvel(snum); - auto sb_fvel = PlayerInputForwardVel(snum); - auto sb_svel = PlayerInputSideVel(snum); auto psectp = p->cursector; if (psectp == nullptr) @@ -1743,7 +1741,7 @@ void processinput_d(int snum) } } - if (p->vel.X || p->vel.Y || sb_fvel || sb_svel) + if (p->vel.X || p->vel.Y || !p->cmd.ucmd.vel.XY().isZero()) { p->crack_time = CRACK_TIME; @@ -1783,8 +1781,7 @@ void processinput_d(int snum) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) doubvel <<= 1; - p->vel.X += sb_fvel * doubvel * (5. / 16.); - p->vel.Y += sb_svel * doubvel * (5. / 16.); + p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.); p->Angles.StrafeVel += strafeVel * doubvel * (5. / 16.); bool check; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 64e17ad8b..3e9c991d9 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2274,7 +2274,7 @@ void processinput_r(int snum) ESyncBits& actions = p->cmd.ucmd.actions; // Get strafe value before it's rotated by the angle. - const auto strafeVel = PlayerInputSideVel(snum); + const auto strafeVel = p->cmd.ucmd.vel.Y; constexpr auto maxVel = (117351124. / 10884538.); auto psectp = p->cursector; @@ -2288,8 +2288,6 @@ void processinput_r(int snum) } processinputvel(snum); - auto sb_fvel = PlayerInputForwardVel(snum); - auto sb_svel = PlayerInputSideVel(snum); if (psectp == nullptr) { @@ -2570,7 +2568,7 @@ void processinput_r(int snum) } } - if (p->vel.X || p->vel.Y || sb_fvel || sb_svel) + if (p->vel.X || p->vel.Y || !p->cmd.ucmd.vel.XY().isZero()) { p->crack_time = CRACK_TIME; @@ -2625,8 +2623,7 @@ void processinput_r(int snum) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) doubvel <<= 1; - p->vel.X += sb_fvel * doubvel * (5. / 16.); - p->vel.Y += sb_svel * doubvel * (5. / 16.); + p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.); p->Angles.StrafeVel += strafeVel * doubvel * (5. / 16.); if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)))) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 81165c682..a47b1d9ce 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -228,7 +228,7 @@ void checksectors_d(int snum) if (p->newOwner != nullptr) { - if (abs(PlayerInputSideVel(snum)) > 0.75 || abs(PlayerInputForwardVel(snum)) > 0.75) + if (abs(p->cmd.ucmd.vel.Y) > 0.75 || abs(p->cmd.ucmd.vel.X) > 0.75) { clearcameras(p); return;