]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/rain.qc
Adjusted the control panel to fit with the other option panels (height).
[divverent/nexuiz.git] / qcsrc / rain.qc
1 void() rain_think =
2 {
3         self.nextthink = time + 0.1;
4         te_particlerain(self.absmin, self.absmax, self.destvec, self.count, self.cnt);
5 //      te_particlesnow(self.absmin, self.absmax, self.destvec * 0.25, self.count, self.cnt);
6 //      WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
7 //      WriteByte (MSG_BROADCAST, TE_PARTICLERAIN);
8 //      WriteVec (MSG_BROADCAST, self.absmin);
9 //      WriteVec (MSG_BROADCAST, self.absmax);
10 //      WriteVec (MSG_BROADCAST, self.destvec);
11 //      WriteShort (MSG_BROADCAST, self.count);
12 //      WriteByte (MSG_BROADCAST, self.cnt);
13 };
14
15 /*QUAKED func_rain (0 .5 .8) ?
16 This is an invisible area like a trigger, which rain falls inside of.
17
18 Keys:
19 "velocity"
20  falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
21 "cnt"
22  sets color of rain (default 12 - white)
23 "count"
24  adjusts rain density, this many particles fall every second, experiment to see the effects (default is based on area size)
25 */
26 void() func_rain =
27 {
28         self.destvec = self.velocity;
29         self.velocity = '0 0 0';
30         if (!self.destvec)
31                 self.destvec = '0 0 -700';
32         self.angles = '0 0 0';
33         self.movetype = MOVETYPE_NONE;
34         self.solid = SOLID_NOT;
35         setmodel(self, self.model);
36         setorigin(self, self.origin);
37         setsize(self, self.mins, self.maxs);
38         self.model = "";
39         if (!self.cnt)
40                 self.cnt = 12;
41         if (!self.count)
42                 self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
43         if (self.count < 1)
44         {
45                 remove(self);
46                 return;
47         }
48         // convert from per second to per 0.1 sec,
49         self.count = ceil(self.count * 0.1);
50         self.think = rain_think;
51         self.nextthink = time + 0.5;
52 };
53
54 void() snow_think =
55 {
56         self.nextthink = time + 0.1;
57         te_particlesnow(self.absmin, self.absmax, self.destvec, self.count, self.cnt);
58 //      WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
59 //      WriteByte (MSG_BROADCAST, TE_PARTICLESNOW);
60 //      WriteVec (MSG_BROADCAST, self.absmin);
61 //      WriteVec (MSG_BROADCAST, self.absmax);
62 //      WriteVec (MSG_BROADCAST, self.destvec);
63 //      WriteShort (MSG_BROADCAST, self.count);
64 //      WriteByte (MSG_BROADCAST, self.cnt);
65 };
66
67 /*QUAKED func_snow (0 .5 .8) ?
68 This is an invisible area like a trigger, which snow falls inside of.
69
70 Keys:
71 "velocity"
72  falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
73 "cnt"
74  sets color of rain (default 12 - white)
75 "count"
76  adjusts snow density, this many particles fall every second, experiment to see the effects (default is based on area size)
77 */
78 void() func_snow =
79 {
80         self.destvec = self.velocity;
81         self.velocity = '0 0 0';
82         if (!self.destvec)
83                 self.destvec = '0 0 -300';
84         self.angles = '0 0 0';
85         self.movetype = MOVETYPE_NONE;
86         self.solid = SOLID_NOT;
87         setmodel(self, self.model);
88         setorigin(self, self.origin);
89         setsize(self, self.mins, self.maxs);
90         self.model = "";
91         if (!self.cnt)
92                 self.cnt = 12;
93         if (!self.count)
94                 self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192;
95         if (self.count < 1)
96         {
97                 remove(self);
98                 return;
99         }
100         // convert from per second to per 0.1 sec,
101         self.count = ceil(self.count * 0.1);
102         self.think = snow_think;
103         self.nextthink = time + 0.5;
104 };
105
106 void() particlecube_think =
107 {
108         self.nextthink = time + 0.1;
109         te_particlecube(self.absmin, self.absmax, self.destvec, self.count, self.cnt, (self.spawnflags & 1) != 0, self.cnt2);
110 //      WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
111 //      WriteByte (MSG_BROADCAST, TE_PARTICLECUBE);
112 //      WriteVec (MSG_BROADCAST, self.absmin);
113 //      WriteVec (MSG_BROADCAST, self.absmax);
114 //      WriteVec (MSG_BROADCAST, self.destvec);
115 //      WriteShort (MSG_BROADCAST, self.count);
116 //      WriteByte (MSG_BROADCAST, self.cnt);
117 //      if (self.spawnflags & 1)
118 //              WriteByte (MSG_BROADCAST, 1);
119 //      else
120 //              WriteByte (MSG_BROADCAST, 0);
121 //      WriteCoord (MSG_BROADCAST, self.cnt2);
122 };
123
124 /*QUAKED func_particlecube (0 .5 .8) ? GRAVITY
125 This is an invisible area like a trigger, which particles spawn in.
126
127 Flags:
128 gravity
129  if set the particles will fall.
130
131 Keys:
132 "velocity"
133  particle velocity. (default is '0 0 0)
134 "cnt"
135  sets color of particles (default 12 - white), the colors are actually a range of 4 colors, starting with this color.
136 "count"
137  adjusts particle density, this many particles appear every second, experiment to see the effects (default is based on area size).
138 "cnt2"
139  random velocity adjustment, default is 0, higher makes the particles more random, 0 makes them follow velocity exactly.
140 */
141 void() func_particlecube =
142 {
143         self.destvec = self.velocity;
144         self.velocity = '0 0 0';
145         self.angles = '0 0 0';
146         self.movetype = MOVETYPE_NONE;
147         self.solid = SOLID_NOT;
148         setmodel(self, self.model);
149         setorigin(self, self.origin);
150         setsize(self, self.mins, self.maxs);
151         self.model = "";
152         if (!self.cnt)
153                 self.cnt = 12;
154         if (!self.count)
155                 self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)*(self.absmax_z - self.absmin_z)/65536;
156         if (self.count < 1)
157         {
158                 remove(self);
159                 return;
160         }
161 //      if (self.spawnflags & 1)
162 //              self.lefty = 1;
163         // convert from per second to per 0.1 sec,
164         // and round up to nearest multiple of 4
165         self.count = ((self.count * 0.1) + 3) & 65532;
166         self.think = particlecube_think;
167         self.nextthink = time + 0.5;
168 };
169