[nexuiz-commits] r6193 - in branches/nexuiz-2.0: . data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Mar 16 05:54:24 EDT 2009


Author: div0
Date: 2009-03-16 05:54:24 -0400 (Mon, 16 Mar 2009)
New Revision: 6193

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
   branches/nexuiz-2.0/data/qcsrc/server/w_rocketlauncher.qc
   branches/nexuiz-2.0/data/qcsrc/server/w_shotgun.qc
   branches/nexuiz-2.0/data/qcsrc/server/w_uzi.qc
Log:
r6192 | div0 | 2009-03-16 10:53:02 +0100 (Mon, 16 Mar 2009) | 2 lines
simpler muzzle flash handling


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-03-16 09:53:02 UTC (rev 6192)
+++ branches/nexuiz-2.0/.patchsets	2009-03-16 09:54:24 UTC (rev 6193)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-6039,6044-6106,6108-6125,6129-6158,6160-6160,6162-6169,6171-6181,6183-6190
+revisions_applied = 1-6039,6044-6106,6108-6125,6129-6158,6160-6160,6162-6169,6171-6181,6183-6192

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2009-03-16 09:53:02 UTC (rev 6192)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2009-03-16 09:54:24 UTC (rev 6193)
@@ -355,8 +355,9 @@
 			self.angles = '0 0 0';
 			makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
 			self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
-			self.movedir_x += 30;
+			self.movedir_x += 32;
 			self.spawnorigin = self.movedir;
+			// oldorigin - not calculated here
 		}
 		else
 		{
@@ -388,6 +389,17 @@
 				self.spawnorigin = self.movedir;
 			}
 
+			float idx;
+			idx = gettagindex(self, "weapon");
+			if(idx)
+			{
+				self.oldorigin = self.movedir - gettaginfo(self, idx);
+			}
+			else
+			{
+				self.oldorigin = self.movedir;
+			}
+
 			self.viewmodelforclient = self.owner;
 		}
 
@@ -1084,3 +1096,29 @@
 
 	missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, missile.velocity);
 }
+
+void W_AttachToShotorg(entity flash, vector offset)
+{
+	entity xflash;
+	flash.owner = self;
+	flash.angles_z = random() * 360;
+	if(qcweaponanimation)
+	{
+		setorigin(flash, w_shotorg + w_shotdir * 50);
+		flash.angles = vectoangles(w_shotdir);
+		flash.angles_z = random() * 360;
+	}
+	else
+	{
+		setattachment(flash, self.weaponentity, "shot");
+		setorigin(flash, offset);
+
+		xflash = spawn();
+		copyentity(flash, xflash);
+
+		flash.viewmodelforclient = self;
+
+		setattachment(xflash, self.exteriorweaponentity, "");
+		setorigin(xflash, self.weaponentity.oldorigin + offset);
+	}
+}

Modified: branches/nexuiz-2.0/data/qcsrc/server/w_rocketlauncher.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/w_rocketlauncher.qc	2009-03-16 09:53:02 UTC (rev 6192)
+++ branches/nexuiz-2.0/data/qcsrc/server/w_rocketlauncher.qc	2009-03-16 09:54:24 UTC (rev 6193)
@@ -193,7 +193,7 @@
 void W_Rocket_Attack (void)
 {
 	local entity missile;
-	local entity flash, flash2;
+	local entity flash;
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_rocketlauncher_ammo");
@@ -240,27 +240,12 @@
 
 	// muzzle flash for 1st person view
 	flash = spawn ();
-	flash.angles_z = flash.v_angle_z + random() * 180;
-	flash.owner = self;
-	flash.viewmodelforclient = self;
-	flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
-	setorigin (flash, '5 0 0');
 	setmodel (flash, "models/flash.md3"); // precision set below
-	setattachment(flash, self.weaponentity, "shot");
 	SUB_SetFade (flash, time, 0.1);
+	flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+	W_AttachToShotorg(flash, '5 0 0');
 
-	// muzzle flash for 3rd person view
-	flash2 = spawn ();
-	flash2.scale = 0.8;
-	flash2.angles_y = 180;
-	flash2.angles_z = 90;
-	setorigin (flash2, '42 0 5');
-	setmodel (flash2, "models/flash.md3"); // precision set below
-	setattachment(flash2, self.exteriorweaponentity, "");
-	SUB_SetFade (flash2, time, 0.4);
-
 	// common properties
-	flash.effects = flash2.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
 }
 
 void spawnfunc_weapon_rocketlauncher (void); // defined in t_items.qc

