11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-
-
+
+
|
particle *next;
};
particle particles[MAXPARTICLES], *parlist = NULL, *parempty = NULL;
bool parinit = false;
VARP(maxparticles, 100, 2000, MAXPARTICLES - 500);
void
newparticle(OFVector3D &o, OFVector3D &d, int fade, int type)
static void
newparticle(const OFVector3D &o, const OFVector3D &d, int fade, int type)
{
if (!parinit) {
loopi(MAXPARTICLES)
{
particles[i].next = parempty;
parempty = &particles[i];
}
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
-
+
-
+
-
|
glEnable(GL_FOG);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
}
void
particle_splash(int type, int num, int fade, OFVector3D &p)
particle_splash(int type, int num, int fade, const OFVector3D &p)
{
loopi(num)
{
const int radius = type == 5 ? 50 : 150;
int x, y, z;
do {
x = rnd(radius * 2) - radius;
y = rnd(radius * 2) - radius;
z = rnd(radius * 2) - radius;
} while (x * x + y * y + z * z > radius * radius);
OFVector3D d = OFMakeVector3D(x, y, z);
newparticle(p, OFMakeVector3D(x, y, z), rnd(fade * 3), type);
newparticle(p, d, rnd(fade * 3), type);
}
}
void
particle_trail(int type, int fade, OFVector3D &s, OFVector3D &e)
{
vdist(d, v, s, e);
|