From fe57af38769af653fa6935f7a52896e13db0fb75 Mon Sep 17 00:00:00 2001 From: mikota Date: Wed, 5 Jul 2023 07:52:55 +0200 Subject: [PATCH] Tweaked SMG values(+acc), added cvars guns_recoil_strength, guns_random_recoil_direction, guns_movement_inaccuracy, guns_firing_inaccuracy --- src/shared/w_deagle.qc | 4 ++-- src/shared/w_mac10.qc | 6 +++--- src/shared/w_mp5.qc | 2 +- src/shared/w_tmp.qc | 4 ++-- src/shared/weapons_cstrike.qc | 36 ++++++++++++++++++++++++----------- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/shared/w_deagle.qc b/src/shared/w_deagle.qc index 67192b5..b1178b9 100644 --- a/src/shared/w_deagle.qc +++ b/src/shared/w_deagle.qc @@ -150,7 +150,7 @@ w_deagle_primary(player pl) return; - float accuracy = Cstrike_CalculateAccuracy(pl, 30,2.2)+0.005; + float accuracy = Cstrike_CalculateAccuracy(pl, 25,2.2)+0.005; int dmg; pl.deagle_mag--; @@ -186,7 +186,7 @@ w_deagle_primary(player pl) Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire"); #endif - Cstrike_ShotMultiplierAdd(pl, 30, .3); + Cstrike_ShotMultiplierAdd(pl, 20, .25); pl.gflags |= GF_SEMI_TOGGLED; pl.w_attack_next = 0.2f; pl.w_idle_next = pl.w_attack_next; diff --git a/src/shared/w_mac10.qc b/src/shared/w_mac10.qc index b2dbaf6..9ffd6ed 100644 --- a/src/shared/w_mac10.qc +++ b/src/shared/w_mac10.qc @@ -118,7 +118,7 @@ w_mac10_primary(player pl) } - float accuracy = Cstrike_CalculateAccuracy(pl, 80,0.9)+0.011; + float accuracy = Cstrike_CalculateAccuracy(pl, 80,0.7)+0.009f; pl.mac10_mag--; int r = (float)input_sequence % 3; @@ -146,9 +146,9 @@ w_mac10_primary(player pl) dmg = Skill_GetValue("plr_mac10_dmg", 29); TraceAttack_SetRangeModifier(1.25); /* 9, but not 10 */ TraceAttack_SetPenetrationPower(1); - g_CstrikeBulletRecoil.ApplyPre(pl,1.2); + g_CstrikeBulletRecoil.ApplyPre(pl,1.125); TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_MAC10, "Impact.BigShot"); - g_CstrikeBulletRecoil.ApplyPost(pl,1.2); + g_CstrikeBulletRecoil.ApplyPost(pl,1.125); Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire"); #endif diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index 2eac37d..ad1cecc 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -116,7 +116,7 @@ w_mp5_primary(player pl) return; - float accuracy = Cstrike_CalculateAccuracy(pl,100,1)+0.0065f; + float accuracy = Cstrike_CalculateAccuracy(pl,100,1)+0.004f; pl.mp5_mag--; int r = (float)input_sequence % 3; diff --git a/src/shared/w_tmp.qc b/src/shared/w_tmp.qc index 41557b8..b1169d4 100644 --- a/src/shared/w_tmp.qc +++ b/src/shared/w_tmp.qc @@ -116,7 +116,7 @@ w_tmp_primary(player pl) return; - float accuracy = Cstrike_CalculateAccuracy(pl, 40)+0.0085; + float accuracy = Cstrike_CalculateAccuracy(pl, 30,0.8)+0.0035; pl.tmp_mag--; int r = (float)input_sequence % 3; @@ -150,7 +150,7 @@ w_tmp_primary(player pl) Sound_Play(pl, CHAN_WEAPON, "weapon_tmp.fire"); #endif - Cstrike_ShotMultiplierAdd(pl, 0.7, 1.25); + Cstrike_ShotMultiplierAdd(pl, 0.8, 1.35); pl.w_attack_next = 0.07f; pl.w_idle_next = pl.w_attack_next; } diff --git a/src/shared/weapons_cstrike.qc b/src/shared/weapons_cstrike.qc index b202bf2..91241da 100644 --- a/src/shared/weapons_cstrike.qc +++ b/src/shared/weapons_cstrike.qc @@ -28,6 +28,11 @@ * to other weapons. */ +var float autocvar_guns_recoil_strength = 1.0f; +var bool autocvar_guns_random_recoil_direction = TRUE; +var float autocvar_guns_movement_inaccuracy = 1.0f; +var float autocvar_guns_firing_inaccuracy = 1.0f; + weapontype_t csweapon_ranged_type(player pl) { @@ -63,16 +68,20 @@ Cstrike_ShotMultiplierAdd(player pl, int shots, float strength) if (pl.cs_shotmultiplier < 1.6) { pl.cs_prev_hor_rec = 0; - if (pseudorandom() > 0.5) { - pl.cs_hor_rec_sign = 1; - } else { + pl.cs_hor_rec_sign = 1; + if (autocvar_guns_random_recoil_direction && pseudorandom() >= 0.5) { pl.cs_hor_rec_sign = -1; } } - if (pseudorandom() > 0.83) { - pl.cs_hor_rec_sign = -pl.cs_hor_rec_sign; + if (autocvar_guns_random_recoil_direction == 1) { + if (pseudorandom() > 0.83) { + pl.cs_hor_rec_sign = -pl.cs_hor_rec_sign; + } + } else { + if ( pl.cs_shotmultiplier > 9) { + pl.cs_hor_rec_sign = -1; + } } - /* more than 12 is enough, you can barely hit the barn */ float new_shotmultiplier = pl.cs_shotmultiplier + 1.5 @@ -85,14 +94,17 @@ Cstrike_ShotMultiplierAdd(player pl, int shots, float strength) float movement_inaccuracy = bound(0.92,Cstrike_CalculateMovementInaccuracy(pl),1.25); pl.punchangle[0] = -(pl.cs_shotmultiplier)*0.3*movement_inaccuracy*strength+0.5; + pl.punchangle[0] *= autocvar_guns_recoil_strength; float hor_recoil = pl.cs_shotmultiplier*0.005 - + (pseudorandom() - 0.35)*0.75; + + (pseudorandom() - 0.35)*0.75*autocvar_guns_firing_inaccuracy; + + hor_recoil *= movement_inaccuracy * strength * autocvar_guns_recoil_strength; if (pl.cs_hor_rec_sign > 0) { - pl.cs_prev_hor_rec += hor_recoil*movement_inaccuracy*strength; + pl.cs_prev_hor_rec += hor_recoil; } else if (pl.cs_hor_rec_sign < 0) { - pl.cs_prev_hor_rec -= hor_recoil*movement_inaccuracy*strength; + pl.cs_prev_hor_rec -= hor_recoil; } pl.punchangle[1] = pl.cs_prev_hor_rec; r = (float)input_sequence % 5; @@ -133,11 +145,11 @@ Cstrike_CalculateAccuracy(player pl, float divisor, float movement_penalty=1) /* snipers shoot way less accurate overall. */ return (pl.viewzoom < 1.0f) ? (0.0f) : (0.05 * m); } else { - inacc = pl.cs_shotmultiplier*pl.cs_shotmultiplier; + inacc = pl.cs_shotmultiplier*pl.cs_shotmultiplier * autocvar_guns_firing_inaccuracy; inacc = inacc / divisor / 1000; inacc = inacc * m; if (m > 1) { - inacc += m * 0.0025*movement_penalty; + inacc += m * 0.0025*movement_penalty * autocvar_guns_movement_inaccuracy; } else { inacc += m * 0.0025; } @@ -151,9 +163,11 @@ class CstrikeBulletRecoil { public: void ApplyPre(player pl, float strength) { m_flRandomSpread = (pseudorandom() - 0.5) * 2.0; + strength *= autocvar_guns_recoil_strength; pl.v_angle += strength*pl.punchangle*(2 + pl.cs_shotmultiplier/100*(m_flRandomSpread-0.5)); }; void ApplyPost(player pl, float strength) { + strength *= autocvar_guns_recoil_strength; pl.v_angle -= strength*pl.punchangle*(2 + pl.cs_shotmultiplier/100*(m_flRandomSpread-0.5)); }; };