Modified: branches/nexuiz-2.0/data/qcsrc/server/w_shotgun.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/w_shotgun.qc	2009-03-16 09:53:02 UTC (rev 6192)
+++ branches/nexuiz-2.0/data/qcsrc/server/w_shotgun.qc	2009-03-16 09:54:24 UTC (rev 6193)
@@ -34,17 +34,11 @@
 
 	// muzzle flash for 1st person view
 	flash = spawn();
-	setorigin(flash, '5 0 0');
 	setmodel(flash, "models/uziflash.md3"); // precision set below
-	setattachment(flash, self.weaponentity, "shot");
-	flash.owner = self;
-	flash.viewmodelforclient = self;
-	flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
 	flash.think = SUB_Remove;
 	flash.nextthink = time + 0.06;
-	flash.angles_z = flash.v_angle_z + random() * 180;
-	flash.alpha = 1;
 	flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+	W_AttachToShotorg(flash, '5 0 0');
 
 }
 
@@ -82,18 +76,12 @@
 			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);
 
 	flash = spawn();
-	setorigin(flash, '5 0 0');
 	setmodel(flash, "models/uziflash.md3"); // precision set below
-	setattachment(flash, self.weaponentity, "shot");
-	flash.owner = self;
-	flash.viewmodelforclient = self;
-	flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
 	flash.scale = 1.2;
 	flash.think = SUB_Remove;
 	flash.nextthink = time + 0.06;
-	flash.angles_z = flash.v_angle_z + random() * 180;
-	flash.alpha = 1;
 	flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+	W_AttachToShotorg(flash, '5 0 0');
 }
 
 // weapon frames

Modified: branches/nexuiz-2.0/data/qcsrc/server/w_uzi.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/w_uzi.qc	2009-03-16 09:53:02 UTC (rev 6192)
+++ branches/nexuiz-2.0/data/qcsrc/server/w_uzi.qc	2009-03-16 09:54:24 UTC (rev 6193)
@@ -13,7 +13,7 @@
 .float uzi_bulletcounter;
 void W_Uzi_Attack (float deathtype)
 {
-	local entity flash, flash2;
+	local entity flash;
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 	{
@@ -41,31 +41,15 @@
 
 	// muzzle flash for 1st person view
 	flash = spawn();
-	setorigin(flash, '5 0 0');
 	setmodel(flash, "models/uziflash.md3"); // precision set below
-	setattachment(flash, self.weaponentity, "shot");
-	flash.owner = self;
-	flash.viewmodelforclient = self;
-	flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
 	//SUB_SetFade(flash, time + 0.06, 0);
 	flash.think = W_Uzi_Flash_Go;
 	flash.nextthink = time + 0.02;
 	flash.frame = 2;
+	flash.alpha = 1;
+	flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+	W_AttachToShotorg(flash, '5 0 0');
 
-	// muzzle flash for 3rd person view
-	flash2 = spawn();
-	setorigin(flash2, '43 1 8');
-	setmodel(flash2, "models/uziflash.md3"); // precision set below
-	setattachment(flash2, self.exteriorweaponentity, "");
-	//SUB_SetFade(flash2, time + 0.06, 0);
-	flash2.think = W_Uzi_Flash_Go;
-	flash2.nextthink = time + 0.02;
-	flash2.frame = 2;
-	// common properties
-	flash.angles_z = flash2.angles_z = flash.v_angle_z + random() * 180;
-	flash.alpha = flash2.alpha = 1;
-	flash.effects = flash2.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
-
 	// casing code
 	if (cvar("g_casings") >= 2)
 		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);



More information about the nexuiz-commits mailing list