Skip to content

Commit

Permalink
CLIENT: Better handling of crosshair recoil effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MotoLegacy committed Nov 26, 2024
1 parent 9a33650 commit ee349fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion source/client/defs/custom.qc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ float hud_maxammo_starttime;
float nameprint_time;
float HUD_Change_time;
float Hitmark_time;
float crosshair_spread_time;
float recoil_kick_time;
float crosshair_pulse_grenade;
float zoom_2_time;

Expand Down
19 changes: 0 additions & 19 deletions source/client/hud.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1346,25 +1346,6 @@ void() Draw_Crosshair =
if (getstatf(STAT_HEALTH) < 1)
return;

if (crosshair_spread_time > time && crosshair_spread_time)
{
cur_spread = cur_spread + 10;
if (cur_spread >= CrossHairMaxSpread(getstatf(STAT_ACTIVEWEAPON), getstatf(STAT_PLAYERSTANCE)))
cur_spread = CrossHairMaxSpread(getstatf(STAT_ACTIVEWEAPON), getstatf(STAT_PLAYERSTANCE));

if (!croshhairmoving)
cur_spread *= 1/2;
}
else if (crosshair_spread_time < time && crosshair_spread_time)
{
cur_spread = cur_spread - 0.25;
if (cur_spread <= 0)
{
cur_spread = 0;
crosshair_spread_time = 0;
}
}

// Standard crosshair (+)
if (crosshair_value == 1) {
int x_value, y_value;
Expand Down
5 changes: 3 additions & 2 deletions source/client/main.qc
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void() DropRecoilKick =
{
float len;

if (crosshair_spread_time > time)
if (recoil_kick_time > time)
return;

len = VectorNormalize(gun_kick);
Expand Down Expand Up @@ -1006,7 +1006,8 @@ noref void() CSQC_Parse_Event =
Hitmark_time = time + 0.2;
break;
case 5:
crosshair_spread_time = time + 70/getWeaponRecoilReturn(getstatf(STAT_ACTIVEWEAPON));
recoil_kick_time = time + 70/getWeaponRecoilReturn(getstatf(STAT_ACTIVEWEAPON));
cur_spread = CrossHairMaxSpread(getstatf(STAT_ACTIVEWEAPON), getstatf(STAT_PLAYERSTANCE));
break;
default:
break;
Expand Down

0 comments on commit ee349fc

Please sign in to comment.