- SW: Process weapon bits within the ticker and not the input handler.

This commit is contained in:
Mitchell Richters 2023-03-18 13:23:19 +11:00
parent a4f0a75a58
commit b1888a44c3
2 changed files with 11 additions and 8 deletions

View file

@ -77,13 +77,13 @@ enum
//
//---------------------------------------------------------------------------
static void processWeapon(PLAYER* const pp)
void processWeapon(PLAYER* const pp)
{
DSWActor* plActor = pp->actor;
if (plActor == nullptr) return;
int i;
if (loc.getNewWeapon() == WeaponSel_Next)
if (pp->input.getNewWeapon() == WeaponSel_Next)
{
int next_weapon = plActor->user.WeaponNum + 1;
int start_weapon;
@ -116,9 +116,9 @@ static void processWeapon(PLAYER* const pp)
}
}
loc.setNewWeapon(next_weapon + 1);
pp->input.setNewWeapon(next_weapon + 1);
}
else if (loc.getNewWeapon() == WeaponSel_Prev)
else if (pp->input.getNewWeapon() == WeaponSel_Prev)
{
int prev_weapon = plActor->user.WeaponNum - 1;
int start_weapon;
@ -148,12 +148,12 @@ static void processWeapon(PLAYER* const pp)
}
}
}
loc.setNewWeapon(prev_weapon + 1);
pp->input.setNewWeapon(prev_weapon + 1);
}
else if (loc.getNewWeapon() == WeaponSel_Alt)
else if (pp->input.getNewWeapon() == WeaponSel_Alt)
{
int which_weapon = plActor->user.WeaponNum + 1;
loc.setNewWeapon(which_weapon);
pp->input.setNewWeapon(which_weapon);
}
}
@ -174,7 +174,6 @@ void GameInterface::GetInput(const double scaleAdjust, InputPacket *packet)
ApplyGlobalInput(loc, &hidInput);
processMovement(&input, &loc, &hidInput, scaleAdjust, 0, !pp->sop, pp->sop_control ? 3. / 1.40625 : 1.);
processWeapon(pp);
if (!SyncInput())
{

View file

@ -173,6 +173,7 @@ int GetOverlapSector2(const DVector2& pos, sectortype** over, sectortype** under
void PlayerToRemote(PLAYER* pp);
void PlayerRemoteInit(PLAYER* pp);
void PlayerSpawnPosition(PLAYER* pp);
void processWeapon(PLAYER* const pp);
extern short target_ang;
@ -6944,6 +6945,9 @@ void domovethings(void)
}
}
// process weapon bits
processWeapon(pp);
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{