Recoil rework v2

This commit is contained in:
mikota 2023-09-23 17:05:57 +02:00
parent c7711beca9
commit f905511d93
24 changed files with 100 additions and 70 deletions

View File

@ -158,6 +158,7 @@ class player:NSClientPlayer
PREDICTED_FLOAT(cs_shottime)
PREDICTED_FLOAT(cs_prev_hor_rec)
PREDICTED_INT(cs_hor_rec_sign)
PREDICTED_FLOAT(cs_rec_reverse_chance)
PREDICTED_FLOAT(anim_top)
PREDICTED_FLOAT(anim_top_time)
@ -424,6 +425,7 @@ player::ReceiveEntity(float flIsNew, float flChanged)
READENTITY_FLOAT(cs_shottime, PLAYER_CSTIMERS)
READENTITY_FLOAT(cs_prev_hor_rec, PLAYER_CSTIMERS)
READENTITY_BYTE(cs_hor_rec_sign, PLAYER_CSTIMERS)
READENTITY_FLOAT(cs_rec_reverse_chance, PLAYER_CSTIMERS)
if (flChanged & PLAYER_AMMO1 || flChanged & PLAYER_AMMO2 || flChanged & PLAYER_AMMO3) {
Weapons_AmmoUpdate(this);
HUD_AmmoNotify_Check(this);
@ -488,6 +490,7 @@ player::PredictPreFrame(void)
SAVE_STATE(cs_shottime)
SAVE_STATE(cs_prev_hor_rec)
SAVE_STATE(cs_hor_rec_sign)
SAVE_STATE(cs_rec_reverse_chance)
SAVE_STATE(anim_top)
SAVE_STATE(anim_top_time)
SAVE_STATE(anim_top_delay)
@ -550,6 +553,7 @@ player::PredictPostFrame(void)
ROLL_BACK(cs_shottime)
ROLL_BACK(cs_prev_hor_rec)
ROLL_BACK(cs_hor_rec_sign)
ROLL_BACK(cs_rec_reverse_chance)
ROLL_BACK(anim_top)
ROLL_BACK(anim_top_time)
ROLL_BACK(anim_top_delay)
@ -617,6 +621,7 @@ player::EvaluateEntity(void)
EVALUATE_FIELD(cs_shottime, PLAYER_CSTIMERS)
EVALUATE_FIELD(cs_prev_hor_rec, PLAYER_CSTIMERS)
EVALUATE_FIELD(cs_hor_rec_sign, PLAYER_CSTIMERS)
EVALUATE_FIELD(cs_rec_reverse_chance, PLAYER_CSTIMERS)
}
/*
@ -688,7 +693,7 @@ player::SendEntity(entity ePEnt, float flChanged)
SENDENTITY_FLOAT(cs_shottime, PLAYER_CSTIMERS)
SENDENTITY_FLOAT(cs_prev_hor_rec, PLAYER_CSTIMERS)
SENDENTITY_BYTE(cs_hor_rec_sign, PLAYER_CSTIMERS)
SENDENTITY_FLOAT(cs_rec_reverse_chance, PLAYER_CSTIMERS)
return (1);
}
#endif

View File

@ -153,7 +153,7 @@ w_ak47_primary(player pl)
}
float accuracy = Cstrike_CalculateAccuracy(pl, 110,2.5);
float accuracy = Cstrike_CalculateAccuracy(pl, 30,3)/1.5;
pl.ak47_mag--;
int r = (float)input_sequence % 3;
@ -181,13 +181,13 @@ w_ak47_primary(player pl)
dmg = Skill_GetValue("plr_ak47_dmg", 36);
TraceAttack_SetRangeModifier(2.375); /* 18 units!!! */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1);
Cstrike_BulletRecoil_ApplyPre(pl,1.2);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_AK47, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1);
Cstrike_BulletRecoil_ApplyPost(pl,1.2);
Sound_Play(pl, CHAN_WEAPON, "weapon_ak47.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1.5, 1.05);
Cstrike_ShotMultiplierAdd(pl, 1.1f, 0.92f,accuracy*0.5);
pl.w_attack_next = 0.0975f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -119,7 +119,7 @@ w_aug_primary(player pl)
}
float accuracy = Cstrike_CalculateAccuracy(pl, 45,3)*pl.viewzoom;
float accuracy = Cstrike_CalculateAccuracy(pl, 35,2);
pl.aug_mag--;
int r = (float)input_sequence % 3;
@ -153,7 +153,7 @@ w_aug_primary(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_aug.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 0.7f, 1.1f);
Cstrike_ShotMultiplierAdd(pl, 0.7f, 1.1f,accuracy);
if (pl.viewzoom == 1.0f) {
pl.w_attack_next = 0.0825f;
} else {

View File

@ -209,8 +209,9 @@ w_awp_primary(player pl)
return;
}
Cstrike_ShotMultiplierAdd(pl, 1, 1);
float accuracy = Cstrike_CalculateAccuracy(pl, -1);
pl.awp_mag--;
int r = (float)input_sequence % 3;
@ -243,6 +244,7 @@ w_awp_primary(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
pl.w_attack_next = 1.2f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -150,7 +150,7 @@ w_deagle_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl, 25,2.2)+0.005;
float accuracy = Cstrike_CalculateAccuracy(pl, 55,1.5)+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, 20, .25);
Cstrike_ShotMultiplierAdd(pl, 10, .35,accuracy*0.5);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.2f;
pl.w_idle_next = pl.w_attack_next;

