Fix: 'fast fire glitch' at AUG/SG552 (#734)

* Fix 'fast fire glitch' at AUG/SG552

Bug is caused because of not checking his FOV in some conditions.

* refactoring

Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
RauliTop 2022-12-17 21:49:05 +01:00 committed by GitHub
parent 1c68cb0c98
commit 7caf748a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 14 deletions

View File

@ -78,21 +78,19 @@ void CAUG::SecondaryAttack()
void CAUG::PrimaryAttack() void CAUG::PrimaryAttack()
{ {
const float flCycleTime = (m_pPlayer->pev->fov == DEFAULT_FOV) ? 0.0825f : 0.135f;
if (!(m_pPlayer->pev->flags & FL_ONGROUND)) if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{ {
AUGFire(0.035 + (0.4 * m_flAccuracy), 0.0825, FALSE); AUGFire(0.035 + (0.4 * m_flAccuracy), flCycleTime, FALSE);
} }
else if (m_pPlayer->pev->velocity.Length2D() > 140) else if (m_pPlayer->pev->velocity.Length2D() > 140)
{ {
AUGFire(0.035 + (0.07 * m_flAccuracy), 0.0825, FALSE); AUGFire(0.035 + (0.07 * m_flAccuracy), flCycleTime, FALSE);
}
else if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
AUGFire(0.02 * m_flAccuracy, 0.0825, FALSE);
} }
else else
{ {
AUGFire(0.02 * m_flAccuracy, 0.135, FALSE); AUGFire(0.02 * m_flAccuracy, flCycleTime, FALSE);
} }
} }

View File

@ -77,21 +77,19 @@ void CSG552::SecondaryAttack()
void CSG552::PrimaryAttack() void CSG552::PrimaryAttack()
{ {
const float flCycleTime = (m_pPlayer->pev->fov == DEFAULT_FOV) ? 0.0825f : 0.135f;
if (!(m_pPlayer->pev->flags & FL_ONGROUND)) if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{ {
SG552Fire(0.035 + (0.45 * m_flAccuracy), 0.0825, FALSE); SG552Fire(0.035 + (0.45 * m_flAccuracy), flCycleTime, FALSE);
} }
else if (m_pPlayer->pev->velocity.Length2D() > 140) else if (m_pPlayer->pev->velocity.Length2D() > 140)
{ {
SG552Fire(0.035 + (0.075 * m_flAccuracy), 0.0825, FALSE); SG552Fire(0.035 + (0.075 * m_flAccuracy), flCycleTime, FALSE);
}
else if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
SG552Fire(0.02 * m_flAccuracy, 0.0825, FALSE);
} }
else else
{ {
SG552Fire(0.02 * m_flAccuracy, 0.135, FALSE); SG552Fire(0.02 * m_flAccuracy, flCycleTime, FALSE);
} }
} }