r1940 - branches/nexuiz-2.0/data/qcsrc/server trunk/data/qcsrc/server
savagex at icculus.org
savagex at icculus.org
Mon Nov 27 09:45:07 EST 2006
Author: savagex
Date: 2006-11-27 09:45:07 -0500 (Mon, 27 Nov 2006)
New Revision: 1940
Modified:
branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc
trunk/data/qcsrc/server/g_triggers.qc
Log:
add func_rain and func_snow from dpmod to Nexuiz trunk and branch. Those
are well tested, unmodified code fragments and add... well... rain and
snow
Modified: branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc 2006-11-27 12:16:28 UTC (rev 1939)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc 2006-11-27 14:45:07 UTC (rev 1940)
@@ -429,5 +429,110 @@
}
}
*/
+void() rain_think =
+{
+ self.nextthink = time + 0.1;
+ te_particlerain(self.absmin, self.absmax, self.dest, self.count, self.cnt);
+// te_particlesnow(self.absmin, self.absmax, self.dest * 0.25, self.count, self.cnt);
+// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+// WriteByte (MSG_BROADCAST, TE_PARTICLERAIN);
+// WriteVec (MSG_BROADCAST, self.absmin);
+// WriteVec (MSG_BROADCAST, self.absmax);
+// WriteVec (MSG_BROADCAST, self.dest);
+// WriteShort (MSG_BROADCAST, self.count);
+// WriteByte (MSG_BROADCAST, self.cnt);
+};
+/*QUAKED func_rain (0 .5 .8) ?
+This is an invisible area like a trigger, which rain falls inside of.
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts rain density, this many particles fall every second, experiment to see the effects (default is based on area size)
+*/
+void() func_rain =
+{
+ self.dest = self.velocity;
+ self.velocity = '0 0 0';
+ if (!self.dest)
+ self.dest = '0 0 -700';
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel(self, self.model);
+ setorigin(self, self.origin);
+ setsize(self, self.mins, self.maxs);
+ self.model = "";
+ if (!self.cnt)
+ self.cnt = 12;
+ if (!self.count)
+ self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
+ if (self.count < 1)
+ {
+ remove(self);
+ return;
+ }
+ // convert from per second to per 0.1 sec,
+ self.count = ceil(self.count * 0.1);
+ self.think = rain_think;
+ self.nextthink = time + 0.5;
+};
+
+
+void() snow_think =
+{
+ self.nextthink = time + 0.1;
+ te_particlesnow(self.absmin, self.absmax, self.dest, self.count, self.cnt);
+// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+// WriteByte (MSG_BROADCAST, TE_PARTICLESNOW);
+// WriteVec (MSG_BROADCAST, self.absmin);
+// WriteVec (MSG_BROADCAST, self.absmax);
+// WriteVec (MSG_BROADCAST, self.dest);
+// WriteShort (MSG_BROADCAST, self.count);
+// WriteByte (MSG_BROADCAST, self.cnt);
+};
+
+/*QUAKED func_snow (0 .5 .8) ?
+This is an invisible area like a trigger, which snow falls inside of.
+
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts snow density, this many particles fall every second, experiment to see the effects (default is based on area size)
+*/
+void() func_snow =
+{
+ self.dest = self.velocity;
+ self.velocity = '0 0 0';
+ if (!self.dest)
+ self.dest = '0 0 -300';
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel(self, self.model);
+ setorigin(self, self.origin);
+ setsize(self, self.mins, self.maxs);
+ self.model = "";
+ if (!self.cnt)
+ self.cnt = 12;
+ if (!self.count)
+ self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
+ if (self.count < 1)
+ {
+ remove(self);
+ return;
+ }
+ // convert from per second to per 0.1 sec,
+ self.count = ceil(self.count * 0.1);
+ self.think = snow_think;
+ self.nextthink = time + 0.5;
+};
+
+
Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc 2006-11-27 12:16:28 UTC (rev 1939)
+++ trunk/data/qcsrc/server/g_triggers.qc 2006-11-27 14:45:07 UTC (rev 1940)
@@ -430,4 +430,110 @@
}
*/
+void() rain_think =
+{
+ self.nextthink = time + 0.1;
+ te_particlerain(self.absmin, self.absmax, self.dest, self.count, self.cnt);
+// te_particlesnow(self.absmin, self.absmax, self.dest * 0.25, self.count, self.cnt);
+// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+// WriteByte (MSG_BROADCAST, TE_PARTICLERAIN);
+// WriteVec (MSG_BROADCAST, self.absmin);
+// WriteVec (MSG_BROADCAST, self.absmax);
+// WriteVec (MSG_BROADCAST, self.dest);
+// WriteShort (MSG_BROADCAST, self.count);
+// WriteByte (MSG_BROADCAST, self.cnt);
+};
+/*QUAKED func_rain (0 .5 .8) ?
+This is an invisible area like a trigger, which rain falls inside of.
+
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts rain density, this many particles fall every second, experiment to see the effects (default is based on area size)
+*/
+void() func_rain =
+{
+ self.dest = self.velocity;
+ self.velocity = '0 0 0';
+ if (!self.dest)
+ self.dest = '0 0 -700';
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel(self, self.model);
+ setorigin(self, self.origin);
+ setsize(self, self.mins, self.maxs);
+ self.model = "";
+ if (!self.cnt)
+ self.cnt = 12;
+ if (!self.count)
+ self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
+ if (self.count < 1)
+ {
+ remove(self);
+ return;
+ }
+ // convert from per second to per 0.1 sec,
+ self.count = ceil(self.count * 0.1);
+ self.think = rain_think;
+ self.nextthink = time + 0.5;
+};
+
+
+void() snow_think =
+{
+ self.nextthink = time + 0.1;
+ te_particlesnow(self.absmin, self.absmax, self.dest, self.count, self.cnt);
+// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+// WriteByte (MSG_BROADCAST, TE_PARTICLESNOW);
+// WriteVec (MSG_BROADCAST, self.absmin);
+// WriteVec (MSG_BROADCAST, self.absmax);
+// WriteVec (MSG_BROADCAST, self.dest);
+// WriteShort (MSG_BROADCAST, self.count);
+// WriteByte (MSG_BROADCAST, self.cnt);
+};
+
+/*QUAKED func_snow (0 .5 .8) ?
+This is an invisible area like a trigger, which snow falls inside of.
+
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts snow density, this many particles fall every second, experiment to see the effects (default is based on area size)
+*/
+void() func_snow =
+{
+ self.dest = self.velocity;
+ self.velocity = '0 0 0';
+ if (!self.dest)
+ self.dest = '0 0 -300';
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel(self, self.model);
+ setorigin(self, self.origin);
+ setsize(self, self.mins, self.maxs);
+ self.model = "";
+ if (!self.cnt)
+ self.cnt = 12;
+ if (!self.count)
+ self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
+ if (self.count < 1)
+ {
+ remove(self);
+ return;
+ }
+ // convert from per second to per 0.1 sec,
+ self.count = ceil(self.count * 0.1);
+ self.think = snow_think;
+ self.nextthink = time + 0.5;
+};
+
+
More information about the nexuiz-commits
mailing list