From: Mario Date: Thu, 28 Jul 2016 13:50:43 +0000 (+1000) Subject: Get player view angles before spawning casings (partial fix for casings spawning... X-Git-Tag: xonotic-v0.8.2~700^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=13ac34b5387b670a9c1192adf178aa840328e830;p=xonotic%2Fxonotic-data.pk3dir.git Get player view angles before spawning casings (partial fix for casings spawning at fixed origin) --- diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index b8fd74309..2000ffd5d 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -90,7 +90,10 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if (autocvar_g_casings >= 2) // casing code + { + makevectors(actor.v_angle); // for some reason, this is lost SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); + } int slot = weaponslot(weaponentity); ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor(actor); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 331e2dd92..59dfc10e2 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -130,7 +130,10 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we // casing code if(autocvar_g_casings >= 2) + { + makevectors(actor.v_angle); // for some reason, this is lost SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); + } if(actor.misc_bulletcounter == 1) W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, first_ammo)); @@ -202,7 +205,10 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if(autocvar_g_casings >= 2) // casing code + { + makevectors(actor.v_angle); // for some reason, this is lost SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); + } int slot = weaponslot(weaponentity); ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); @@ -226,7 +232,10 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if(autocvar_g_casings >= 2) // casing code + { + makevectors(actor.v_angle); // for some reason, this is lost SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); + } actor.misc_bulletcounter = actor.misc_bulletcounter + 1; if(actor.misc_bulletcounter == 0) diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 13e445310..c46b8f2b2 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -76,7 +76,10 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor fireBullet(actor, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE)); if(autocvar_g_casings >= 2) + { + makevectors(actor.v_angle); // for some reason, this is lost SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); + } } void W_Rifle_Attack(entity actor) diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index d96517753..f89ef6872 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -73,8 +73,11 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary) // casing code if(autocvar_g_casings >= 1) + { + makevectors(actor.v_angle); // for some reason, this is lost for(sc = 0;sc < WEP_CVAR_PRI(shotgun, ammo);sc = sc + 1) SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, actor); + } // muzzle flash for 1st person view flash = spawn();