- Duke: Pass the player_struct through to FinalizeInput() in line with other functions.

This commit is contained in:
Mitchell Richters 2021-01-02 11:04:03 +11:00
parent bcb838f3fb
commit 9833c94114
5 changed files with 10 additions and 13 deletions

View file

@ -233,7 +233,7 @@ void donewgame(MapRecord* map, int sk);
void startnewgame(MapRecord* map, int skill);
int playercolor2lookup(int color);
void PlayerColorChanged(void);
bool movementBlocked(int snum);
bool movementBlocked(player_struct *p);
void loadcons();
void recordoldspritepos();

View file

@ -767,12 +767,11 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
//
//---------------------------------------------------------------------------
static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle)
{
auto p = &ps[playerNum];
bool blocked = movementBlocked(playerNum) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god);
bool blocked = movementBlocked(p) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god);
if (blocked && ps[playerNum].newOwner == nullptr)
if (blocked && p->newOwner == nullptr)
{
// neutralize all movement when blocked or in automap follow mode
loc.fvel = loc.svel = 0;
@ -842,7 +841,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt);
}
FinalizeInput(myconnectindex, input, rrraVehicle);
FinalizeInput(p, input, rrraVehicle);
if (!SyncInput())
{

View file

@ -944,20 +944,18 @@ void playerAimDown(int snum, ESyncBits actions)
//
//---------------------------------------------------------------------------
bool movementBlocked(int snum)
bool movementBlocked(player_struct *p)
{
auto p = &ps[snum];
auto blockingweapon = [=]()
{
if (isRR()) return false;
if (isWW2GI()) return aplWeaponWorksLike[p->curr_weapon][snum] == TRIPBOMB_WEAPON;
if (isWW2GI()) return aplWeaponWorksLike[p->curr_weapon][p->i] == TRIPBOMB_WEAPON;
else return p->curr_weapon == TRIPBOMB_WEAPON;
};
auto weapondelay = [=]()
{
if (isWW2GI()) return aplWeaponFireDelay[p->curr_weapon][snum];
if (isWW2GI()) return aplWeaponFireDelay[p->curr_weapon][p->i];
else return 4;
};

View file

@ -2893,7 +2893,7 @@ void processinput_d(int snum)
//Do the quick lefts and rights
if (movementBlocked(snum))
if (movementBlocked(p))
{
doubvel = 0;
p->posxv = 0;

View file

@ -3646,7 +3646,7 @@ void processinput_r(int snum)
//Do the quick lefts and rights
if (movementBlocked(snum))
if (movementBlocked(p))
{
doubvel = 0;
p->posxv = 0;