View File

@ -257,7 +257,7 @@ w_elites_primary(player pl)
Cstrike_BulletRecoil_ApplyPost(pl,.9f);
Sound_Play(pl, CHAN_WEAPON, "weapon_elites.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 3, .85);
Cstrike_ShotMultiplierAdd(pl, 3, .85,accuracy);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.13f;
pl.w_idle_next = pl.w_attack_next;

View File

@ -156,7 +156,7 @@ w_fiveseven_primary(player pl)
Cstrike_BulletRecoil_ApplyPost(pl,0.5f);
Sound_Play(pl, CHAN_WEAPON, "weapon_fiveseven.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 10, .4);
Cstrike_ShotMultiplierAdd(pl, 10, .4,accuracy);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.155f;
pl.w_idle_next = pl.w_attack_next;

View File

@ -116,8 +116,9 @@ w_g3sg1_primary(player pl)
return;
}
Cstrike_ShotMultiplierAdd(pl, 1, 1);
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
pl.g3sg1_mag--;
int r = (float)input_sequence % 2;

View File

@ -134,6 +134,7 @@ w_glock18_primary(player pl)
if (!pl.glock18_mag)
return;
float accuracy = Cstrike_CalculateAccuracy(pl, (pl.mode_glock18) ? 75 : 120,1.2);
int shotcount = (pl.mode_glock18) ? 3 : 1;
int dmg = 0;
@ -143,7 +144,7 @@ w_glock18_primary(player pl)
for (int i = 0; i < shotcount; i ++) {
float accuracy = Cstrike_CalculateAccuracy(pl, (pl.mode_glock18) ? 75 : 120,1.2);
accuracy += 0.0035;
pl.glock18_mag--;
#ifdef SERVER
@ -192,7 +193,7 @@ w_glock18_primary(player pl)
}
#endif
Cstrike_ShotMultiplierAdd(pl, 2, .7);
Cstrike_ShotMultiplierAdd(pl, 2, .7,accuracy);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_idle_next = pl.w_attack_next + 1.0f;
}

View File

@ -206,7 +206,7 @@ w_m3_primary(player pl)
#endif
for (int i = 0; i < 9; i++) {
Cstrike_ShotMultiplierAdd(pl, 1, 1);
Cstrike_ShotMultiplierAdd(pl, 1, 1,1);
pl.punchangle[0] = -4 * (9 / 6);
#ifdef SERVER
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3, "Impact.BigShot");

View File

@ -134,7 +134,7 @@ w_m4a1_primary(player pl)
}
float accuracy = Cstrike_CalculateAccuracy(pl, 150, 3);
float accuracy = Cstrike_CalculateAccuracy(pl, 60, 3);
// accuracy += pl.cs_shotmultiplier*pl.cs_shotmultiplier / 500;
pl.m4a1_mag--;
@ -189,12 +189,12 @@ w_m4a1_primary(player pl)
dmg = Skill_GetValue("plr_m4a1_dmg", 33);
TraceAttack_SetRangeModifier(2.125);
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1);
Cstrike_BulletRecoil_ApplyPre(pl,.96f);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_M4A1, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1);
Cstrike_BulletRecoil_ApplyPost(pl,.96f);
#endif
Cstrike_ShotMultiplierAdd(pl, 1, 1);
Cstrike_ShotMultiplierAdd(pl, 0.8f, 1.025f,accuracy*0.8);
pl.w_attack_next = 0.0875f;
pl.w_idle_next = 2.0f;
}

