From 887ed935720aabad9d6d291bb4f7150b5bd888b2 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Sun, 8 Dec 2013 01:19:58 -0500 Subject: [PATCH] Cleanup shockwave pellets code --- qcsrc/common/weapons/w_shockwave.qc | 59 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index d0491b0d4..228c905ad 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -97,36 +97,53 @@ vector shockwave_hit_force[32]; void W_Shockwave_Pellets(void) { float sc; - float ammoamount; - float bullets; - float d; - float f; - float spread; - float bulletspeed; - float bulletconstant; entity flash; - ammoamount = WEP_CVAR(shockwave, pellets_ammo); - bullets = WEP_CVAR(shockwave, pellets_bullets); - d = WEP_CVAR(shockwave, pellets_damage); - f = WEP_CVAR(shockwave, pellets_force); - spread = WEP_CVAR(shockwave, pellets_spread); - bulletspeed = WEP_CVAR(shockwave, pellets_speed); - bulletconstant = WEP_CVAR(shockwave, pellets_bulletconstant); + W_DecreaseAmmo(ammo_shells, WEP_CVAR(shockwave, pellets_ammo), WEP_CVAR(shockwave, reload_ammo)); - W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shockwave_reload_ammo); - - W_SetupShot(self, TRUE, 5, "weapons/shockwave_fire.wav", CH_WEAPON_A, d * bullets); - for(sc = 0;sc < bullets;sc = sc + 1) - fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOCKWAVE, 0, bulletconstant); + W_SetupShot(self, TRUE, 5, "weapons/shockwave_fire.wav", CH_WEAPON_A, WEP_CVAR(shockwave, pellets_damage) * WEP_CVAR(shockwave, pellets_bullets)); + + for(sc = 0; sc < WEP_CVAR(shockwave, pellets_bullets); ++sc) + { + fireBallisticBullet( + w_shotorg, + w_shotdir, + WEP_CVAR(shockwave, pellets_spread), + WEP_CVAR(shockwave, pellets_speed), + 5, + WEP_CVAR(shockwave, pellets_damage), + WEP_CVAR(shockwave, pellets_force), + WEP_SHOCKWAVE, + 0, + WEP_CVAR(shockwave, pellets_bulletconstant) + ); + } endFireBallisticBullet(); pointparticles(particleeffectnum("shockwave_muzzleflash"), w_shotorg, w_shotdir * 1000, WEP_CVAR(shockwave, pellets_ammo)); // casing code if(autocvar_g_casings >= 1) - for(sc = 0;sc < ammoamount;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, self); + { + for(sc = 0;sc < WEP_CVAR(shockwave, pellets_ammo); ++sc) + { + 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, + self + ); + } + } // muzzle flash for 1st person view flash = spawn(); -- 2.39.2