r66 - trunk/basezym/progsqc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jul 9 15:24:07 EDT 2007


Author: vermeulen
Date: 2007-07-09 15:24:06 -0400 (Mon, 09 Jul 2007)
New Revision: 66

Modified:
   trunk/basezym/progsqc/actor.qc
   trunk/basezym/progsqc/damage.qc
   trunk/basezym/progsqc/inventory.qc
Log:
Added 'tracer', 'modelscale' option to projectiles

Modified: trunk/basezym/progsqc/actor.qc
===================================================================
--- trunk/basezym/progsqc/actor.qc	2007-06-29 03:29:44 UTC (rev 65)
+++ trunk/basezym/progsqc/actor.qc	2007-07-09 19:24:06 UTC (rev 66)
@@ -373,6 +373,9 @@
 	local string shotexplodesound;
 	local string shotbouncesound;
 	local vector muzzle1tagorigin, muzzle2tagorigin, muzzle3tagorigin;
+	local string tracermodel;
+	local float tracer;
+	local float modelscale;
 	muzzle1tagorigin = muzzle2tagorigin = muzzle3tagorigin = self.origin + self.weapon_ofs_x * v_forward + self.weapon_ofs_y * v_right + self.weapon_ofs_z * '0 0 1';
 	makevectors(self.v_angle);
 	if (secondary)
@@ -390,6 +393,9 @@
 		numberof = iteminfo_ammo2numberof;
 		recoil = iteminfo_ammo2recoil;
 		mintofire = iteminfo_ammo2minimumtofire;
+		tracer = iteminfo_ammo2tracer;
+		tracermodel = iteminfo_ammo2tracermodel;
+		modelscale = iteminfo_ammo2modelscale;
 	}
 	else
 	{
@@ -406,13 +412,16 @@
 		numberof = iteminfo_ammo1numberof;
 		recoil = iteminfo_ammo1recoil;
 		mintofire = iteminfo_ammo1minimumtofire;
+		tracer = iteminfo_ammo1tracer;
+		tracermodel = iteminfo_ammo1tracermodel;
+		modelscale = iteminfo_ammo1modelscale;
 	}
 
 	Inventory_ModifyItem(self, self.weaponitem, 0, 0 - mintofire, 0);
 	weapon_recoil(recoil);
 	while (numberof != 0)
 	{
-		  weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);	
+		  weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound, tracer, tracermodel, modelscale);	
 		  numberof = numberof - 1;
 	}
 };

Modified: trunk/basezym/progsqc/damage.qc
===================================================================
--- trunk/basezym/progsqc/damage.qc	2007-06-29 03:29:44 UTC (rev 65)
+++ trunk/basezym/progsqc/damage.qc	2007-07-09 19:24:06 UTC (rev 66)
@@ -332,23 +332,38 @@
 float PROJECTILEFLAG_RICOCHET = 8;
 float PROJECTILEFLAG_ROCKET = 16;
 float PROJECTILEFLAG_EXPLODE = 32;
-float PROJECTILEFLAG_PLASMA = 64;
+float PROJECTILEFLAG_ELECTRICITY = 64;
 float PROJECTILEFLAG_MUZZLEFLASH = 128;
 float PROJECTILEFLAG_SEMIAUTOMATIC = 256; // not actually used by projectile code, but a convenient place to store this
 float PROJECTILEFLAG_GLOW = 512;
 float PROJECTILEFLAG_EXPLODELARGE = 1024;
-float PROJECTILEFLAG_PLASMALARGE = 2048;
+float PROJECTILEFLAG_SNIPERRAIL = 2048;
+float PROJECTILEFLAG_PLASMA = 4096;
+float PROJECTILEFLAG_ASSAULTRAIL = 8192;
 
 .float weaponsound_cycle; // templeofnoise: added for minigun routing sound, guess i'll use it for other sound specs also.
 
+void(string tracermodel, vector dir, vector org) fire_tracer =
+{
+ 	local entity e;
+	e = spawn();
+	e.owner = self;
+	e.movetype = MOVETYPE_FLY;
+	e.solid = SOLID_BBOX;
+	e.think = SUB_Remove;
+	e.touch = SUB_Remove;
+	e.nextthink = time + 10;
+	e.velocity = dir;
+	e.angles = vectoangles(e.velocity);
+	setmodel (e, tracermodel);
+	setorigin (e, org);
+	setsize(e, '0 0 0', '0 0 0');
+	e.lefty = 17;
+}
+
 void() projectile_die =
 {
 
-// GENERAL TODO: too many entities can create a bad effect like spawning sounds in wrong place
-// ricochet sound is expendable, so it could be good to add a "sound counter" that avoid ricochet to spawn
-// if "too many" ricochets are counted in a specific frame.
-// EXAMPLE: 5 clients shooting each other with minigun in deathmatch ..
-
 	local float r; // templeofnoise
 
 	if (self.weaponsound_cycle) // templeofnoise
@@ -388,12 +403,12 @@
 		te_explosion(self.origin);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_PLASMALARGE)