View File

@ -118,7 +118,7 @@ w_mac10_primary(player pl)
}
float accuracy = Cstrike_CalculateAccuracy(pl, 80,0.7)+0.009f;
float accuracy = Cstrike_CalculateAccuracy(pl, 50,0.8)+0.0095f;
pl.mac10_mag--;
int r = (float)input_sequence % 3;
@ -146,13 +146,13 @@ w_mac10_primary(player pl)
dmg = Skill_GetValue("plr_mac10_dmg", 29);
TraceAttack_SetRangeModifier(1.25); /* 9, but not 10 */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1.125);
Cstrike_BulletRecoil_ApplyPre(pl,1.115);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_MAC10, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1.125);
Cstrike_BulletRecoil_ApplyPost(pl,1.115);
Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, .8, .9);
Cstrike_ShotMultiplierAdd(pl, 2, 0.7f,accuracy);
pl.w_attack_next = 0.07f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -116,7 +116,7 @@ w_mp5_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl,100,1)+0.004f;
float accuracy = Cstrike_CalculateAccuracy(pl,60,1.25)+0.0045f;
pl.mp5_mag--;
int r = (float)input_sequence % 3;
@ -144,13 +144,13 @@ w_mp5_primary(player pl)
dmg = Skill_GetValue("plr_mp5_dmg", 26);
TraceAttack_SetRangeModifier(1.25); /* 9 units but not 10 */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,.7f);
Cstrike_BulletRecoil_ApplyPre(pl,.825f);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_MP5, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,.7f);
Cstrike_BulletRecoil_ApplyPost(pl,.825f);
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, .5f, 1.5f);
Cstrike_ShotMultiplierAdd(pl, .5f, 1.25f,accuracy);
pl.w_attack_next = 0.08f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -151,12 +151,12 @@ w_p228_primary(player pl)
dmg = Skill_GetValue("plr_p228_dmg", 40);
TraceAttack_SetRangeModifier(1.5); /* penetrates 11, but not 12 units */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1.2);
Cstrike_BulletRecoil_ApplyPre(pl,1.05);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_P228, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1.2);
Cstrike_BulletRecoil_ApplyPost(pl,1.05);
Sound_Play(pl, CHAN_WEAPON, "weapon_p228.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 6, 0.5f);
Cstrike_ShotMultiplierAdd(pl, 6, 0.5f,accuracy);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.1425f;

View File

@ -116,7 +116,7 @@ w_p90_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl, 50,1)+0.0055;
float accuracy = Cstrike_CalculateAccuracy(pl, 50,1.125)+0.0055;
pl.p90_mag--;
int r = (float)input_sequence % 3;
@ -144,13 +144,13 @@ w_p90_primary(player pl)
dmg = Skill_GetValue("plr_p90_dmg", 26);
TraceAttack_SetRangeModifier(1.875); /* 9 but not 10 */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1);
Cstrike_BulletRecoil_ApplyPre(pl,.9);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_P90, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1);
Cstrike_BulletRecoil_ApplyPost(pl,.9);
Sound_Play(pl, CHAN_WEAPON, "weapon_p90.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1.1, 1.1);
Cstrike_ShotMultiplierAdd(pl, 1.1, 1.3,accuracy);
pl.w_attack_next = 0.07f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -114,8 +114,9 @@ w_para_primary(player pl)
if (!pl.para_mag)
return;
Cstrike_ShotMultiplierAdd(pl, 1, 1);
float accuracy = Cstrike_CalculateAccuracy(pl, 175);
float accuracy = Cstrike_CalculateAccuracy(pl, 70);
pl.para_mag--;
int r = (float)input_sequence % 2;
@ -140,10 +141,13 @@ w_para_primary(player pl)
dmg = Skill_GetValue("plr_para_dmg", 35);
TraceAttack_SetRangeModifier(2.125);
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPost(pl,1);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_PARA, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1);
Sound_Play(pl, CHAN_WEAPON, "weapon_para.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
pl.w_attack_next = 0.1f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -174,8 +174,9 @@ w_scout_primary(player pl)
return;
}
Cstrike_ShotMultiplierAdd(pl, 1, 1);
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
pl.scout_mag--;
int r = (float)input_sequence % 2;
@ -204,6 +205,7 @@ w_scout_primary(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
pl.w_attack_next = 1.25f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -114,8 +114,9 @@ w_sg550_primary(player pl)
if (!pl.sg550_mag)
return;
Cstrike_ShotMultiplierAdd(pl, 1, 1);
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
pl.sg550_mag--;
int r = (float)input_sequence % 2;

View File

@ -116,7 +116,7 @@ w_sg552_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl, 80,3)*pl.viewzoom;
float accuracy = Cstrike_CalculateAccuracy(pl, 75,3)*pl.viewzoom;
pl.sg552_mag--;
int r = (float)input_sequence % 3;
@ -144,13 +144,13 @@ w_sg552_primary(player pl)
dmg = Skill_GetValue("plr_sg552_dmg", 33);
TraceAttack_SetRangeModifier(2.125);
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,1);
Cstrike_BulletRecoil_ApplyPre(pl,0.726f);
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_SG552, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,1);
Cstrike_BulletRecoil_ApplyPost(pl,0.725f);
Sound_Play(pl, CHAN_WEAPON, "weapon_sg552.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 2.2, 0.9);
Cstrike_ShotMultiplierAdd(pl, 2.2, 0.9,accuracy);
if (pl.viewzoom == 1.0f)
pl.w_attack_next = 0.0825f;
else

View File

@ -116,7 +116,7 @@ w_tmp_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl, 30,0.8)+0.0035;
float accuracy = Cstrike_CalculateAccuracy(pl, 30,0.95)+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.85, 1.25);
Cstrike_ShotMultiplierAdd(pl, 0.95, 1.25,accuracy);
pl.w_attack_next = 0.07f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -149,7 +149,7 @@ w_ump45_primary(player pl)
Cstrike_BulletRecoil_ApplyPost(pl,1.2);
Sound_Play(pl, CHAN_WEAPON, "weapon_ump45.fire");
#endif
Cstrike_ShotMultiplierAdd(pl, 1, .9);
Cstrike_ShotMultiplierAdd(pl, 1, .9,accuracy);
pl.w_attack_next = 0.105f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -135,7 +135,7 @@ w_usp45_primary(player pl)
return;
float accuracy = Cstrike_CalculateAccuracy(pl,40,2.2);
float accuracy = Cstrike_CalculateAccuracy(pl,25,2.2);
int dmg = 0;
pl.usp45_mag--;
@ -204,7 +204,7 @@ w_usp45_primary(player pl)
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_USP45, "Impact.BigShot");
Cstrike_BulletRecoil_ApplyPost(pl,0.625);
#endif
Cstrike_ShotMultiplierAdd(pl, 10, 0.4);
Cstrike_ShotMultiplierAdd(pl, 2.5, .5,accuracy*0.5);
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.15f;

