From e4add4956bfebcbeb8e9092de52934673c016fe2 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 29 Jan 2020 11:35:58 +0000 Subject: [PATCH] Factor conditions for locking player movement out into new P_CheckLockedMovement() function git-svn-id: https://svn.eduke32.com/eduke32@8539 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/player.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 8f0e5f1f9..6ed5729e0 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -2889,6 +2889,14 @@ enddisplayweapon: int32_t mouseyaxismode = -1; +static int P_CheckLockedMovement(int const playerNum) +{ + auto const pPlayer = g_player[playerNum].ps; + return (pPlayer->fist_incs || pPlayer->transporter_hold > 2 || pPlayer->hard_landing || pPlayer->access_incs > 0 || pPlayer->knee_incs > 0 + || (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == TRIPBOMB_WEAPON && pPlayer->kickback_pic > 1 + && pPlayer->kickback_pic < PWEAPON(playerNum, pPlayer->curr_weapon, FireDelay))); +} + void P_GetInput(int const playerNum) { auto const pPlayer = g_player[playerNum].ps; @@ -5145,9 +5153,7 @@ void P_ProcessInput(int playerNum) } } - if (pPlayer->fist_incs || pPlayer->transporter_hold > 2 || pPlayer->hard_landing || pPlayer->access_incs > 0 || - pPlayer->knee_incs > 0 || (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == TRIPBOMB_WEAPON && - *weaponFrame > 1 && *weaponFrame < PWEAPON(playerNum, pPlayer->curr_weapon, FireDelay))) + if (P_CheckLockedMovement(playerNum)) { velocityModifier = 0; pPlayer->vel.x = 0;