Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix m_flAccuracy calculation #677

Merged
merged 2 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions regamedll/dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_ak47.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_aug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_famas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_galil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_m249.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_m4a1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_mac10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_mp5navy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_p90.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_sg552.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_tmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/wpn_shared/wpn_ump45.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down