From f238fd41e4803eaa35fcf3ae40a50f3c2d480f71 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 1 May 2022 18:51:44 -0700 Subject: [PATCH] Client: Tweaks to the crosshairs by Theuaredead` --- src/shared/w_crossbow.qc | 36 +++++++++++++++++++++++++----------- src/shared/w_egon.qc | 20 +++++++++++++++----- src/shared/w_mp5.qc | 10 ++++++---- src/shared/w_python.qc | 34 ++++++++++++++++++++++++---------- src/shared/w_rpg.qc | 22 ++++++++++++++++++---- 5 files changed, 88 insertions(+), 34 deletions(-) diff --git a/src/shared/w_crossbow.qc b/src/shared/w_crossbow.qc index 92484eb..6deb0b1 100644 --- a/src/shared/w_crossbow.qc +++ b/src/shared/w_crossbow.qc @@ -297,17 +297,31 @@ w_crossbow_crosshair(player pl) vector cross_pos; vector aicon_pos; - cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; - drawsubpic( - cross_pos, - [24,24], - g_cross_spr, - [72/128,0], - [0.1875, 0.1875], - [1,1,1], - 1, - DRAWFLAG_NORMAL - ); + if (pl.viewzoom == 1) { + cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; + drawsubpic( + cross_pos, + [24,24], + g_cross_spr, + [72/128,0], + [0.1875, 0.1875], + [1,1,1], + 1, + DRAWFLAG_NORMAL + ); + } else { + cross_pos = g_hudmins + (g_hudres / 2) + [-52,-8]; + drawsubpic( + cross_pos, + [104,16], + g_cross_spr, + [24/128,96/128], + [104/128, 16/128], + [1,1,1], + 1, + DRAWFLAG_NORMAL + ); + } HUD_DrawAmmo1(); HUD_DrawAmmo2(); diff --git a/src/shared/w_egon.qc b/src/shared/w_egon.qc index 616fb65..37397a4 100644 --- a/src/shared/w_egon.qc +++ b/src/shared/w_egon.qc @@ -142,13 +142,22 @@ void w_egon_primary(player pl) sound(pl, CHAN_WEAPON, "weapons/egon_windup2.wav", 1, ATTN_NORM, 100, 0); #endif pl.mode_tempstate = 1; - Weapons_ViewPunchAngle(pl, [-5,0,0]); - Weapons_ViewAnimation(pl, EGON_ALTFIREON); + //Weapons_ViewPunchAngle(pl, [-5,0,0]); + int r = (float)input_sequence % 2; + if (r) { + Weapons_ViewAnimation(pl, EGON_FIRE3); + } else { + Weapons_ViewAnimation(pl, EGON_FIRE4); + } pl.w_idle_next = 1.5f; } else if not (pl.w_idle_next > 0.0f) { /* wait 3 seconds (idle next) */ if (pl.mode_tempstate == 1) { - Weapons_ViewAnimation(pl, EGON_ALTFIRECYCLE); + if (r) { + Weapons_ViewAnimation(pl, EGON_FIRE3); + } else { + Weapons_ViewAnimation(pl, EGON_FIRE4); + } #ifdef SERVER sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100); #endif @@ -173,13 +182,14 @@ void w_egon_release(player pl) sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0); #endif pl.mode_tempstate = 3; - Weapons_ViewPunchAngle(pl, [-2,0,0]); + //Weapons_ViewPunchAngle(pl, [-2,0,0]); } pl.gflags &= ~GF_EGONBEAM; if (pl.mode_tempstate == 3) { - Weapons_ViewAnimation(pl, EGON_ALTFIREOFF); + /* This is hack that is unwise for custom content, but it needs to terminate. */ + Weapons_ViewAnimation(pl, EGON_FIRE1); pl.w_idle_next = 1.0f; pl.w_attack_next = 1.1f; pl.mode_tempstate = 0; diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index 156e3ac..d94248a 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -171,11 +171,13 @@ w_mp5_primary(player pl) pl.mp5_mag--; /* Actual firing */ - int r = (float)input_sequence % 2; - if (r) { + int r = (float)input_sequence % 3; + if (r == 0) { Weapons_ViewAnimation(pl, MP5_FIRE1); - } else { + } else if (r = 2) { Weapons_ViewAnimation(pl, MP5_FIRE2); + } else { + Weapons_ViewAnimation(pl, MP5_FIRE3); } Weapons_ViewPunchAngle(pl, [-2,0,0]); @@ -329,7 +331,7 @@ w_mp5_crosshair(player pl) cross_pos, [24,24], g_cross_spr, - [24/128,48/128], + [0,48/128], [0.1875, 0.1875], [1,1,1], 1.0f, diff --git a/src/shared/w_python.qc b/src/shared/w_python.qc index 97d8659..4b9affb 100644 --- a/src/shared/w_python.qc +++ b/src/shared/w_python.qc @@ -261,16 +261,30 @@ w_python_crosshair(player pl) vector aicon_pos; cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; - drawsubpic( - cross_pos, - [24,24], - g_cross_spr, - [48/128,0], - [0.1875, 0.1875], - [1,1,1], - 1, - DRAWFLAG_NORMAL - ); + + if (pl.viewzoom == 1) { + drawsubpic( + cross_pos, + [24,24], + g_cross_spr, + [48/128,0], + [0.1875, 0.1875], + [1,1,1], + 1, + DRAWFLAG_NORMAL + ); + } else { + drawsubpic( + cross_pos, + [24,24], + g_cross_spr, + [96/128,0], + [0.1875, 0.1875], + [1,1,1], + 1, + DRAWFLAG_NORMAL + ); + } HUD_DrawAmmo1(); HUD_DrawAmmo2(); diff --git a/src/shared/w_rpg.qc b/src/shared/w_rpg.qc index cf2f61e..fd59681 100644 --- a/src/shared/w_rpg.qc +++ b/src/shared/w_rpg.qc @@ -275,6 +275,7 @@ void w_rpg_hud(player pl) { #ifdef CLIENT vector cross_pos; + vector laser_pos; vector aicon_pos; /* crosshair/laser */ @@ -287,9 +288,11 @@ void w_rpg_hud(player pl) lerp = Math_Lerp(18,6, trace_fraction); jitter[0] = (random(0,2) - 2) * (1 - trace_fraction); jitter[1] = (random(0,2) - 2) * (1 - trace_fraction); - cross_pos = g_hudmins + (g_hudres / 2) + ([-lerp,-lerp] / 2); + laser_pos = g_hudmins + (g_hudres / 2) + ([-lerp,-lerp] / 2); + cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; + drawsubpic( - cross_pos + jitter, + laser_pos + jitter, [lerp,lerp], g_laser_spr, [0,0], @@ -298,16 +301,27 @@ void w_rpg_hud(player pl) 1.0f, DRAWFLAG_ADDITIVE ); + + drawsubpic( + cross_pos, + [24,24], + g_cross_spr, + [24/128,48/128], + [0.1875, 0.1875], + [1,1,1], + 1.0f, + DRAWFLAG_NORMAL + ); } else { cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; drawsubpic( cross_pos, [24,24], g_cross_spr, - [0,0], + [24/128,48/128], [0.1875, 0.1875], [1,1,1], - 1, + 1.0f, DRAWFLAG_NORMAL ); }