MCPcopy Create free account
hub / github.com/demoth/jake2 / DiminishingTrail

Method DiminishingTrail

client/src/main/java/jake2/client/CL_fx.java:1406–1482  ·  view source on GitHub ↗
(float[] start, float[] end, centity_t old, int flags)

Source from the content-addressed store, hash-verified

1404 * ===============
1405 */
1406 static void DiminishingTrail(float[] start, float[] end, centity_t old, int flags) {
1407 cparticle_t p;
1408 float orgscale;
1409 float velscale;
1410
1411 Math3D.VectorCopy(start, move);
1412 Math3D.VectorSubtract(end, start, vec);
1413 float len = Math3D.VectorNormalize(vec);
1414
1415 float dec = 0.5f;
1416 Math3D.VectorScale(vec, dec, vec);
1417
1418 if (old.trailcount > 900) {
1419 orgscale = 4;
1420 velscale = 15;
1421 } else if (old.trailcount > 800) {
1422 orgscale = 2;
1423 velscale = 10;
1424 } else {
1425 orgscale = 1;
1426 velscale = 5;
1427 }
1428
1429 while (len > 0) {
1430 len -= dec;
1431
1432 if (free_particles == null)
1433 return;
1434
1435 // drop less particles as it flies
1436 if ((Lib.rand() & 1023) < old.trailcount) {
1437 p = free_particles;
1438 free_particles = p.next;
1439 p.next = active_particles;
1440 active_particles = p;
1441 Math3D.VectorClear(p.accel);
1442
1443 p.time = ClientGlobals.cl.time;
1444
1445 if ((flags & Defines.EF_GIB) != 0) {
1446 p.alpha = 1.0f;
1447 p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f);
1448 p.color = 0xe8 + (Lib.rand() & 7);
1449 for (int j = 0; j < 3; j++) {
1450 p.org[j] = move[j] + Lib.crandom() * orgscale;
1451 p.vel[j] = Lib.crandom() * velscale;
1452 p.accel[j] = 0;
1453 }
1454 p.vel[2] -= PARTICLE_GRAVITY;
1455 } else if ((flags & Defines.EF_GREENGIB) != 0) {
1456 p.alpha = 1.0f;
1457 p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f);
1458 p.color = 0xdb + (Lib.rand() & 7);
1459 for (int j = 0; j < 3; j++) {
1460 p.org[j] = move[j] + Lib.crandom() * orgscale;
1461 p.vel[j] = Lib.crandom() * velscale;
1462 p.accel[j] = 0;
1463 }

Callers 2

RocketTrailMethod · 0.95
AddPacketEntitiesMethod · 0.95

Calls 8

VectorCopyMethod · 0.95
VectorSubtractMethod · 0.95
VectorNormalizeMethod · 0.95
VectorScaleMethod · 0.95
randMethod · 0.95
VectorClearMethod · 0.95
crandomMethod · 0.95
VectorAddMethod · 0.95

Tested by

no test coverage detected