1 vector PointInBrush_vec;
2 float PointInBrush_Recurse()
8 traceline(PointInBrush_vec, PointInBrush_vec, 0, world);
17 f = PointInBrush_Recurse();
22 float PointInBrush(entity brush, vector point)
26 if not(self.modelindex)
30 self.solid = SOLID_BSP;
31 PointInBrush_vec = point;
32 f = PointInBrush_Recurse();
38 .float cnt; // effect number
39 .vector velocity; // particle velocity
40 .float waterlevel; // direction jitter
41 .float count; // count multiplier
42 .float glow_color; // palette color
43 .float impulse; // density
44 .string noise; // sound
46 void Draw_PointParticles()
53 sz = self.maxs - self.mins;
54 n = self.impulse * drawframetime;
55 for(i = random(); i <= n; ++i)
58 p_x += random() * sz_x;
59 p_y += random() * sz_y;
60 p_z += random() * sz_z;
61 if(PointInBrush(self, p))
63 pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count, self.glow_color);
67 sound(self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
74 .vector velocity; // particle velocity
75 .float waterlevel; // direction jitter
76 .float count; // count multiplier
77 .float glow_color; // palette color
78 .float impulse; // density
79 .string noise; // sound
80 void Ent_PointParticles()
82 self.modelindex = ReadShort();
83 self.origin_x = ReadCoord();
84 self.origin_y = ReadCoord();
85 self.origin_z = ReadCoord();
86 self.maxs_x = ReadCoord();
87 self.maxs_y = ReadCoord();
88 self.maxs_z = ReadCoord();
89 self.cnt = ReadShort(); // effect number
90 self.impulse = ReadCoord(); // density (<0: point, >0: volume)
92 self.impulse = 1; // one per sec
93 self.velocity_x = ReadCoord();
94 self.velocity_y = ReadCoord();
95 self.velocity_z = ReadCoord();
96 self.waterlevel = ReadCoord();
97 self.count = ReadCoord();
98 self.glow_color = ReadByte();
100 strunzone(self.noise);
101 self.noise = strzone(ReadString());
103 if(self.impulse < 0) // negative = volume weighted: impulse = particles/100qu^3 cube
104 self.impulse *= -(self.maxs_x * self.maxs_y * self.maxs_z) / 1000000;
106 self.mins = -0.5 * self.maxs;
107 self.maxs = 0.5 * self.maxs;
108 self.origin = self.origin - self.mins;
110 setorigin(self, self.origin);
111 setsize(self, self.mins, self.maxs);
112 self.solid = SOLID_NOT;
113 self.draw = Draw_PointParticles;