From 24e800a3e0871a64ebb2735754f5f4309c61acb7 Mon Sep 17 00:00:00 2001 From: avirox Date: Sun, 22 Jan 2006 15:35:50 +0000 Subject: [PATCH] - Added savageX's TrueAim(tm) fix (weapons aim at crosshair) - Tweaked namek secondary fire git-svn-id: svn://svn.icculus.org/nexuiz/trunk@872 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- TeamNexuiz/game/gamec/tf_w_mac10.c | 17 +++++++++++++--- TeamNexuiz/game/gamec/tf_w_railgun.c | 24 +++++++++++++++------- TeamNexuiz/game/gamec/w_incendiary_r.c | 12 +++++++++-- TeamNexuiz/game/gamec/w_namek.c | 4 ++-- TeamNexuiz/game/gamec/w_rocketlauncher.c | 20 ++++++++++++++---- TeamNexuiz/game/gamec/w_uzi.c | 26 ++++++++++++++++++------ 6 files changed, 79 insertions(+), 24 deletions(-) diff --git a/TeamNexuiz/game/gamec/tf_w_mac10.c b/TeamNexuiz/game/gamec/tf_w_mac10.c index 124d7e04a..b3bdaa454 100644 --- a/TeamNexuiz/game/gamec/tf_w_mac10.c +++ b/TeamNexuiz/game/gamec/tf_w_mac10.c @@ -36,8 +36,19 @@ void W_Mac_Attack (void) { local vector org; entity flash; + local vector end; + + local vector trueaim; + + org = self.origin + self.view_ofs; + end = self.origin + self.view_ofs + v_forward * 4096; + traceline(org,end,TRUE,self); + + trueaim = trace_endpos; + sound (self, CHAN_WEAPON, "weapons/mac_fire.wav", 1, ATTN_NORM); - self.ammo_nails = self.ammo_nails - 1; + if (cvar("g_use_ammunition")) + self.ammo_nails = self.ammo_nails - 1; self.punchangle_x = random () - 0.5; self.punchangle_y = random () - 0.5; org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 15); @@ -46,9 +57,9 @@ void W_Mac_Attack (void) self.attack_finished = time + cvar("g_balance_mac_refire2"); if (self.mac_bulletcounter == 1) - fireBullet (org, v_forward, cvar("g_balance_mac_spread2"), cvar("g_balance_mac_damage2"), WEP_MAC, (self.mac_bulletcounter & 3) == 0); + fireBullet (org, normalize(trueaim - org), cvar("g_balance_mac_spread2"), cvar("g_balance_mac_damage2"), WEP_MAC, (self.mac_bulletcounter & 3) == 0); else - fireBullet (org, v_forward, cvar("g_balance_mac_spread"), cvar("g_balance_mac_damage"), WEP_MAC, (self.mac_bulletcounter & 3) == 0); + fireBullet (org, normalize(trueaim - org), cvar("g_balance_mac_spread"), cvar("g_balance_mac_damage"), WEP_MAC, (self.mac_bulletcounter & 3) == 0); // casing code if (cvar("g_casings") >= 2) diff --git a/TeamNexuiz/game/gamec/tf_w_railgun.c b/TeamNexuiz/game/gamec/tf_w_railgun.c index b83b54ef5..5c9388c23 100644 --- a/TeamNexuiz/game/gamec/tf_w_railgun.c +++ b/TeamNexuiz/game/gamec/tf_w_railgun.c @@ -35,17 +35,27 @@ void W_RailGun_Attack (void) local vector end; local entity flash; - sound (self, CHAN_WEAPON, "weapons/RailGunfire.wav", 1, ATTN_NORM); + local vector trueaim; + + sound (self, CHAN_WEAPON, "weapons/nexfire.ogg", 1, ATTN_NORM); + if (self.items & IT_STRENGTH) { + sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM); + } + self.punchangle_x = -5; -// org = self.origin + self.view_ofs + v_forward * 5 + v_right * 14 + v_up * -7; - org = self.origin + self.view_ofs + v_forward * 5 + v_right * 1 + v_up * -1; // better accuracy + org = self.origin + self.view_ofs; end = self.origin + self.view_ofs + v_forward * 4096; + + traceline(org,end,TRUE,self); + + trueaim = trace_endpos; + + org = self.origin + self.view_ofs + v_forward * 5 + v_right * 14 + v_up * -7; -// FireRailgunBullet (org, end, cvar("g_balance_railgun_damage"), WEP_RAILGUN); - FireRailgunBullet (org, end, 35, WEP_RAILGUN); //temp till I add damage var + FireRailgunBullet (org, trueaim, cvar("g_balance_railgun_damage"), IT_NEX); // trace as if shot started inside gun - traceline (org, end, TRUE, self); + traceline (org, trueaim, TRUE, self); // show as if shot started outside of gun org = self.origin + self.view_ofs + v_forward * 28 + v_right * 14 + v_up * -7; // muzzleflash light @@ -80,7 +90,7 @@ void W_RailGun_Attack (void) // play a sound PointSound (trace_endpos, "weapons/RailGunimpact.wav", 1, ATTN_NORM); - if (cvar("g_instagib") == 0) + if (cvar("g_use_ammunition") && cvar("g_instagib") == 0) // self.ammo_cells = self.ammo_cells - 5; self.ammo_shells = self.ammo_shells - 5; diff --git a/TeamNexuiz/game/gamec/w_incendiary_r.c b/TeamNexuiz/game/gamec/w_incendiary_r.c index 904f997cf..6f1cb7e4d 100644 --- a/TeamNexuiz/game/gamec/w_incendiary_r.c +++ b/TeamNexuiz/game/gamec/w_incendiary_r.c @@ -113,8 +113,16 @@ void W_IncendiaryRocket_Attack (void) local entity missile; local entity flash; local vector org; + local vector end; + + local vector trueaim; + org = self.origin + self.view_ofs; + end = self.origin + self.view_ofs + v_forward * 4096; + traceline(org,end,TRUE,self); + trueaim = trace_endpos; + sound (self, CHAN_WEAPON, "weapons/rocket_fire.wav", 1, ATTN_NORM); - if (cvar("g_rocketarena") == 0) + if (cvar("g_rocketarena") == 0 && cvar("g_use_ammunition") == 1) self.ammo_rockets = self.ammo_rockets - 5; self.punchangle_x = -4; org = self.origin + self.view_ofs + v_forward * 15 + v_right * 3 + v_up * -11; @@ -135,7 +143,7 @@ void W_IncendiaryRocket_Attack (void) setsize (missile, '0 0 0', '0 0 0'); setorigin (missile, org); - missile.velocity = v_forward * cvar("g_balance_incendiaryrocket_speed"); + missile.velocity = normalize(trueaim - org) * cvar("g_balance_incendiaryrocket_speed"); missile.angles = vectoangles (missile.velocity); missile.touch = W_IncendiaryRocket_Touch; diff --git a/TeamNexuiz/game/gamec/w_namek.c b/TeamNexuiz/game/gamec/w_namek.c index d931329be..aa401cb6d 100644 --- a/TeamNexuiz/game/gamec/w_namek.c +++ b/TeamNexuiz/game/gamec/w_namek.c @@ -116,8 +116,8 @@ void W_Namek_Attack2() org = self.origin + self.view_ofs + v_forward * 15 + v_right * 10 + v_up * -14; brange = cvar("g_balance_namek_range2"); - FireNamekBullet(org + '0 0 1', v_forward * cvar("g_balance_namek_speed2"), cvar("g_balance_namek_damage2"), brange); - FireNamekBullet(org - '0 0 2', v_forward * cvar("g_balance_namek_speed2"), cvar("g_balance_namek_damage2"), brange); + FireNamekBullet(org + '0 0 1', v_forward * cvar("g_balance_namek_speed2") + v_up * 16 + v_right * -5, cvar("g_balance_namek_damage2"), brange); + FireNamekBullet(org - '0 0 2', v_forward * cvar("g_balance_namek_speed2") + v_up * 16 + v_right * -5, cvar("g_balance_namek_damage2"), brange); } // weapon frames diff --git a/TeamNexuiz/game/gamec/w_rocketlauncher.c b/TeamNexuiz/game/gamec/w_rocketlauncher.c index 29d9c9fee..e12f913bf 100644 --- a/TeamNexuiz/game/gamec/w_rocketlauncher.c +++ b/TeamNexuiz/game/gamec/w_rocketlauncher.c @@ -83,8 +83,20 @@ void W_Rocket_Attack (void) local entity missile; local entity flash; local vector org; - sound (self, CHAN_WEAPON, "weapons/rocket_fire.wav", 1, ATTN_NORM); - if (cvar("g_rocketarena") == 0) + local vector end; + + local vector trueaim; + org = self.origin + self.view_ofs; + end = self.origin + self.view_ofs + v_forward * 4096; + traceline(org,end,TRUE,self); + trueaim = trace_endpos; + + sound (self, CHAN_WEAPON, "weapons/rocket_fire.ogg", 1, ATTN_NORM); + if (self.items & IT_STRENGTH) { + sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM); + } + + if (cvar("g_use_ammunition") && !cvar("g_rocketarena")) self.ammo_rockets = self.ammo_rockets - 3; self.punchangle_x = -4; org = self.origin + self.view_ofs + v_forward * 15 + v_right * 3 + v_up * -11; @@ -105,7 +117,7 @@ void W_Rocket_Attack (void) setsize (missile, '0 0 0', '0 0 0'); setorigin (missile, org); - missile.velocity = v_forward * cvar("g_balance_rocketlauncher_speed"); + missile.velocity = normalize(trueaim - org) * cvar("g_balance_rocketlauncher_speed"); missile.angles = vectoangles (missile.velocity); missile.touch = W_Rocket_Touch; @@ -120,7 +132,7 @@ void W_Rocket_Attack (void) flash.velocity = v_forward * 20; flash.angles = vectoangles (flash.velocity); SUB_SetFade (flash, time, 0.4); - flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT; + flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; self.clip_rockets = self.clip_rockets - 1; if (self.clip_rockets == 0) { diff --git a/TeamNexuiz/game/gamec/w_uzi.c b/TeamNexuiz/game/gamec/w_uzi.c index ac6e8d17d..22fd402ac 100644 --- a/TeamNexuiz/game/gamec/w_uzi.c +++ b/TeamNexuiz/game/gamec/w_uzi.c @@ -32,9 +32,23 @@ void(float req) w_uzi = void W_Uzi_Attack (void) { local vector org; + local vector end; + local vector trueaim; + + org = self.origin + self.view_ofs; + end = self.origin + self.view_ofs + v_forward * 4096; + traceline(org,end,TRUE,self); + + trueaim = trace_endpos; + entity flash; - sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", 1, ATTN_NORM); - self.ammo_nails = self.ammo_nails - 1; + sound (self, CHAN_WEAPON, "weapons/uzi_fire.ogg", 1, ATTN_NORM); + if (self.items & IT_STRENGTH) { + sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM); + } + + if (cvar("g_use_ammunition")) + self.ammo_nails = self.ammo_nails - 1; self.punchangle_x = random () - 0.5; self.punchangle_y = random () - 0.5; org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 15); @@ -43,9 +57,9 @@ void W_Uzi_Attack (void) self.attack_finished = time + cvar("g_balance_uzi_refire2"); if (self.uzi_bulletcounter == 1) - fireBullet (org, v_forward, cvar("g_balance_uzi_spread2"), cvar("g_balance_uzi_damage2"), WEP_UZI, (self.uzi_bulletcounter & 3) == 0); + fireBullet (org, normalize(trueaim - org), cvar("g_balance_uzi_spread2"), cvar("g_balance_uzi_damage2"), IT_UZI, (self.uzi_bulletcounter & 3) == 0); else - fireBullet (org, v_forward, cvar("g_balance_uzi_spread"), cvar("g_balance_uzi_damage"), WEP_UZI, (self.uzi_bulletcounter & 3) == 0); + fireBullet (org, normalize(trueaim - org), cvar("g_balance_uzi_spread"), cvar("g_balance_uzi_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0); // casing code if (cvar("g_casings") >= 2) @@ -60,11 +74,11 @@ void W_Uzi_Attack (void) setmodel (flash, "models/uziflash.md3"); flash.velocity = v_forward * 20; flash.angles = vectoangles (flash.velocity); - flash.angles_z=flash.v_angle_z + random () * 180; + flash.angles_z=flash.v_angle_z + random () * 180; flash.scale = 0.75; flash.alpha = 0.5; SUB_SetFade (flash, time, 0.2); - flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT; + flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; } // weapon frames -- 2.39.2