r5536 - in trunk/data: qcsrc/client qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 15 03:04:16 EST 2009


Author: div0
Date: 2009-01-15 03:04:16 -0500 (Thu, 15 Jan 2009)
New Revision: 5536

Modified:
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/laser.qc
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/scripts/entities.def
Log:
make misc_laser more flexible


Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2009-01-15 06:58:24 UTC (rev 5535)
+++ trunk/data/qcsrc/client/View.qc	2009-01-15 08:04:16 UTC (rev 5536)
@@ -434,7 +434,7 @@
 	self = e;
 	
 	// draw radar
-	if(teamplay)
+	if(teamplay || cvar("cl_teamradar") == 2)
 	{
 		if((cvar_string("cl_teamradar") != "0" && !scoreboard_active) || ons_showmap)
 			teamradar_view();

Modified: trunk/data/qcsrc/client/laser.qc
===================================================================
--- trunk/data/qcsrc/client/laser.qc	2009-01-15 06:58:24 UTC (rev 5535)
+++ trunk/data/qcsrc/client/laser.qc	2009-01-15 08:04:16 UTC (rev 5536)
@@ -7,6 +7,8 @@
 .float count; // flags for the laser
 .vector velocity;
 .float alpha;
+.float scale; // scaling factor of the thickness
+.float modelscale; // scaling factor of the dlight
 
 // TODO move these into a heade file
 float trace_dphitq3surfaceflags;
@@ -29,20 +31,23 @@
 		if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
 			trace_endpos = self.origin + v_forward * 1048576;
 	}
-	if(self.alpha)
+	if(self.scale != 0)
 	{
-		Draw_CylindricLine(self.origin, trace_endpos, 2, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL); // TODO make a texture to make the laser look smoother
+		if(self.alpha)
+		{
+			Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL); // TODO make a texture to make the laser look smoother
+		}
+		else
+		{
+			Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
+		}
 	}
-	else
-	{
-		Draw_CylindricLine(self.origin, trace_endpos, 2, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
-	}
 	if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
 	{
 		if(self.cnt >= 0)
 			pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
-		if(self.colormod != '0 0 0')
-			R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, 50, self.colormod * 5);
+		if(self.colormod != '0 0 0' && self.modelscale != 0)
+			R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
 	}
 }
 
@@ -53,7 +58,7 @@
 
 	// 30 bytes, or 13 bytes for just moving
 	f = ReadByte();
-	self.count = (f & 0xC0);
+	self.count = (f & 0xE0);
 
 	if(self.count & 0x80)
 		self.iflags = IFLAG_VELOCITY;
@@ -75,6 +80,13 @@
 			self.alpha = ReadByte() / 255.0;
 		else
 			self.alpha = 0;
+		self.scale = 2;
+		self.modelscale = 50;
+		if(f & 0x20)
+		{
+			self.scale *= ReadByte() / 16.0; // beam radius
+			self.modelscale *= ReadByte() / 16.0; // dlight radius
+		}
 		self.cnt = ReadShort() - 1; // effect number
 	}
 	if(f & 2)

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2009-01-15 06:58:24 UTC (rev 5535)
+++ trunk/data/qcsrc/server/g_triggers.qc	2009-01-15 08:04:16 UTC (rev 5536)
@@ -760,6 +760,7 @@
 
 void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float deathtype);
 
+.float modelscale;
 void misc_laser_aim()
 {
 	vector a;
@@ -874,11 +875,13 @@
 float laser_SendEntity(entity to, float fl)
 {
 	WriteByte(MSG_ENTITY, ENT_CLIENT_LASER);
-	fl = fl - (fl & 0xC0); // use that bit to indicate finite length laser
+	fl = fl - (fl & 0xE0); // use that bit to indicate finite length laser
 	if(self.spawnflags & 2)
 		fl |= 0x80;
 	if(self.alpha)
 		fl |= 0x40;
+	if(self.scale != 1 || self.modelscale != 1)
+		fl |= 0x20;
 	WriteByte(MSG_ENTITY, fl);
 	if(fl & 1)
 	{
@@ -893,6 +896,11 @@
 		WriteByte(MSG_ENTITY, self.colormod_z * 255.0);
 		if(fl & 0x40)
 			WriteByte(MSG_ENTITY, self.alpha * 255.0);
+		if(fl & 0x20)
+		{
+			WriteByte(MSG_ENTITY, bound(0, self.scale * 16.0, 255));
+			WriteByte(MSG_ENTITY, bound(0, self.modelscale * 16.0, 255));
+		}
 		WriteShort(MSG_ENTITY, self.cnt + 1);
 	}
 	if(fl & 2)
@@ -964,6 +972,10 @@
 		self.message = "saw the light";
 	if (!self.message2)
 		self.message2 = "was pushed into a laser by";
+	if(!self.scale)
+		self.scale = 1;
+	if(!self.modelscale)
+		self.modelscale = 1;
 	self.think = misc_laser_think;
 	self.nextthink = time;
 	InitializeEntity(self, misc_laser_init, INITPRIO_FINDTARGET);

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-01-15 06:58:24 UTC (rev 5535)
+++ trunk/data/scripts/entities.def	2009-01-15 08:04:16 UTC (rev 5536)
@@ -573,6 +573,8 @@
 dmg: damage inflicted by the beam per second, or -1 for an instant-death ray
 targetname: name to target this (then its state is toggled)
 alpha: when set, makes a dark laser of the given strength; may be combined with colormod
+scale: scales the beam thickness (default 1)
+modelscale: scales the dynamic light radius at the endpoint (default 1, -1 to turn off)
 -------- SPAWNFLAGS --------
 START_ON: when targeted, the laser will start switched on
 FINITE: the laser does not extend over its target like light would do, but stops there (takes more bandwidth)




More information about the nexuiz-commits mailing list