mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
- consolidated the movement block check after discovering that it wasn't handling things properly for all games.
This commit is contained in:
parent
47a0b14b43
commit
ba69084aa5
6 changed files with 42 additions and 29 deletions
|
@ -233,5 +233,6 @@ void nonsharedkeys(void);
|
||||||
void apply_seasick(player_struct* p, double scalefactor);
|
void apply_seasick(player_struct* p, double scalefactor);
|
||||||
void calcviewpitch(player_struct* p, double factor);
|
void calcviewpitch(player_struct* p, double factor);
|
||||||
void sethorizon(int snum, int sb_snum, double factor, bool frominput = false);
|
void sethorizon(int snum, int sb_snum, double factor, bool frominput = false);
|
||||||
|
bool movementBlocked(int snum);
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -950,6 +950,38 @@ void playerAimDown(int snum, ESyncBits sb_snum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// split out so that the weapon check can be done right.
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool movementBlocked(int snum)
|
||||||
|
{
|
||||||
|
auto p = &ps[snum];
|
||||||
|
|
||||||
|
auto blockingweapon = [=]()
|
||||||
|
{
|
||||||
|
if (isRR()) return false;
|
||||||
|
if (isWW2GI()) return aplWeaponWorksLike[p->curr_weapon][snum] == TRIPBOMB_WEAPON;
|
||||||
|
else return p->curr_weapon == TRIPBOMB_WEAPON;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto weapondelay = [=]()
|
||||||
|
{
|
||||||
|
if (isWW2GI()) return aplWeaponFireDelay[p->curr_weapon][snum];
|
||||||
|
else return 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (p->fist_incs ||
|
||||||
|
p->transporter_hold > 2 ||
|
||||||
|
p->hard_landing ||
|
||||||
|
p->access_incs > 0 ||
|
||||||
|
p->knee_incs > 0 ||
|
||||||
|
(blockingweapon() && p->kickback_pic > 1 && p->kickback_pic < weapondelay()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -2789,13 +2789,7 @@ void processinput_d(int snum)
|
||||||
|
|
||||||
//Do the quick lefts and rights
|
//Do the quick lefts and rights
|
||||||
|
|
||||||
if (p->fist_incs ||
|
if (movementBlocked(snum))
|
||||||
p->transporter_hold > 2 ||
|
|
||||||
p->hard_landing ||
|
|
||||||
p->access_incs > 0 ||
|
|
||||||
p->knee_incs > 0 ||
|
|
||||||
(((!isWW2GI() && p->curr_weapon == TRIPBOMB_WEAPON) || (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == TRIPBOMB_WEAPON)) &&
|
|
||||||
p->kickback_pic > 1 && p->kickback_pic < 4))
|
|
||||||
{
|
{
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->posxv = 0;
|
p->posxv = 0;
|
||||||
|
|
|
@ -3698,11 +3698,7 @@ void processinput_r(int snum)
|
||||||
|
|
||||||
//Do the quick lefts and rights
|
//Do the quick lefts and rights
|
||||||
|
|
||||||
if (p->fist_incs ||
|
if (movementBlocked(snum))
|
||||||
p->transporter_hold > 2 ||
|
|
||||||
p->hard_landing ||
|
|
||||||
p->access_incs > 0 ||
|
|
||||||
p->knee_incs > 0)
|
|
||||||
{
|
{
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->posxv = 0;
|
p->posxv = 0;
|
||||||
|
|
|
@ -394,14 +394,7 @@ void fakedomovethings(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p->fist_incs ||
|
if (movementBlocked(snum) || myhardlanding)
|
||||||
p->transporter_hold > 2 ||
|
|
||||||
myhardlanding ||
|
|
||||||
p->access_incs > 0 ||
|
|
||||||
p->knee_incs > 0 ||
|
|
||||||
(p->curr_weapon == TRIPBOMB_WEAPON &&
|
|
||||||
p->kickback_pic > 1 &&
|
|
||||||
p->kickback_pic < 4 ) )
|
|
||||||
{
|
{
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
myxvel = 0;
|
myxvel = 0;
|
||||||
|
|
|
@ -63,23 +63,20 @@ enum inputlock_t
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static int P_CheckLockedMovement(int const playerNum)
|
static int P_CheckLockedMovement(int snum)
|
||||||
{
|
{
|
||||||
auto const pPlayer = &ps[playerNum];
|
auto p = &ps[snum];
|
||||||
|
|
||||||
if (sprite[pPlayer->i].extra <= 0 || (pPlayer->dead_flag && !ud.god) || pPlayer->fist_incs || pPlayer->transporter_hold > 2 || pPlayer->hard_landing || pPlayer->access_incs > 0
|
if (sprite[p->i].extra <= 0 || (p->dead_flag && !ud.god) || movementBlocked(snum))
|
||||||
|| 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)))
|
|
||||||
return IL_NOTHING;
|
return IL_NOTHING;
|
||||||
|
|
||||||
if (pPlayer->on_crane >= 0)
|
if (p->on_crane >= 0)
|
||||||
return IL_NOMOVE | IL_NOANGLE;
|
return IL_NOMOVE | IL_NOANGLE;
|
||||||
|
|
||||||
if (pPlayer->newowner != -1)
|
if (p->newowner != -1)
|
||||||
return IL_NOANGLE | IL_NOHORIZ;
|
return IL_NOANGLE | IL_NOHORIZ;
|
||||||
|
|
||||||
if (pPlayer->return_to_center > 0)
|
if (p->return_to_center > 0)
|
||||||
return IL_NOHORIZ;
|
return IL_NOHORIZ;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue