MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Particles_RainSnowEffect

Function Particles_RainSnowEffect

src/Particle.c:195–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void Particles_RainSnowEffect(float x, float y, float z) {
196 struct Particle* p;
197 int i, type;
198
199 for (i = 0; i < 2; i++) {
200 if (rain_count == PARTICLES_MAX) Rain_RemoveAt(0);
201 p = &rain_Particles[rain_count++];
202
203 p->velocity.x = Random_Float(&rnd) * 0.8f - 0.4f; /* [-0.4, 0.4] */
204 p->velocity.z = Random_Float(&rnd) * 0.8f - 0.4f;
205 p->velocity.y = Random_Float(&rnd) + 0.4f;
206
207 p->lastPos.x = x + Random_Float(&rnd); /* [0.0, 1.0] */
208 p->lastPos.y = y + Random_Float(&rnd) * 0.1f + 0.01f;
209 p->lastPos.z = z + Random_Float(&rnd);
210
211 p->nextPos = p->lastPos;
212 p->lifetime = 40.0f;
213
214 type = Random_Next(&rnd, 30);
215 p->size = type >= 28 ? 2 : (type >= 25 ? 4 : 3);
216 }
217}
218
219
220/*########################################################################################################################*

Callers 1

Calls 3

Rain_RemoveAtFunction · 0.85
Random_FloatFunction · 0.85
Random_NextFunction · 0.85

Tested by

no test coverage detected