From 39076504f545443da24e95b5de94978f023d4451 Mon Sep 17 00:00:00 2001 From: savagex Date: Mon, 27 Nov 2006 14:45:07 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1940 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/g_triggers.qc | 106 ++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/data/qcsrc/server/g_triggers.qc b/data/qcsrc/server/g_triggers.qc index a8e3e7567..86ae26028 100644 --- a/data/qcsrc/server/g_triggers.qc +++ b/data/qcsrc/server/g_triggers.qc @@ -430,4 +430,110 @@ void() func_sparks = } */ +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; +}; + -- 2.39.2