23 void CL_Flashlight(
int ent, vec3_t pos)
27 dl = CL_AllocDlight(ent);
28 VectorCopy(pos, dl->origin);
42 void CL_ColorFlash(vec3_t pos,
int ent,
int intensity,
float r,
float g,
float b)
46 dl = CL_AllocDlight(ent);
47 VectorCopy(pos, dl->origin);
72 VectorCopy(start, move);
73 VectorSubtract(end, start, vec);
76 MakeNormalVectors(vec,
right,
up);
79 VectorScale(vec, dec, vec);
80 VectorCopy(start, move);
90 VectorClear(p->
accel);
94 p->
color = 0x74 + (rand() & 7);
95 VectorCopy(move, p->
org);
96 VectorAdd(move, vec, move);
105 void CL_SmokeTrail(vec3_t start, vec3_t end,
int colorStart,
int colorRun,
int spacing)
113 VectorCopy(start, move);
114 VectorSubtract(end, start, vec);
117 VectorScale(vec, spacing, vec);
126 VectorClear(p->
accel);
131 p->
alphavel = -1.0 / (1 + frand() * 0.5);
132 p->
color = colorStart + (rand() % colorRun);
133 for (j = 0; j < 3; j++) {
134 p->
org[j] = move[j] + crand() * 3;
137 p->
vel[2] = 20 + crand() * 5;
139 VectorAdd(move, vec, move);
151 VectorCopy(start, move);
152 VectorSubtract(end, start, vec);
155 VectorScale(vec, 4, vec);
165 VectorClear(p->
accel);
170 p->
alphavel = -1.0 / (3.0 + frand() * 0.5);
172 for (j = 0; j < 3; j++) {
173 p->
org[j] = move[j] + crand() * 3;
178 p->
vel[2] = -40 - (crand() * 10);
181 VectorAdd(move, vec, move);
197 for (i = 0; i < count; i++) {
208 d = rand() & dirspread;
209 for (j = 0; j < 3; j++) {
210 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
211 p->
vel[j] = crand() * 20;
218 p->
alphavel = -1.0 / (0.5 + frand() * alphavel);
237 VectorCopy(start, move);
238 VectorSubtract(end, start, vec);
242 VectorScale(vec, dec, vec);
244 for (i = 0; i < len; i += dec) {
249 VectorClear(p->
accel);
253 p->
alphavel = -1.0 / (1 + frand() * 0.1);
254 p->
color = 4 + (rand() & 7);
255 for (j = 0; j < 3; j++) {
256 p->
org[j] = move[j] + crand() * 2;
257 p->
vel[j] = crand() * 10;
262 VectorAdd(move, vec, move);
277 float step = 32.0, rstep;
283 VectorMA(start, 4096,
forward, end);
285 VectorCopy(start, move);
286 VectorSubtract(end, start, vec);
289 ltime = (float)
cl.
time / 1000.0;
290 start_pt = fmod(ltime * 96.0, step);
291 VectorMA(move, start_pt, vec, move);
293 VectorScale(vec, step, vec);
296 for (i = start_pt; i < len; i += step) {
300 for (rot = 0; rot < M_PI * 2; rot += rstep) {
306 VectorClear(p->
accel);
308 c = cos(rot) * variance;
309 s = sin(rot) * variance;
314 VectorMA(dir, s * (i / 10.0),
cl.
v_up, dir);
317 VectorMA(dir, s,
cl.
v_up, dir);
322 p->
color = 223 - (rand() & 7);
323 for (j = 0; j < 3; j++) {
324 p->
org[j] = move[j] + dir[j] * 3;
329 VectorAdd(move, vec, move);
348 MakeNormalVectors(dir, r, u);
350 for (i = 0; i < count; i++) {
358 for (j = 0; j < 3; j++) {
359 p->
org[j] = org[j] + magnitude * 0.1 * crand();
361 VectorScale(dir, magnitude, p->
vel);
362 d = crand() * magnitude / 3;
363 VectorMA(p->
vel, d, r, p->
vel);
364 d = crand() * magnitude / 3;
365 VectorMA(p->
vel, d, u, p->
vel);
371 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
383 VectorCopy(self->dir, dir);
384 MakeNormalVectors(dir, r, u);
386 for (i = 0; i <
self->count; i++) {
392 p->
color =
self->color + (rand() & 7);
394 for (j = 0; j < 3; j++) {
395 p->
org[j] =
self->org[j] +
self->magnitude * 0.1 * crand();
397 VectorScale(dir, self->magnitude, p->
vel);
398 d = crand() *
self->magnitude / 3;
399 VectorMA(p->
vel, d, r, p->
vel);
400 d = crand() *
self->magnitude / 3;
401 VectorMA(p->
vel, d, u, p->
vel);
407 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
410 self->nextthink +=
self->thinkinterval;
429 VectorCopy(start, move);
430 VectorSubtract(end, start, vec);
434 vectoangles2(
forward, angle_dir);
438 VectorScale(vec, 3, vec);
447 VectorClear(p->
accel);
453 p->
color = particleColor;
454 dist = DotProduct(move,
forward);
455 VectorMA(move, 8 * cos(dist),
up, p->
org);
456 for (j = 0; j < 3; j++) {
462 VectorAdd(move, vec, move);
472 for (i = 0; i < 300; i++) {
476 VectorClear(p->
accel);
499 for (i = 0; i < 40; i++) {
503 VectorClear(p->
accel);
522 static const byte colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8};
528 ratio = 1.0 - (((float)self->endtime - (
float)
cl.
time) / 2100.0);
530 for (i = 0; i < 300; i++) {
534 VectorClear(p->
accel);
540 p->
color = colortable[rand() & 3];
547 VectorMA(self->org, (45.0 * ratio), dir, p->
org);
553 static const byte colortable[4] = {110, 112, 114, 116};
559 ratio = 1.0 - (((float)self->endtime - (
float)
cl.
time) / 1000.0);
561 for (i = 0; i < 700; i++) {
565 VectorClear(p->
accel);
571 p->
color = colortable[rand() & 3];
578 VectorMA(self->org, (200.0 * ratio), dir, p->
org);
584 static const byte colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8};
589 for (i = 0; i < 256; i++) {
595 p->
color = colortable[rand() & 3];
607 p->
alphavel = -0.8 / (0.5 + frand() * 0.3);
617 for (i = 0; i < 300; i++) {
621 VectorClear(p->
accel);
633 VectorScale(dir, -1, backdir);
636 VectorScale(backdir, 64, p->
vel);
655 VectorCopy(start, move);
656 VectorSubtract(end, start, vec);
660 VectorScale(vec, 5, vec);
668 VectorClear(p->
accel);
673 p->
alphavel = -1.0 / (0.8 + frand() * 0.2);
675 for (j = 0; j < 3; j++) {
676 p->
org[j] = move[j] + crand() * 16;
677 p->
vel[j] = crand() * 5;
681 VectorAdd(move, vec, move);
695 for (i = 0; i < 128; i++) {
703 for (j = 0; j < 3; j++) {
704 p->
org[j] = org[j] + ((rand() % 32) - 16);
705 p->
vel[j] = (rand() % 256) - 128;
712 p->
alphavel = -0.4 / (0.6 + frand() * 0.2);
728 MakeNormalVectors(dir, r, u);
730 for (i = 0; i < count; i++) {
738 for (j = 0; j < 3; j++) {
739 p->
org[j] = org[j] + magnitude * 0.1 * crand();
741 VectorScale(dir, magnitude, p->
vel);
742 d = crand() * magnitude / 3;
743 VectorMA(p->
vel, d, r, p->
vel);
744 d = crand() * magnitude / 3;
745 VectorMA(p->
vel, d, u, p->
vel);
750 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
769 for (i = 0; i < count; i++) {
778 for (j = 0; j < 3; j++) {
779 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
780 p->
vel[j] = dir[j] * 30 + crand() * 40;
787 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
807 VectorCopy(start, move);
808 VectorSubtract(end, start, vec);
812 VectorScale(vec, 5, vec);
821 VectorClear(p->
accel);
826 p->
alphavel = -1.0 / (0.3 + frand() * 0.2);
828 for (j = 0; j < 3; j++) {
829 p->
org[j] = move[j] + crand();
830 p->
vel[j] = crand() * 5;
834 VectorAdd(move, vec, move);
853 VectorCopy(start, move);
854 VectorSubtract(ent, start, vec);
858 VectorScale(vec, 5, vec);
866 VectorClear(p->
accel);
870 p->
alphavel = -1.0 / (0.3 + frand() * 0.2);
871 p->
color = 0xe4 + (rand() & 3);
873 for (j = 0; j < 3; j++) {
888 VectorAdd(move, vec, move);
907 ent->origin[2] -= 14;
908 VectorCopy(ent->origin, start);
909 VectorCopy(ent->origin, end);
912 VectorCopy(start, move);
913 VectorSubtract(end, start, vec);
917 VectorScale(vec, 5, vec);
926 VectorClear(p->
accel);
931 p->
alphavel = -1.0 / (0.3 + frand() * 0.2);
933 for (j = 0; j < 3; j++) {
934 p->
org[j] = move[j] + crand();
935 p->
vel[j] = crand() * 15;
940 VectorAdd(move, vec, move);
950 ent->origin[2] += 14;
951 VectorCopy(ent->origin, org);
953 for (i = -2; i <= 2; i += 4)
954 for (j = -2; j <= 2; j += 4)
955 for (k = -2; k <= 4; k += 4) {
961 p->
color = 0xe0 + (rand() & 3);
964 p->
alphavel = -1.0 / (0.3 + (rand() & 7) * 0.02);
966 p->
org[0] = org[0] + i + ((rand() & 23) * crand());
967 p->
org[1] = org[1] + j + ((rand() & 23) * crand());
968 p->
org[2] = org[2] + k + ((rand() & 23) * crand());
975 vel = 50 + (rand() & 63);
976 VectorScale(dir, vel, p->
vel);
995 for (i = 0; i < count; i++) {
1004 for (j = 0; j < 3; j++) {
1005 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
1006 p->
vel[j] = crand() * 20;
1013 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);