From 9771bbb48d255d3c844fcbe3ea8596a7bc6d559e Mon Sep 17 00:00:00 2001
From: Samual Lenks <samual@xonotic.org>
Date: Fri, 10 Jan 2014 22:16:08 -0500
Subject: [PATCH] Fix the last weird hack for vaporizer using blaster for its
 secondary

---
 qcsrc/common/weapons/w_blaster.qc   |  9 ++++++---
 qcsrc/common/weapons/w_vaporizer.qc | 20 ++++++++++++--------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc
index 89faebb3a1..eae3ff0d4e 100644
--- a/qcsrc/common/weapons/w_blaster.qc
+++ b/qcsrc/common/weapons/w_blaster.qc
@@ -80,6 +80,7 @@ void W_Blaster_Think(void)
 }
 
 void W_Blaster_Attack(
+	float atk_deathtype,
 	float atk_shotangle,
 	float atk_damage,
 	float atk_edgedamage,
@@ -121,16 +122,16 @@ void W_Blaster_Attack(
 		atk_spread,
 		FALSE
 	);
-	
+
 	missile.angles = vectoangles(missile.velocity);
-	
+
 	//missile.glow_color = 250; // 244, 250
 	//missile.glow_size = 120;
 
 	missile.touch = W_Blaster_Touch;
 	missile.flags = FL_PROJECTILE;
 	missile.missile_flags = MIF_SPLASH;
-	missile.projectiledeathtype = WEP_BLASTER; 
+	missile.projectiledeathtype = atk_deathtype; 
 	missile.think = W_Blaster_Think;
 	missile.nextthink = time + atk_delay;
 
@@ -171,6 +172,7 @@ float W_Blaster(float request)
 				if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
 				{
 					W_Blaster_Attack(
+						WEP_BLASTER,
 						WEP_CVAR_PRI(blaster, shotangle),
 						WEP_CVAR_PRI(blaster, damage),
 						WEP_CVAR_PRI(blaster, edgedamage),
@@ -200,6 +202,7 @@ float W_Blaster(float request)
 						if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
 						{
 							W_Blaster_Attack(
+								WEP_BLASTER | HITTYPE_SECONDARY,
 								WEP_CVAR_SEC(blaster, shotangle),
 								WEP_CVAR_SEC(blaster, damage),
 								WEP_CVAR_SEC(blaster, edgedamage),
diff --git a/qcsrc/common/weapons/w_vaporizer.qc b/qcsrc/common/weapons/w_vaporizer.qc
index 22fa6efcff..7ad1e1dd8f 100644
--- a/qcsrc/common/weapons/w_vaporizer.qc
+++ b/qcsrc/common/weapons/w_vaporizer.qc
@@ -161,10 +161,8 @@ float W_Vaporizer(float req)
 						W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
 
 					// ugly minstagib hack to reuse the fire mode of the laser
-					float w;
-					w = self.weapon;
-					self.weapon = WEP_BLASTER;
 					W_Blaster_Attack(
+						WEP_VAPORIZER | HITTYPE_SECONDARY,
 						WEP_CVAR_SEC(vaporizer, shotangle),
 						WEP_CVAR_SEC(vaporizer, damage),
 						WEP_CVAR_SEC(vaporizer, edgedamage),
@@ -175,7 +173,6 @@ float W_Vaporizer(float req)
 						WEP_CVAR_SEC(vaporizer, delay),
 						WEP_CVAR_SEC(vaporizer, lifetime)
 					);
-					self.weapon = w;
 					
 					// now do normal refire
 					weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
@@ -260,14 +257,21 @@ float W_Vaporizer(float req)
 		{
 			vector org2;
 			org2 = w_org + w_backoff * 6;
-			pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
-			if(!w_issilent)
-				sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-				
+			if(w_deathtype & HITTYPE_SECONDARY)
+			{
+				pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
+				if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
+			}
+			else
+			{
+				pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
+				if(!w_issilent) { sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); }
+			}
 			return TRUE;
 		}
 		case WR_INIT:
 		{
+			precache_sound("weapons/laserimpact.wav");
 			precache_sound("weapons/neximpact.wav");
 			if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
 			{
-- 
2.39.5