[nexuiz-commits] r7514 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 25 02:55:33 EDT 2009


Author: div0
Date: 2009-08-25 02:55:33 -0400 (Tue, 25 Aug 2009)
New Revision: 7514

Modified:
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/mode_onslaught.qc
Log:
onslaught shockwave: make this feature available to all game modes by refactoring it out


Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-08-24 19:29:25 UTC (rev 7513)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-08-25 06:55:33 UTC (rev 7514)
@@ -2468,3 +2468,54 @@
 
     return world;
 }
+
+
+void shockwave_think()
+{
+	float t;
+	self.nextthink = time;
+
+	t = time - self.fade_time;
+	if(t < 0)
+	{
+		self.alpha = 1;
+	}
+	else
+	{
+		self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
+	}
+
+	print(ftos(time), " ", ftos(self.alpha), "\n");
+
+	if(self.alpha < 0.003)
+	{
+		remove(self);
+		return;
+	}
+
+	self.scale = (time - self.teleport_time) / (self.fade_time + 1 / self.fade_rate - self.teleport_time) * self.count;
+
+	print(ftos(self.scale), "\n");
+
+	self.frame = self.count;
+};
+
+void shockwave_spawn(string m, vector org, float sz, float t1, float t2)
+{
+	entity e;
+	e = spawn();
+	e.classname = "shockwave";
+	setmodel(e, m);
+	setorigin(e, org);
+	e.alpha = -1;
+	e.frame = 0;
+	e.count = 0;
+	e.think = shockwave_think;
+	e.nextthink = time;
+	e.fade_time = time + t1;
+	e.fade_rate = 1/t2;
+	e.teleport_time = time;
+	e.count = bound(0, sz / max6(-e.mins_x, -e.mins_y, -e.mins_z, e.maxs_x, e.maxs_y, e.maxs_z), 16);
+	print(vtos(e.mins), " ", vtos(e.maxs), "\n");
+	setsize(e, e.mins * sz, e.maxs * sz);
+}

Modified: trunk/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- trunk/data/qcsrc/server/mode_onslaught.qc	2009-08-24 19:29:25 UTC (rev 7513)
+++ trunk/data/qcsrc/server/mode_onslaught.qc	2009-08-25 06:55:33 UTC (rev 7514)
@@ -484,18 +484,7 @@
 
 void onslaught_generator_shockwave_spawn(vector org)
 {
-	entity e;
-	e = spawn();
-	setmodel(e, "models/onslaught/shockwave.md3");
-	setorigin(e, org);
-
-	e.alpha = 0;
-	e.frame = 0;
-	e.count = 0;
-
-
-	e.think = onslaught_generator_shockwave_think;
-	e.nextthink = time + 0.05;
+	shockwave_spawn("models/onslaught/shockwave.md3", org, 5120, 0.75, 0.5);
 };
 
 void onslaught_generator_damage_think()



More information about the nexuiz-commits mailing list