diff --git a/src/shared/player.h b/src/shared/player.h index 3c44749..24664d8 100644 --- a/src/shared/player.h +++ b/src/shared/player.h @@ -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 diff --git a/src/shared/w_ak47.qc b/src/shared/w_ak47.qc index 0fa6161..ca93f00 100644 --- a/src/shared/w_ak47.qc +++ b/src/shared/w_ak47.qc @@ -154,7 +154,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; @@ -182,13 +182,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; } diff --git a/src/shared/w_aug.qc b/src/shared/w_aug.qc index 6d5c510..d0312f7 100644 --- a/src/shared/w_aug.qc +++ b/src/shared/w_aug.qc @@ -120,7 +120,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; @@ -154,7 +154,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 { diff --git a/src/shared/w_awp.qc b/src/shared/w_awp.qc index f2aba3c..208b5a7 100644 --- a/src/shared/w_awp.qc +++ b/src/shared/w_awp.qc @@ -210,8 +210,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; @@ -244,6 +245,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; } diff --git a/src/shared/w_deagle.qc b/src/shared/w_deagle.qc index aa9c1c6..b8e3392 100644 --- a/src/shared/w_deagle.qc +++ b/src/shared/w_deagle.qc @@ -151,7 +151,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--; @@ -187,7 +187,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; diff --git a/src/shared/w_elites.qc b/src/shared/w_elites.qc index 44f74d9..1d91205 100644 --- a/src/shared/w_elites.qc +++ b/src/shared/w_elites.qc @@ -258,7 +258,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; diff --git a/src/shared/w_fiveseven.qc b/src/shared/w_fiveseven.qc index 83fb8f6..b5f9097 100644 --- a/src/shared/w_fiveseven.qc +++ b/src/shared/w_fiveseven.qc @@ -157,7 +157,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; diff --git a/src/shared/w_g3sg1.qc b/src/shared/w_g3sg1.qc index 115ef6a..5094189 100644 --- a/src/shared/w_g3sg1.qc +++ b/src/shared/w_g3sg1.qc @@ -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; diff --git a/src/shared/w_glock18.qc b/src/shared/w_glock18.qc index 014aaba..54d9c7b 100644 --- a/src/shared/w_glock18.qc +++ b/src/shared/w_glock18.qc @@ -135,6 +135,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; @@ -144,7 +145,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 @@ -193,7 +194,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; } diff --git a/src/shared/w_m3.qc b/src/shared/w_m3.qc index 54a039b..8815687 100644 --- a/src/shared/w_m3.qc +++ b/src/shared/w_m3.qc @@ -207,7 +207,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"); diff --git a/src/shared/w_m4a1.qc b/src/shared/w_m4a1.qc index 650fb43..9a31f48 100644 --- a/src/shared/w_m4a1.qc +++ b/src/shared/w_m4a1.qc @@ -135,7 +135,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--; @@ -190,12 +190,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; } diff --git a/src/shared/w_mac10.qc b/src/shared/w_mac10.qc index 7c92321..8c347df 100644 --- a/src/shared/w_mac10.qc +++ b/src/shared/w_mac10.qc @@ -119,7 +119,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; @@ -147,13 +147,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; } diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index ecfe9d4..f79390c 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -117,7 +117,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; @@ -145,13 +145,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; } diff --git a/src/shared/w_p228.qc b/src/shared/w_p228.qc index 4c5a878..9b24b42 100644 --- a/src/shared/w_p228.qc +++ b/src/shared/w_p228.qc @@ -152,12 +152,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; diff --git a/src/shared/w_p90.qc b/src/shared/w_p90.qc index 1b937f7..b214596 100644 --- a/src/shared/w_p90.qc +++ b/src/shared/w_p90.qc @@ -117,7 +117,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; @@ -145,13 +145,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; } diff --git a/src/shared/w_para.qc b/src/shared/w_para.qc index 70e00c9..facb798 100644 --- a/src/shared/w_para.qc +++ b/src/shared/w_para.qc @@ -115,8 +115,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; @@ -141,10 +142,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; } diff --git a/src/shared/w_scout.qc b/src/shared/w_scout.qc index 768e030..495b3a9 100644 --- a/src/shared/w_scout.qc +++ b/src/shared/w_scout.qc @@ -175,8 +175,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; @@ -205,6 +206,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; } diff --git a/src/shared/w_sg550.qc b/src/shared/w_sg550.qc index 9e6c5d8..d3ac2ff 100644 --- a/src/shared/w_sg550.qc +++ b/src/shared/w_sg550.qc @@ -115,8 +115,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; diff --git a/src/shared/w_sg552.qc b/src/shared/w_sg552.qc index 76d222c..6e6270c 100644 --- a/src/shared/w_sg552.qc +++ b/src/shared/w_sg552.qc @@ -117,7 +117,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; @@ -145,13 +145,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 diff --git a/src/shared/w_tmp.qc b/src/shared/w_tmp.qc index 808d820..643d14c 100644 --- a/src/shared/w_tmp.qc +++ b/src/shared/w_tmp.qc @@ -117,7 +117,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; @@ -151,7 +151,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; } diff --git a/src/shared/w_ump45.qc b/src/shared/w_ump45.qc index 57ae866..cb77074 100644 --- a/src/shared/w_ump45.qc +++ b/src/shared/w_ump45.qc @@ -150,7 +150,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; } diff --git a/src/shared/w_usp45.qc b/src/shared/w_usp45.qc index 0dd5d88..1cc69a7 100644 --- a/src/shared/w_usp45.qc +++ b/src/shared/w_usp45.qc @@ -136,7 +136,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--; @@ -205,7 +205,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; diff --git a/src/shared/w_xm1014.qc b/src/shared/w_xm1014.qc index f91bd46..952397d 100644 --- a/src/shared/w_xm1014.qc +++ b/src/shared/w_xm1014.qc @@ -207,7 +207,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"); diff --git a/src/shared/weapons_cstrike.qc b/src/shared/weapons_cstrike.qc index c00c725..abbc00c 100644 --- a/src/shared/weapons_cstrike.qc +++ b/src/shared/weapons_cstrike.qc @@ -28,10 +28,10 @@ * 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; +var float autocvar_fcs_guns_recoil_strength = 1.0f; +var bool autocvar_fcs_guns_random_recoil_direction = TRUE; +var float autocvar_fcs_guns_movement_inaccuracy = 1.0f; +var float autocvar_fcs_guns_firing_inaccuracy = 1.0f; weapontype_t csweapon_ranged_type(player pl) @@ -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) { + if (autocvar_fcs_guns_random_recoil_direction && pseudorandom() >= 0.5) { pl.cs_hor_rec_sign = -1; } } - if (autocvar_guns_random_recoil_direction == 1) { - if (pseudorandom() > 0.82f) { + pl.cs_rec_reverse_chance -= 0.02f; + if (pl.cs_rec_reverse_chance < 0.1f) { + pl.cs_rec_reverse_chance = 0.1f; + } + if (autocvar_fcs_guns_random_recoil_direction == 1) { + 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] *= autocvar_guns_recoil_strength; - if (pl.cs_shotmultiplier < 3) { + pl.punchangle[0] = -(pl.cs_shotmultiplier)*0.35*(strength*0.9+inaccuracy/9)+0.5; + pl.punchangle[0] -= autocvar_fcs_guns_firing_inaccuracy * (1 + 3*inaccuracy * inaccuracy)/19; + pl.punchangle[0] *= autocvar_fcs_guns_recoil_strength; + 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_fcs_guns_firing_inaccuracy; - hor_recoil *= movement_inaccuracy * strength * autocvar_guns_recoil_strength; + hor_recoil *= 1.2 * movement_inaccuracy * strength * autocvar_fcs_guns_recoil_strength; if (pl.cs_hor_rec_sign > 0) { pl.cs_prev_hor_rec += hor_recoil; @@ -151,11 +165,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 * autocvar_guns_firing_inaccuracy; - inacc = inacc / divisor / 1000; + inacc = pl.cs_shotmultiplier*(1.25 + pl.cs_shotmultiplier*pl.cs_shotmultiplier*0.3) * autocvar_fcs_guns_firing_inaccuracy; + inacc = inacc / divisor / 3100; inacc = inacc * m; if (m > 1) { - inacc += m * 0.0025*movement_penalty * autocvar_guns_movement_inaccuracy; + inacc += m * 0.0025*movement_penalty * autocvar_fcs_guns_movement_inaccuracy; } else { inacc += m * 0.0025; } @@ -166,12 +180,12 @@ Cstrike_CalculateAccuracy(player pl, float divisor, float movement_penalty=1) void Cstrike_BulletRecoil_ApplyPre(player pl, float strength) { - strength *= autocvar_guns_recoil_strength; + strength *= autocvar_fcs_guns_recoil_strength; pl.v_angle += strength*pl.punchangle*(2 - pl.cs_shotmultiplier/100*0.2); } void Cstrike_BulletRecoil_ApplyPost(player pl, float strength) { - strength *= autocvar_guns_recoil_strength; + strength *= autocvar_fcs_guns_recoil_strength; pl.v_angle -= strength*pl.punchangle*(2 - pl.cs_shotmultiplier/100*0.2); }