Cube  Diff

Differences From Artifact [63da7f6939]:

To Artifact [8491151e32]:


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

VARP(maxparticles, 100, 2000, MAXPARTICLES - 500);

static void
newparticle(const OFVector3D *o, const OFVector3D *d, int fade, int type)
{
	if (!parinit) {
		loopi(MAXPARTICLES)
		{
			particles[i].next = parempty;
			parempty = &particles[i];
		}
		parinit = true;
	}
	if (parempty) {
		struct particle *p = parempty;







|
<







17
18
19
20
21
22
23
24

25
26
27
28
29
30
31

VARP(maxparticles, 100, 2000, MAXPARTICLES - 500);

static void
newparticle(const OFVector3D *o, const OFVector3D *d, int fade, int type)
{
	if (!parinit) {
		for (int i = 0; i < MAXPARTICLES; i++) {

			particles[i].next = parempty;
			parempty = &particles[i];
		}
		parinit = true;
	}
	if (parempty) {
		struct particle *p = parempty;
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
	glDisable(GL_BLEND);
	glDepthMask(GL_TRUE);
}

void
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, &d, rnd(fade * 3), type);
	}
}

void
particle_trail(int type, int fade, const OFVector3D *s, const OFVector3D *e)
{
	vdist(d, v, *s, *e);
	vdiv(v, d * 2 + 0.1f);
	OFVector3D p = *s;
	loopi((int)d * 2)
	{
		vadd(p, v);
		OFVector3D d =
		    OFMakeVector3D(rnd(11) - 5, rnd(11) - 5, rnd(11) - 5);
		newparticle(&p, &d, rnd(fade) + fade, type);
	}
}







|
<


















|
<






133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

160
161
162
163
164
165
	glDisable(GL_BLEND);
	glDepthMask(GL_TRUE);
}

void
particle_splash(int type, int num, int fade, const OFVector3D *p)
{
	for (int i = 0; i < num; i++) {

		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, &d, rnd(fade * 3), type);
	}
}

void
particle_trail(int type, int fade, const OFVector3D *s, const OFVector3D *e)
{
	vdist(d, v, *s, *e);
	vdiv(v, d * 2 + 0.1f);
	OFVector3D p = *s;
	for (int i = 0; i < ((int)d * 2); i++) {

		vadd(p, v);
		OFVector3D d =
		    OFMakeVector3D(rnd(11) - 5, rnd(11) - 5, rnd(11) - 5);
		newparticle(&p, &d, rnd(fade) + fade, type);
	}
}