+	else if (self.lefty & PROJECTILEFLAG_SNIPERRAIL)
 	{
 		te_plasmaburn(self.origin);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_PLASMA)
+	else if (self.lefty & PROJECTILEFLAG_ELECTRICITY)
 	{
 		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
 		WriteByte (MSG_BROADCAST, 79);
@@ -406,6 +421,16 @@
 		WriteByte (MSG_BROADCAST, 155);
 		remove(self);
 	}
+	else if (self.lefty & PROJECTILEFLAG_PLASMA)
+	{
+		te_knightspike(self.origin);
+		remove(self);
+	}
+	else if (self.lefty & PROJECTILEFLAG_ASSAULTRAIL)
+	{
+		te_gunshotquad(self.origin);
+		remove(self);
+	}
 	else // metal projectile of some sort (bullet, shrapnel, railgun bolt, etc)
 	{
 		te_gunshot(self.origin);
@@ -462,10 +487,10 @@
 	}
 }
 
-void(string modelname, vector shotorg, vector shotvel, vector damage, float damagtype, float lifetime, float projectileflags, string firesound, string explodesound, string bouncesound) weapon_fireprojectile =
+void(string modelname, vector shotorg, vector shotvel, vector damage, float damagtype, float lifetime, float projectileflags, string firesound, string explodesound, string bouncesound, float tracer, string tracermodel, float modelscale) weapon_fireprojectile =
 {
 	local float r; // templeofnoise
-	
+
  	newmis = spawn();
  	newmis.classname = "projectile";
  	newmis.solid = SOLID_BBOX;
@@ -473,7 +498,7 @@
  	newmis.damagetype = damagtype;
  	newmis.damageinfo = damage;
 	shotvel = v_forward * shotvel_x + v_up * shotvel_y + shotvel_z * randomvec();
- 	newmis.velocity = shotvel;
+	newmis.velocity = shotvel;
  	newmis.angles = vectoangles(shotvel);
  	newmis.th_die = projectile_die;
  	newmis.touch = projectile_touch;
@@ -488,7 +513,13 @@
  	setorigin(newmis, shotorg);
  	setmodel(newmis, modelname);
  	setsize(newmis, '0 0 0', '0 0 0');
+	newmis.scale = modelscale;
 
+	if (tracer > random())
+	{
+	   fire_tracer(tracermodel,shotvel,shotorg);
+	}
+	
 	if (firesound == "weapons/minigun_bulletfire1.wav") // templeofnoise: not so elegant checking a "string", FIXME with weapon check.
 	{
 		if (self.weaponsound_cycle == 0)

Modified: trunk/basezym/progsqc/inventory.qc
===================================================================
--- trunk/basezym/progsqc/inventory.qc	2007-06-29 03:29:44 UTC (rev 65)
+++ trunk/basezym/progsqc/inventory.qc	2007-07-09 19:24:06 UTC (rev 66)
@@ -79,6 +79,12 @@
 string iteminfo_model;
 string iteminfo_pickupsound;
 string iteminfo_name;
+float iteminfo_ammo1tracer;
+float iteminfo_ammo2tracer;
+string iteminfo_ammo1tracermodel;
+string iteminfo_ammo2tracermodel;
+float iteminfo_ammo1modelscale;
+float iteminfo_ammo2modelscale;
 
 // special information specific to weapon items
 string iteminfo_weapon_viewmodel;
@@ -150,6 +156,9 @@
 	iteminfo_ammo1bouncesound = "";
 	iteminfo_ammo1numberof = 1;
 	iteminfo_ammo1recoil = 0;
+	iteminfo_ammo1tracer = 0;
+	iteminfo_ammo1tracermodel = "";
+	iteminfo_ammo1modelscale = 1;
 	iteminfo_ammo2max = 0;
 	iteminfo_ammo2inventorymax = 0;
 	iteminfo_ammo2minimumtofire = 0;
@@ -165,6 +174,9 @@
 	iteminfo_ammo2bouncesound = "";
 	iteminfo_ammo2numberof = 1;
 	iteminfo_ammo2recoil = 0;
+	iteminfo_ammo2tracer = 0;
+	iteminfo_ammo2tracermodel = "";
+	iteminfo_ammo2modelscale = 1;
 	iteminfo_weapon_viewmodel = "";
 	iteminfo_weapon_viewmodelanim_idle = '0 0 1';
 	iteminfo_weapon_viewmodelanim_fire1 = '0 0 2';
@@ -213,6 +225,9 @@
 		iteminfo_ammo1recoil = cvar(wname,"_ammo1recoil");
 		iteminfo_ammo1minimumtofire = cvar(wname,"_ammo1mintofire");
 		iteminfo_ammo1lifetime = cvar(wname,"_ammo1lifetime");
+		iteminfo_ammo1tracer = cvar(wname,"_ammo1tracer");
+		iteminfo_ammo1tracermodel = cvar_string(wname,"_ammo1tracermodel");
+		iteminfo_ammo1modelscale = cvar(wname,"_ammo1modelscale");
 		iteminfo_weapon_viewmodelanim_fire1 = stov(cvar_string(wname,"_fire1"));
 		
 		iteminfo_ammo2damage = stov(cvar_string(wname,"_ammo2damage"));
@@ -226,57 +241,20 @@
 		iteminfo_ammo2recoil = cvar(wname,"_ammo2recoil");
 		iteminfo_ammo2minimumtofire = cvar(wname,"_ammo2mintofire");
 		iteminfo_ammo2lifetime = cvar(wname,"_ammo2lifetime");
+		iteminfo_ammo2tracer = cvar(wname,"_ammo2tracer");
+		iteminfo_ammo2tracermodel = cvar_string(wname,"_ammo2tracermodel");
+		iteminfo_ammo2modelscale = cvar(wname,"_ammo2modelscale");
 		iteminfo_weapon_viewmodelanim_fire2 = stov(cvar_string(wname,"_fire2"));
 	}
-	else if (itemtype == ITEMTYPE_WEAP1_AMMO)
+	else if (itemtype < ITEMTYPE_TOTAL)
 	{
-		iteminfo_name = cvar_string("g_weap1_ammo_name");
-		iteminfo_model = cvar_string("g_weap1_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap1_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap1_quantitymax");
+	 	string wname;
+		wname = strcat("g_weap",ftos(itemtype - ITEMTYPE_WEAP1_AMMO));
+		iteminfo_name = cvar_string(wname,"_ammo_name");
+		iteminfo_model = cvar_string(wname,"_ammo_model");
+		iteminfo_pickupsound = cvar_string(wname,"_ammo_ammo_pickupsound");
+		iteminfo_quantitymax = cvar(wname,"_quantitymax");
 	}
-	else if (itemtype == ITEMTYPE_WEAP2_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap2_ammo_name");
-		iteminfo_model = cvar_string("g_weap2_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap2_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap2_quantitymax");
-	}
-	else if (itemtype == ITEMTYPE_WEAP3_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap3_ammo_name");
-		iteminfo_model = cvar_string("g_weap3_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap3_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap3_quantitymax");
-	}
-	else if (itemtype == ITEMTYPE_WEAP4_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap4_ammo_name");
-		iteminfo_model = cvar_string("g_weap4_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap4_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap4_quantitymax");
-	}
-	else if (itemtype == ITEMTYPE_WEAP5_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap5_ammo_name");
-		iteminfo_model = cvar_string("g_weap5_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap5_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap5_quantitymax");
-	}
-	else if (itemtype == ITEMTYPE_WEAP6_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap6_ammo_name");
-		iteminfo_model = cvar_string("g_weap6_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap6_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap6_quantitymax");
-	}
-	else if (itemtype == ITEMTYPE_WEAP7_AMMO)
-	{
-		iteminfo_name = cvar_string("g_weap7_ammo_name");
-		iteminfo_model = cvar_string("g_weap7_ammo_model");
-		iteminfo_pickupsound = cvar_string("g_weap7_ammo_pickupsound");
-		iteminfo_quantitymax = cvar("g_weap7_quantitymax");
-	}
 	else
 		error(ftos(itemtype)," Inventory_GetItemInfo: unknown itemtype\n");
 	




More information about the zymotic-commits mailing list