From 7d373d92169f4ded05da6f6face84a38739c696b Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 8 Aug 2019 01:42:05 -0700 Subject: [PATCH] Slight weapon adds/edits for ongoing work in FreeHL --- Source/shared/valve/w_glock.c | 7 +++++-- Source/shared/valve/w_hornetgun.c | 29 +++++++++++++++++++++++++++++ Source/shared/valve/w_tripmine.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/Source/shared/valve/w_glock.c b/Source/shared/valve/w_glock.c index 5cf580b4..b551ded9 100644 --- a/Source/shared/valve/w_glock.c +++ b/Source/shared/valve/w_glock.c @@ -119,13 +119,13 @@ void w_glock_secondary(void) if (!pl.a_ammo1) { return; } - + if (pl.a_ammo1) { Weapons_ViewAnimation(GLOCK_SHOOT); } else { Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY); } - + Weapons_ViewPunchAngle([-2,0,0]); #else if (!pl.glock_mag) { @@ -159,6 +159,9 @@ void w_glock_reload(void) if (pl.a_ammo1 >= 18) { return; } + if (!pl.a_ammo2) { + return; + } if (pl.a_ammo1) { Weapons_ViewAnimation(GLOCK_RELOAD); diff --git a/Source/shared/valve/w_hornetgun.c b/Source/shared/valve/w_hornetgun.c index d7fe0d48..4c3c4696 100644 --- a/Source/shared/valve/w_hornetgun.c +++ b/Source/shared/valve/w_hornetgun.c @@ -63,6 +63,33 @@ void w_hornetgun_holster(void) { } + +#ifdef SSQC +void w_hornetgun_shoothornet(void) +{ + static void Hornet_Touch(void) { + if (other.takedamage == DAMAGE_YES) { + Damage_Apply(other, self.owner, 10, trace_endpos, FALSE); + } else { + } + remove(self); + } + Weapons_MakeVectors(); + entity bolt = spawn(); + setmodel(bolt, "models/hornet.mdl"); + setorigin(bolt, Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8)); + bolt.owner = self; + bolt.velocity = v_forward * 1000; + bolt.movetype = MOVETYPE_FLY; + bolt.solid = SOLID_BBOX; + //bolt.flags |= FL_LAGGEDMOVE; + bolt.gravity = 0.5f; + bolt.angles = vectoangles(bolt.velocity); + bolt.touch = Hornet_Touch; + setsize(bolt, [0,0,0], [0,0,0]); +} +#endif + void w_hornetgun_primary(void) { player pl = (player)self; @@ -71,6 +98,7 @@ void w_hornetgun_primary(void) } #ifdef SSQC + w_hornetgun_shoothornet(); Weapons_PlaySound(pl, CHAN_WEAPON, sprintf("agrunt/ag_fire%d.wav", floor(random(1,4))), 1, ATTN_NORM); #else Weapons_ViewAnimation(HORNETGUN_SHOOT); @@ -87,6 +115,7 @@ void w_hornetgun_secondary(void) } #ifdef SSQC + w_hornetgun_shoothornet(); Weapons_PlaySound(pl, CHAN_WEAPON, sprintf("agrunt/ag_fire%d.wav", floor(random(1,4))), 1, ATTN_NORM); #else Weapons_ViewAnimation(HORNETGUN_SHOOT); diff --git a/Source/shared/valve/w_tripmine.c b/Source/shared/valve/w_tripmine.c index 82bc9d73..e4b58374 100644 --- a/Source/shared/valve/w_tripmine.c +++ b/Source/shared/valve/w_tripmine.c @@ -56,7 +56,36 @@ void w_tripmine_holster(void) } void w_tripmine_primary(void) { + player pl = (player)self; + if (pl.w_attack_next > 0.0) { + return; + } + + Weapons_MakeVectors(); + traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + v_forward * 64, FALSE, pl); + + if (trace_fraction == 1.0f) { + return; + } + +#ifdef CSQC + Weapons_ViewAnimation(TRIPMINE_FIRE2); +#else + entity mine = spawn(); + setmodel(mine, "models/v_tripmine.mdl"); + setorigin(mine, trace_endpos); + mine.frame = TRIPMINE_WORLD; + vector norm = trace_plane_normal; + norm_x = 0 - norm_x; + norm_y = 0 - norm_y; + + mine.angles = vectoangles( [0,0,0.5] - norm ); + setorigin(mine, trace_endpos - (v_forward * 4)); +#endif + + pl.w_attack_next = 0.5f; + pl.w_idle_next = 2.5f; } void w_tripmine_secondary(void) {