View File

@ -206,7 +206,7 @@ w_xm1014_primary(player pl)
#endif
for (int i = 0; i < 6; i++) {
Cstrike_ShotMultiplierAdd(pl, 1, 1);
Cstrike_ShotMultiplierAdd(pl, 1, 1,1);
pl.punchangle[0] = -4 * (6 / 6);
#ifdef SERVER
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3, "Impact.BigShot");

View File

@ -48,34 +48,47 @@ csweapon_melee_type(player pl)
float
Cstrike_CalculateMovementInaccuracy(player pl) {
float m = 1.0f;
float maxspeed = 250;
float speedlimit_low = maxspeed/3;
float speedlimit_high = maxspeed/2;
float current_speed = vlen(pl.velocity);
if (current_speed > speedlimit_low) {
if (current_speed > speedlimit_high) {
m = 2.25f;
} else {
m = 1.0f + (current_speed - speedlimit_low)/(speedlimit_high - speedlimit_low);
}
}
if (!(pl.flags & FL_ONGROUND)) {
m = 2.5f;
} else if (pl.flags & FL_CROUCHING) {
m = 0.75f;
} else if (vlen(pl.velocity) > 120) {
m = 2.25f;
}else if (pl.flags & FL_CROUCHING) {
m *= 0.6f;
}
return m;
return bound(0.75f,m,2.5f);
}
/* called whenever a cstrike gun fires a successful shot */
void
Cstrike_ShotMultiplierAdd(player pl, float shots, float strength)
Cstrike_ShotMultiplierAdd(player pl, float shots, float strength, float inaccuracy)
{
int r;
inaccuracy = bound(.95,inaccuracy*50+0.1,1.6);
if (pl.cs_shotmultiplier < 1.6) {
pl.cs_rec_reverse_chance = 0.95f;
pl.cs_prev_hor_rec = 0;
pl.cs_hor_rec_sign = 1;
if (autocvar_guns_random_recoil_direction && pseudorandom() >= 0.5) {
pl.cs_hor_rec_sign = -1;
}
}
pl.cs_rec_reverse_chance -= 0.02f;
if (pl.cs_rec_reverse_chance < 0.1f) {
pl.cs_rec_reverse_chance = 0.1f;
}
if (autocvar_guns_random_recoil_direction == 1) {
if (pseudorandom() > 0.82f) {
if (pseudorandom() > pl.cs_rec_reverse_chance) {
pl.cs_hor_rec_sign = -pl.cs_hor_rec_sign;
pl.cs_rec_reverse_chance = 0.92f;
}
} else {
if ( pl.cs_shotmultiplier > 9) {
@ -84,28 +97,29 @@ Cstrike_ShotMultiplierAdd(player pl, float shots, float strength)
}
float new_shotmultiplier
= pl.cs_shotmultiplier
+ 1.5
+ 1.3
+ shots
+ pl.cs_shotmultiplier/6
- pl.cs_shotmultiplier*pl.cs_shotmultiplier/100;
+ pl.cs_shotmultiplier/12*(.85+inaccuracy/11)
- pl.cs_shotmultiplier*pl.cs_shotmultiplier/100*(.95+inaccuracy/10);
pl.cs_shotmultiplier = bound(0, new_shotmultiplier, 30);
float bound_shotmultiplier = bound(0, pl.cs_shotmultiplier, 12);
pl.cs_shottime = 0.2f;
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] = -(pl.cs_shotmultiplier)*0.35*(strength*0.9+inaccuracy/9)+0.5;
pl.punchangle[0] -= autocvar_guns_firing_inaccuracy * (1 + 3*inaccuracy * inaccuracy)/19;
pl.punchangle[0] *= autocvar_guns_recoil_strength;
if (pl.cs_shotmultiplier < 3) {
if (pl.cs_shotmultiplier < 5) {
//here we add extra punchangle for low multiplier values,
//so that tapping has more weight to it.
float extrapunch = bound(0.7f,shots,1.5);
float extrapunch = bound(0.6f,shots*strength,0.8f);
pl.punchangle[0] -= extrapunch;
}
float hor_recoil
= pl.cs_shotmultiplier*0.005
+ (pseudorandom() - 0.35)*0.75*autocvar_guns_firing_inaccuracy;
= pl.cs_shotmultiplier/185*(1 + (pseudorandom() - 0.5)/3)
+ (pseudorandom() - 0.3)*inaccuracy*inaccuracy*0.5*autocvar_guns_firing_inaccuracy;
hor_recoil *= movement_inaccuracy * strength * autocvar_guns_recoil_strength;
hor_recoil *= 1.2 * movement_inaccuracy * strength * autocvar_guns_recoil_strength;
if (pl.cs_hor_rec_sign > 0) {
pl.cs_prev_hor_rec += hor_recoil;
@ -151,8 +165,8 @@ 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 * autocvar_guns_firing_inaccuracy;
inacc = inacc / divisor / 1000;
inacc = pl.cs_shotmultiplier*(1.25 + pl.cs_shotmultiplier*pl.cs_shotmultiplier*0.3) * autocvar_guns_firing_inaccuracy;
inacc = inacc / divisor / 3100;
inacc = inacc * m;
if (m > 1) {
inacc += m * 0.0025*movement_penalty * autocvar_guns_movement_inaccuracy;