Fix m_flAccuracy calculation (#677)

* weapons.h: Add `*_ACCURACY_DIVISOR` constants

* fix `m_flAccuracy` spray calculation
This commit is contained in:
Sergey Shorokhov 2021-09-13 15:28:43 +03:00 committed by GitHub
parent bb97adefed
commit 667242fadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 72 additions and 12 deletions

View File

@ -581,6 +581,11 @@ const float MP5N_MAX_SPEED = 250.0f;
const float MP5N_DAMAGE = 26.0f;
const float MP5N_RANGE_MODIFER = 0.84f;
const float MP5N_RELOAD_TIME = 2.63f;
#ifdef REGAMEDLL_FIXES
const float MP5N_ACCURACY_DIVISOR = 220.1f;
#else
const double MP5N_ACCURACY_DIVISOR = 220.1;
#endif
enum mp5n_e
{
@ -629,6 +634,11 @@ const float SG552_MAX_SPEED_ZOOM = 200.0f;
const float SG552_DAMAGE = 33.0f;
const float SG552_RANGE_MODIFER = 0.955f;
const float SG552_RELOAD_TIME = 3.0f;
#ifdef REGAMEDLL_FIXES
const float SG552_ACCURACY_DIVISOR = 220.0f;
#else
const int SG552_ACCURACY_DIVISOR = 220;
#endif
enum sg552_e
{
@ -677,6 +687,11 @@ const float AK47_MAX_SPEED = 221.0f;
const float AK47_DAMAGE = 36.0f;
const float AK47_RANGE_MODIFER = 0.98f;
const float AK47_RELOAD_TIME = 2.45f;
#ifdef REGAMEDLL_FIXES
const float AK47_ACCURACY_DIVISOR = 200.0f;
#else
const int AK47_ACCURACY_DIVISOR = 200;
#endif
enum ak47_e
{
@ -725,6 +740,11 @@ const float AUG_MAX_SPEED = 240.0f;
const float AUG_DAMAGE = 32.0f;
const float AUG_RANGE_MODIFER = 0.96f;
const float AUG_RELOAD_TIME = 3.3f;
#ifdef REGAMEDLL_FIXES
const float AUG_ACCURACY_DIVISOR = 215.0f;
#else
const int AUG_ACCURACY_DIVISOR = 215;
#endif
enum aug_e
{
@ -1218,6 +1238,11 @@ const float M249_MAX_SPEED = 220.0f;
const float M249_DAMAGE = 32.0f;
const float M249_RANGE_MODIFER = 0.97f;
const float M249_RELOAD_TIME = 4.7f;
#ifdef REGAMEDLL_FIXES
const float M249_ACCURACY_DIVISOR = 175.0f;
#else
const int M249_ACCURACY_DIVISOR = 175;
#endif
enum m249_e
{
@ -1313,6 +1338,11 @@ const float M4A1_DAMAGE_SIL = 33.0f;
const float M4A1_RANGE_MODIFER = 0.97f;
const float M4A1_RANGE_MODIFER_SIL = 0.95f;
const float M4A1_RELOAD_TIME = 3.05f;
#ifdef REGAMEDLL_FIXES
const float M4A1_ACCURACY_DIVISOR = 220.0f;
#else
const int M4A1_ACCURACY_DIVISOR = 220;
#endif
enum m4a1_e
{
@ -1373,6 +1403,11 @@ const float MAC10_MAX_SPEED = 250.0f;
const float MAC10_DAMAGE = 29.0f;
const float MAC10_RANGE_MODIFER = 0.82f;
const float MAC10_RELOAD_TIME = 3.15f;
#ifdef REGAMEDLL_FIXES
const float MAC10_ACCURACY_DIVISOR = 200.0f;
#else
const int MAC10_ACCURACY_DIVISOR = 200;
#endif
enum mac10_e
{
@ -1485,6 +1520,11 @@ const float P90_MAX_SPEED = 245.0f;
const float P90_DAMAGE = 21.0f;
const float P90_RANGE_MODIFER = 0.885f;
const float P90_RELOAD_TIME = 3.4f;
#ifdef REGAMEDLL_FIXES
const float P90_ACCURACY_DIVISOR = 175.0f;
#else
const int P90_ACCURACY_DIVISOR = 175;
#endif
enum p90_e
{
@ -1627,6 +1667,11 @@ const float TMP_MAX_SPEED = 250.0f;
const float TMP_DAMAGE = 20.0f;
const float TMP_RANGE_MODIFER = 0.85f;
const float TMP_RELOAD_TIME = 2.12f;
#ifdef REGAMEDLL_FIXES
const float TMP_ACCURACY_DIVISOR = 200.0f;
#else
const int TMP_ACCURACY_DIVISOR = 200;
#endif
enum tmp_e
{
@ -1830,6 +1875,11 @@ const float UMP45_MAX_SPEED = 250.0f;
const float UMP45_DAMAGE = 30.0f;
const float UMP45_RANGE_MODIFER = 0.82f;
const float UMP45_RELOAD_TIME = 3.5f;
#ifdef REGAMEDLL_FIXES
const float UMP45_ACCURACY_DIVISOR = 210.0f;
#else
const int UMP45_ACCURACY_DIVISOR = 210;
#endif
enum ump45_e
{
@ -1923,6 +1973,11 @@ const float GALIL_MAX_SPEED = 240.0f;
const float GALIL_DAMAGE = 30.0f;
const float GALIL_RANGE_MODIFER = 0.98f;
const float GALIL_RELOAD_TIME = 2.45f;
#ifdef REGAMEDLL_FIXES
const float GALIL_ACCURACY_DIVISOR = 200.0f;
#else
const int GALIL_ACCURACY_DIVISOR = 200;
#endif
enum galil_e
{
@ -1973,6 +2028,11 @@ const float FAMAS_RELOAD_TIME = 3.3f;
const float FAMAS_DAMAGE = 30.0f;
const float FAMAS_DAMAGE_BURST = 34.0f;
const float FAMAS_RANGE_MODIFER = 0.96f;
#ifdef REGAMEDLL_FIXES
const float FAMAS_ACCURACY_DIVISOR = 215.0f;
#else
const int FAMAS_ACCURACY_DIVISOR = 215;
#endif
enum famas_e
{

View File

@ -94,7 +94,7 @@ void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / AK47_ACCURACY_DIVISOR) + 0.35f;
if (m_flAccuracy > 1.25f)
m_flAccuracy = 1.25f;

View File

@ -104,7 +104,7 @@ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 215) + 0.3f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / AUG_ACCURACY_DIVISOR) + 0.3f;
if (m_flAccuracy > 1.0f)
m_flAccuracy = 1.0f;

View File

@ -124,7 +124,7 @@ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = (m_iShotsFired * m_iShotsFired * m_iShotsFired / 215) + 0.3f;
m_flAccuracy = (m_iShotsFired * m_iShotsFired * m_iShotsFired / FAMAS_ACCURACY_DIVISOR) + 0.3f;
if (m_flAccuracy > 1.0f)
m_flAccuracy = 1.0f;

View File

@ -92,7 +92,7 @@ void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / GALIL_ACCURACY_DIVISOR) + 0.35f;
if (m_flAccuracy > 1.25f)
m_flAccuracy = 1.25f;

View File

@ -91,7 +91,7 @@ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 175) + 0.4f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / M249_ACCURACY_DIVISOR) + 0.4f;
if (m_flAccuracy > 0.9f)
m_flAccuracy = 0.9f;

View File

@ -137,7 +137,7 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / M4A1_ACCURACY_DIVISOR) + 0.3f;
if (m_flAccuracy > 1)
m_flAccuracy = 1;

View File

@ -84,7 +84,7 @@ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.6f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / MAC10_ACCURACY_DIVISOR) + 0.6f;
if (m_flAccuracy > 1.65f)
m_flAccuracy = 1.65f;

View File

@ -85,7 +85,7 @@ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 220.1) + 0.45f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / MP5N_ACCURACY_DIVISOR) + 0.45f;
if (m_flAccuracy > 0.75f)
m_flAccuracy = 0.75f;

View File

@ -92,7 +92,7 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = (m_iShotsFired * m_iShotsFired / 175) + 0.45f;
m_flAccuracy = (m_iShotsFired * m_iShotsFired / P90_ACCURACY_DIVISOR) + 0.45f;
if (m_flAccuracy > 1)
m_flAccuracy = 1;

View File

@ -103,7 +103,7 @@ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / SG552_ACCURACY_DIVISOR) + 0.3f;
if (m_flAccuracy > 1.0f)
m_flAccuracy = 1.0f;

View File

@ -84,7 +84,7 @@ void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.55f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / TMP_ACCURACY_DIVISOR) + 0.55f;
if (m_flAccuracy > 1.4f)
m_flAccuracy = 1.4f;

View File

@ -88,7 +88,7 @@ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 210) + 0.5f;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / UMP45_ACCURACY_DIVISOR) + 0.5f;
if (m_flAccuracy > 1.0f)
m_flAccuracy = 1.0f;