Quake II RTX doxygen  1.0 dev
newfx.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 // cl_newfx.c -- MORE entity effects parsing and management
19 
20 #include "client.h"
21 
22 #if USE_DLIGHTS
23 void CL_Flashlight(int ent, vec3_t pos)
24 {
25  cdlight_t *dl;
26 
27  dl = CL_AllocDlight(ent);
28  VectorCopy(pos, dl->origin);
29  dl->radius = 400;
30  //dl->minlight = 250;
31  dl->die = cl.time + 100;
32  dl->color[0] = 1;
33  dl->color[1] = 1;
34  dl->color[2] = 1;
35 }
36 
37 /*
38 ======
39 CL_ColorFlash - flash of light
40 ======
41 */
42 void CL_ColorFlash(vec3_t pos, int ent, int intensity, float r, float g, float b)
43 {
44  cdlight_t *dl;
45 
46  dl = CL_AllocDlight(ent);
47  VectorCopy(pos, dl->origin);
48  dl->radius = intensity;
49  //dl->minlight = 250;
50  dl->die = cl.time + 100;
51  dl->color[0] = r;
52  dl->color[1] = g;
53  dl->color[2] = b;
54 }
55 #endif
56 
57 
58 /*
59 ======
60 CL_DebugTrail
61 ======
62 */
63 void CL_DebugTrail(vec3_t start, vec3_t end)
64 {
65  vec3_t move;
66  vec3_t vec;
67  float len;
68  cparticle_t *p;
69  float dec;
70  vec3_t right, up;
71 
72  VectorCopy(start, move);
73  VectorSubtract(end, start, vec);
74  len = VectorNormalize(vec);
75 
76  MakeNormalVectors(vec, right, up);
77 
78  dec = 3;
79  VectorScale(vec, dec, vec);
80  VectorCopy(start, move);
81 
82  while (len > 0) {
83  len -= dec;
84 
85  p = CL_AllocParticle();
86  if (!p)
87  return;
88 
89  p->time = cl.time;
90  VectorClear(p->accel);
91  VectorClear(p->vel);
92  p->alpha = 1.0;
93  p->alphavel = -0.1;
94  p->color = 0x74 + (rand() & 7);
95  VectorCopy(move, p->org);
96  VectorAdd(move, vec, move);
97  }
98 }
99 
100 /*
101 ===============
102 CL_SmokeTrail
103 ===============
104 */
105 void CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing)
106 {
107  vec3_t move;
108  vec3_t vec;
109  float len;
110  int j;
111  cparticle_t *p;
112 
113  VectorCopy(start, move);
114  VectorSubtract(end, start, vec);
115  len = VectorNormalize(vec);
116 
117  VectorScale(vec, spacing, vec);
118 
119  // FIXME: this is a really silly way to have a loop
120  while (len > 0) {
121  len -= spacing;
122 
123  p = CL_AllocParticle();
124  if (!p)
125  return;
126  VectorClear(p->accel);
127 
128  p->time = cl.time;
129 
130  p->alpha = 1.0;
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;
135  p->accel[j] = 0;
136  }
137  p->vel[2] = 20 + crand() * 5;
138 
139  VectorAdd(move, vec, move);
140  }
141 }
142 
143 void CL_ForceWall(vec3_t start, vec3_t end, int color)
144 {
145  vec3_t move;
146  vec3_t vec;
147  float len;
148  int j;
149  cparticle_t *p;
150 
151  VectorCopy(start, move);
152  VectorSubtract(end, start, vec);
153  len = VectorNormalize(vec);
154 
155  VectorScale(vec, 4, vec);
156 
157  // FIXME: this is a really silly way to have a loop
158  while (len > 0) {
159  len -= 4;
160 
161  if (frand() > 0.3) {
162  p = CL_AllocParticle();
163  if (!p)
164  return;
165  VectorClear(p->accel);
166 
167  p->time = cl.time;
168 
169  p->alpha = 1.0;
170  p->alphavel = -1.0 / (3.0 + frand() * 0.5);
171  p->color = color;
172  for (j = 0; j < 3; j++) {
173  p->org[j] = move[j] + crand() * 3;
174  p->accel[j] = 0;
175  }
176  p->vel[0] = 0;
177  p->vel[1] = 0;
178  p->vel[2] = -40 - (crand() * 10);
179  }
180 
181  VectorAdd(move, vec, move);
182  }
183 }
184 
185 
186 /*
187 ===============
188 CL_GenericParticleEffect
189 ===============
190 */
191 void CL_GenericParticleEffect(vec3_t org, vec3_t dir, int color, int count, int numcolors, int dirspread, float alphavel)
192 {
193  int i, j;
194  cparticle_t *p;
195  float d;
196 
197  for (i = 0; i < count; i++) {
198  p = CL_AllocParticle();
199  if (!p)
200  return;
201 
202  p->time = cl.time;
203  if (numcolors > 1)
204  p->color = color + (rand() & numcolors);
205  else
206  p->color = color;
207 
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;
212  }
213 
214  p->accel[0] = p->accel[1] = 0;
215  p->accel[2] = -PARTICLE_GRAVITY;
216  p->alpha = 1.0;
217 
218  p->alphavel = -1.0 / (0.5 + frand() * alphavel);
219  }
220 }
221 
222 /*
223 ===============
224 CL_BubbleTrail2 (lets you control the # of bubbles by setting the distance between the spawns)
225 
226 ===============
227 */
228 void CL_BubbleTrail2(vec3_t start, vec3_t end, int dist)
229 {
230  vec3_t move;
231  vec3_t vec;
232  float len;
233  int i, j;
234  cparticle_t *p;
235  float dec;
236 
237  VectorCopy(start, move);
238  VectorSubtract(end, start, vec);
239  len = VectorNormalize(vec);
240 
241  dec = dist;
242  VectorScale(vec, dec, vec);
243 
244  for (i = 0; i < len; i += dec) {
245  p = CL_AllocParticle();
246  if (!p)
247  return;
248 
249  VectorClear(p->accel);
250  p->time = cl.time;
251 
252  p->alpha = 1.0;
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;
258  }
259  p->org[2] -= 4;
260  p->vel[2] += 20;
261 
262  VectorAdd(move, vec, move);
263  }
264 }
265 
266 void CL_Heatbeam(vec3_t start, vec3_t forward)
267 {
268  vec3_t move;
269  vec3_t vec;
270  float len;
271  int j;
272  cparticle_t *p;
273  int i;
274  float c, s;
275  vec3_t dir;
276  float ltime;
277  float step = 32.0, rstep;
278  float start_pt;
279  float rot;
280  float variance;
281  vec3_t end;
282 
283  VectorMA(start, 4096, forward, end);
284 
285  VectorCopy(start, move);
286  VectorSubtract(end, start, vec);
287  len = VectorNormalize(vec);
288 
289  ltime = (float) cl.time / 1000.0;
290  start_pt = fmod(ltime * 96.0, step);
291  VectorMA(move, start_pt, vec, move);
292 
293  VectorScale(vec, step, vec);
294 
295  rstep = M_PI / 10.0;
296  for (i = start_pt; i < len; i += step) {
297  if (i > step * 5) // don't bother after the 5th ring
298  break;
299 
300  for (rot = 0; rot < M_PI * 2; rot += rstep) {
301  p = CL_AllocParticle();
302  if (!p)
303  return;
304 
305  p->time = cl.time;
306  VectorClear(p->accel);
307  variance = 0.5;
308  c = cos(rot) * variance;
309  s = sin(rot) * variance;
310 
311  // trim it so it looks like it's starting at the origin
312  if (i < 10) {
313  VectorScale(cl.v_right, c * (i / 10.0), dir);
314  VectorMA(dir, s * (i / 10.0), cl.v_up, dir);
315  } else {
316  VectorScale(cl.v_right, c, dir);
317  VectorMA(dir, s, cl.v_up, dir);
318  }
319 
320  p->alpha = 0.5;
321  p->alphavel = -1000.0;
322  p->color = 223 - (rand() & 7);
323  for (j = 0; j < 3; j++) {
324  p->org[j] = move[j] + dir[j] * 3;
325  p->vel[j] = 0;
326  }
327  }
328 
329  VectorAdd(move, vec, move);
330  }
331 }
332 
333 
334 /*
335 ===============
336 CL_ParticleSteamEffect
337 
338 Puffs with velocity along direction, with some randomness thrown in
339 ===============
340 */
341 void CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude)
342 {
343  int i, j;
344  cparticle_t *p;
345  float d;
346  vec3_t r, u;
347 
348  MakeNormalVectors(dir, r, u);
349 
350  for (i = 0; i < count; i++) {
351  p = CL_AllocParticle();
352  if (!p)
353  return;
354 
355  p->time = cl.time;
356  p->color = color + (rand() & 7);
357 
358  for (j = 0; j < 3; j++) {
359  p->org[j] = org[j] + magnitude * 0.1 * crand();
360  }
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);
366 
367  p->accel[0] = p->accel[1] = 0;
368  p->accel[2] = -PARTICLE_GRAVITY / 2;
369  p->alpha = 1.0;
370 
371  p->alphavel = -1.0 / (0.5 + frand() * 0.3);
372  }
373 }
374 
376 {
377  int i, j;
378  cparticle_t *p;
379  float d;
380  vec3_t r, u;
381  vec3_t dir;
382 
383  VectorCopy(self->dir, dir);
384  MakeNormalVectors(dir, r, u);
385 
386  for (i = 0; i < self->count; i++) {
387  p = CL_AllocParticle();
388  if (!p)
389  return;
390 
391  p->time = cl.time;
392  p->color = self->color + (rand() & 7);
393 
394  for (j = 0; j < 3; j++) {
395  p->org[j] = self->org[j] + self->magnitude * 0.1 * crand();
396  }
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);
402 
403  p->accel[0] = p->accel[1] = 0;
404  p->accel[2] = -PARTICLE_GRAVITY / 2;
405  p->alpha = 1.0;
406 
407  p->alphavel = -1.0 / (0.5 + frand() * 0.3);
408  }
409 
410  self->nextthink += self->thinkinterval;
411 }
412 
413 /*
414 ===============
415 CL_TrackerTrail
416 ===============
417 */
418 void CL_TrackerTrail(vec3_t start, vec3_t end, int particleColor)
419 {
420  vec3_t move;
421  vec3_t vec;
422  vec3_t forward, right, up, angle_dir;
423  float len;
424  int j;
425  cparticle_t *p;
426  int dec;
427  float dist;
428 
429  VectorCopy(start, move);
430  VectorSubtract(end, start, vec);
431  len = VectorNormalize(vec);
432 
433  VectorCopy(vec, forward);
434  vectoangles2(forward, angle_dir);
435  AngleVectors(angle_dir, forward, right, up);
436 
437  dec = 3;
438  VectorScale(vec, 3, vec);
439 
440  // FIXME: this is a really silly way to have a loop
441  while (len > 0) {
442  len -= dec;
443 
444  p = CL_AllocParticle();
445  if (!p)
446  return;
447  VectorClear(p->accel);
448 
449  p->time = cl.time;
450 
451  p->alpha = 1.0;
452  p->alphavel = -2.0;
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++) {
457  p->vel[j] = 0;
458  p->accel[j] = 0;
459  }
460  p->vel[2] = 5;
461 
462  VectorAdd(move, vec, move);
463  }
464 }
465 
467 {
468  vec3_t dir;
469  int i;
470  cparticle_t *p;
471 
472  for (i = 0; i < 300; i++) {
473  p = CL_AllocParticle();
474  if (!p)
475  return;
476  VectorClear(p->accel);
477 
478  p->time = cl.time;
479 
480  p->alpha = 1.0;
482  p->color = 0;
483 
484  dir[0] = crand();
485  dir[1] = crand();
486  dir[2] = crand();
487  VectorNormalize(dir);
488 
489  VectorMA(origin, 40, dir, p->org);
490  }
491 }
492 
494 {
495  vec3_t dir;
496  int i;
497  cparticle_t *p;
498 
499  for (i = 0; i < 40; i++) {
500  p = CL_AllocParticle();
501  if (!p)
502  return;
503  VectorClear(p->accel);
504 
505  p->time = cl.time;
506 
507  p->alpha = 1.0;
509  p->color = 0xe0;
510 
511  dir[0] = crand();
512  dir[1] = crand();
513  dir[2] = crand();
514  VectorNormalize(dir);
515 
516  VectorMA(origin, 10, dir, p->org);
517  }
518 }
519 
521 {
522  static const byte colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8};
523  vec3_t dir;
524  int i;
525  cparticle_t *p;
526  float ratio;
527 
528  ratio = 1.0 - (((float)self->endtime - (float)cl.time) / 2100.0);
529 
530  for (i = 0; i < 300; i++) {
531  p = CL_AllocParticle();
532  if (!p)
533  return;
534  VectorClear(p->accel);
535 
536  p->time = cl.time;
537 
538  p->alpha = 1.0;
540  p->color = colortable[rand() & 3];
541 
542  dir[0] = crand();
543  dir[1] = crand();
544  dir[2] = crand();
545  VectorNormalize(dir);
546 
547  VectorMA(self->org, (45.0 * ratio), dir, p->org);
548  }
549 }
550 
552 {
553  static const byte colortable[4] = {110, 112, 114, 116};
554  vec3_t dir;
555  int i;
556  cparticle_t *p;
557  float ratio;
558 
559  ratio = 1.0 - (((float)self->endtime - (float)cl.time) / 1000.0);
560 
561  for (i = 0; i < 700; i++) {
562  p = CL_AllocParticle();
563  if (!p)
564  return;
565  VectorClear(p->accel);
566 
567  p->time = cl.time;
568 
569  p->alpha = 1.0;
571  p->color = colortable[rand() & 3];
572 
573  dir[0] = crand();
574  dir[1] = crand();
575  dir[2] = crand();
576  VectorNormalize(dir);
577 
578  VectorMA(self->org, (200.0 * ratio), dir, p->org);
579  }
580 }
581 
582 void CL_WidowSplash(void)
583 {
584  static const byte colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8};
585  int i;
586  cparticle_t *p;
587  vec3_t dir;
588 
589  for (i = 0; i < 256; i++) {
590  p = CL_AllocParticle();
591  if (!p)
592  return;
593 
594  p->time = cl.time;
595  p->color = colortable[rand() & 3];
596 
597  dir[0] = crand();
598  dir[1] = crand();
599  dir[2] = crand();
600  VectorNormalize(dir);
601  VectorMA(te.pos1, 45.0, dir, p->org);
602  VectorMA(vec3_origin, 40.0, dir, p->vel);
603 
604  p->accel[0] = p->accel[1] = 0;
605  p->alpha = 1.0;
606 
607  p->alphavel = -0.8 / (0.5 + frand() * 0.3);
608  }
609 }
610 
612 {
613  vec3_t dir, backdir;
614  int i;
615  cparticle_t *p;
616 
617  for (i = 0; i < 300; i++) {
618  p = CL_AllocParticle();
619  if (!p)
620  return;
621  VectorClear(p->accel);
622 
623  p->time = cl.time;
624 
625  p->alpha = 1.0;
626  p->alphavel = -1.0;
627  p->color = 0;
628 
629  dir[0] = crand();
630  dir[1] = crand();
631  dir[2] = crand();
632  VectorNormalize(dir);
633  VectorScale(dir, -1, backdir);
634 
635  VectorMA(origin, 64, dir, p->org);
636  VectorScale(backdir, 64, p->vel);
637  }
638 }
639 
640 /*
641 ===============
642 CL_TagTrail
643 
644 ===============
645 */
646 void CL_TagTrail(vec3_t start, vec3_t end, int color)
647 {
648  vec3_t move;
649  vec3_t vec;
650  float len;
651  int j;
652  cparticle_t *p;
653  int dec;
654 
655  VectorCopy(start, move);
656  VectorSubtract(end, start, vec);
657  len = VectorNormalize(vec);
658 
659  dec = 5;
660  VectorScale(vec, 5, vec);
661 
662  while (len >= 0) {
663  len -= dec;
664 
665  p = CL_AllocParticle();
666  if (!p)
667  return;
668  VectorClear(p->accel);
669 
670  p->time = cl.time;
671 
672  p->alpha = 1.0;
673  p->alphavel = -1.0 / (0.8 + frand() * 0.2);
674  p->color = color;
675  for (j = 0; j < 3; j++) {
676  p->org[j] = move[j] + crand() * 16;
677  p->vel[j] = crand() * 5;
678  p->accel[j] = 0;
679  }
680 
681  VectorAdd(move, vec, move);
682  }
683 }
684 
685 /*
686 ===============
687 CL_ColorExplosionParticles
688 ===============
689 */
690 void CL_ColorExplosionParticles(vec3_t org, int color, int run)
691 {
692  int i, j;
693  cparticle_t *p;
694 
695  for (i = 0; i < 128; i++) {
696  p = CL_AllocParticle();
697  if (!p)
698  return;
699 
700  p->time = cl.time;
701  p->color = color + (rand() % run);
702 
703  for (j = 0; j < 3; j++) {
704  p->org[j] = org[j] + ((rand() % 32) - 16);
705  p->vel[j] = (rand() % 256) - 128;
706  }
707 
708  p->accel[0] = p->accel[1] = 0;
709  p->accel[2] = -PARTICLE_GRAVITY;
710  p->alpha = 1.0;
711 
712  p->alphavel = -0.4 / (0.6 + frand() * 0.2);
713  }
714 }
715 
716 /*
717 ===============
718 CL_ParticleSmokeEffect - like the steam effect, but unaffected by gravity
719 ===============
720 */
721 void CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude)
722 {
723  int i, j;
724  cparticle_t *p;
725  float d;
726  vec3_t r, u;
727 
728  MakeNormalVectors(dir, r, u);
729 
730  for (i = 0; i < count; i++) {
731  p = CL_AllocParticle();
732  if (!p)
733  return;
734 
735  p->time = cl.time;
736  p->color = color + (rand() & 7);
737 
738  for (j = 0; j < 3; j++) {
739  p->org[j] = org[j] + magnitude * 0.1 * crand();
740  }
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);
746 
747  p->accel[0] = p->accel[1] = p->accel[2] = 0;
748  p->alpha = 1.0;
749 
750  p->alphavel = -1.0 / (0.5 + frand() * 0.3);
751  }
752 }
753 
754 /*
755 ===============
756 CL_BlasterParticles2
757 
758 Wall impact puffs (Green)
759 ===============
760 */
761 void CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int color)
762 {
763  int i, j;
764  cparticle_t *p;
765  float d;
766  int count;
767 
768  count = 40;
769  for (i = 0; i < count; i++) {
770  p = CL_AllocParticle();
771  if (!p)
772  return;
773 
774  p->time = cl.time;
775  p->color = color + (rand() & 7);
776 
777  d = rand() & 15;
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;
781  }
782 
783  p->accel[0] = p->accel[1] = 0;
784  p->accel[2] = -PARTICLE_GRAVITY;
785  p->alpha = 1.0;
786 
787  p->alphavel = -1.0 / (0.5 + frand() * 0.3);
788  }
789 }
790 
791 /*
792 ===============
793 CL_BlasterTrail2
794 
795 Green!
796 ===============
797 */
798 void CL_BlasterTrail2(vec3_t start, vec3_t end)
799 {
800  vec3_t move;
801  vec3_t vec;
802  float len;
803  int j;
804  cparticle_t *p;
805  int dec;
806 
807  VectorCopy(start, move);
808  VectorSubtract(end, start, vec);
809  len = VectorNormalize(vec);
810 
811  dec = 5;
812  VectorScale(vec, 5, vec);
813 
814  // FIXME: this is a really silly way to have a loop
815  while (len > 0) {
816  len -= dec;
817 
818  p = CL_AllocParticle();
819  if (!p)
820  return;
821  VectorClear(p->accel);
822 
823  p->time = cl.time;
824 
825  p->alpha = 1.0;
826  p->alphavel = -1.0 / (0.3 + frand() * 0.2);
827  p->color = 0xd0;
828  for (j = 0; j < 3; j++) {
829  p->org[j] = move[j] + crand();
830  p->vel[j] = crand() * 5;
831  p->accel[j] = 0;
832  }
833 
834  VectorAdd(move, vec, move);
835  }
836 }
837 
838 /*
839 ===============
840 CL_IonripperTrail
841 ===============
842 */
843 void CL_IonripperTrail(vec3_t start, vec3_t ent)
844 {
845  vec3_t move;
846  vec3_t vec;
847  float len;
848  int j;
849  cparticle_t *p;
850  int dec;
851  int left = 0;
852 
853  VectorCopy(start, move);
854  VectorSubtract(ent, start, vec);
855  len = VectorNormalize(vec);
856 
857  dec = 5;
858  VectorScale(vec, 5, vec);
859 
860  while (len > 0) {
861  len -= dec;
862 
863  p = CL_AllocParticle();
864  if (!p)
865  return;
866  VectorClear(p->accel);
867 
868  p->time = cl.time;
869  p->alpha = 0.5;
870  p->alphavel = -1.0 / (0.3 + frand() * 0.2);
871  p->color = 0xe4 + (rand() & 3);
872 
873  for (j = 0; j < 3; j++) {
874  p->org[j] = move[j];
875  p->accel[j] = 0;
876  }
877  if (left) {
878  left = 0;
879  p->vel[0] = 10;
880  } else {
881  left = 1;
882  p->vel[0] = -10;
883  }
884 
885  p->vel[1] = 0;
886  p->vel[2] = 0;
887 
888  VectorAdd(move, vec, move);
889  }
890 }
891 
892 /*
893 ===============
894 CL_TrapParticles
895 ===============
896 */
897 void CL_TrapParticles(entity_t *ent)
898 {
899  vec3_t move;
900  vec3_t vec;
901  vec3_t start, end;
902  float len;
903  int j;
904  cparticle_t *p;
905  int dec;
906 
907  ent->origin[2] -= 14;
908  VectorCopy(ent->origin, start);
909  VectorCopy(ent->origin, end);
910  end[2] += 64;
911 
912  VectorCopy(start, move);
913  VectorSubtract(end, start, vec);
914  len = VectorNormalize(vec);
915 
916  dec = 5;
917  VectorScale(vec, 5, vec);
918 
919  // FIXME: this is a really silly way to have a loop
920  while (len > 0) {
921  len -= dec;
922 
923  p = CL_AllocParticle();
924  if (!p)
925  return;
926  VectorClear(p->accel);
927 
928  p->time = cl.time;
929 
930  p->alpha = 1.0;
931  p->alphavel = -1.0 / (0.3 + frand() * 0.2);
932  p->color = 0xe0;
933  for (j = 0; j < 3; j++) {
934  p->org[j] = move[j] + crand();
935  p->vel[j] = crand() * 15;
936  p->accel[j] = 0;
937  }
938  p->accel[2] = PARTICLE_GRAVITY;
939 
940  VectorAdd(move, vec, move);
941  }
942 
943  {
944  int i, j, k;
945  cparticle_t *p;
946  float vel;
947  vec3_t dir;
948  vec3_t org;
949 
950  ent->origin[2] += 14;
951  VectorCopy(ent->origin, org);
952 
953  for (i = -2; i <= 2; i += 4)
954  for (j = -2; j <= 2; j += 4)
955  for (k = -2; k <= 4; k += 4) {
956  p = CL_AllocParticle();
957  if (!p)
958  return;
959 
960  p->time = cl.time;
961  p->color = 0xe0 + (rand() & 3);
962 
963  p->alpha = 1.0;
964  p->alphavel = -1.0 / (0.3 + (rand() & 7) * 0.02);
965 
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());
969 
970  dir[0] = j * 8;
971  dir[1] = i * 8;
972  dir[2] = k * 8;
973 
974  VectorNormalize(dir);
975  vel = 50 + (rand() & 63);
976  VectorScale(dir, vel, p->vel);
977 
978  p->accel[0] = p->accel[1] = 0;
979  p->accel[2] = -PARTICLE_GRAVITY;
980  }
981  }
982 }
983 
984 /*
985 ===============
986 CL_ParticleEffect3
987 ===============
988 */
989 void CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count)
990 {
991  int i, j;
992  cparticle_t *p;
993  float d;
994 
995  for (i = 0; i < count; i++) {
996  p = CL_AllocParticle();
997  if (!p)
998  return;
999 
1000  p->time = cl.time;
1001  p->color = color;
1002 
1003  d = rand() & 7;
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;
1007  }
1008 
1009  p->accel[0] = p->accel[1] = 0;
1010  p->accel[2] = PARTICLE_GRAVITY;
1011  p->alpha = 1.0;
1012 
1013  p->alphavel = -1.0 / (0.5 + frand() * 0.3);
1014  }
1015 }
1016 
CL_ParticleSteamEffect
void CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude)
Definition: newfx.c:341
tent_params_t::pos1
vec3_t pos1
Definition: client.h:661
CL_TagTrail
void CL_TagTrail(vec3_t start, vec3_t end, int color)
Definition: newfx.c:646
cl_sustain_s
Definition: client.h:741
cparticle_s
Definition: client.h:780
CL_ParticleSteamEffect2
void CL_ParticleSteamEffect2(cl_sustain_t *self)
Definition: newfx.c:375
cparticle_s::vel
vec3_t vel
Definition: client.h:786
cparticle_s::accel
vec3_t accel
Definition: client.h:787
CL_SmokeTrail
void CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing)
Definition: newfx.c:105
client_state_s::v_up
vec3_t v_up
Definition: client.h:258
CL_ParticleSmokeEffect
void CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude)
Definition: newfx.c:721
CL_Heatbeam
void CL_Heatbeam(vec3_t start, vec3_t forward)
Definition: newfx.c:266
CL_ForceWall
void CL_ForceWall(vec3_t start, vec3_t end, int color)
Definition: newfx.c:143
CL_BlasterParticles2
void CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int color)
Definition: newfx.c:761
vec3_origin
vec3_t vec3_origin
Definition: shared.c:21
CL_Widowbeamout
void CL_Widowbeamout(cl_sustain_t *self)
Definition: newfx.c:520
cparticle_s::alphavel
float alphavel
Definition: client.h:790
CL_WidowSplash
void CL_WidowSplash(void)
Definition: newfx.c:582
CL_MonsterPlasma_Shell
void CL_MonsterPlasma_Shell(vec3_t origin)
Definition: newfx.c:493
forward
static vec3_t forward
Definition: p_view.c:27
CL_Tracker_Explode
void CL_Tracker_Explode(vec3_t origin)
Definition: newfx.c:611
cparticle_s::org
vec3_t org
Definition: client.h:785
CL_GenericParticleEffect
void CL_GenericParticleEffect(vec3_t org, vec3_t dir, int color, int count, int numcolors, int dirspread, float alphavel)
Definition: newfx.c:191
origin
static vec3_t origin
Definition: mesh.c:27
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: shared.c:23
client_state_s::time
int time
Definition: client.h:244
CL_TrapParticles
void CL_TrapParticles(entity_t *ent)
Definition: newfx.c:897
CL_ParticleEffect3
void CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count)
Definition: newfx.c:989
CL_DebugTrail
void CL_DebugTrail(vec3_t start, vec3_t end)
Definition: newfx.c:63
cl
client_state_t cl
Definition: main.c:99
CL_Nukeblast
void CL_Nukeblast(cl_sustain_t *self)
Definition: newfx.c:551
c
statCounters_t c
Definition: main.c:30
cparticle_s::color
int color
Definition: client.h:788
client_state_s::v_right
vec3_t v_right
Definition: client.h:258
up
static vec3_t up
Definition: p_view.c:27
PARTICLE_GRAVITY
#define PARTICLE_GRAVITY
Definition: client.h:776
right
static vec3_t right
Definition: p_view.c:27
te
tent_params_t te
Definition: parse.c:655
intensity
cvar_t * intensity
Definition: god_rays.c:38
client.h
CL_IonripperTrail
void CL_IonripperTrail(vec3_t start, vec3_t ent)
Definition: newfx.c:843
CL_BlasterTrail2
void CL_BlasterTrail2(vec3_t start, vec3_t end)
Definition: newfx.c:798
color
static vec4_t color
Definition: mesh.c:33
CL_BubbleTrail2
void CL_BubbleTrail2(vec3_t start, vec3_t end, int dist)
Definition: newfx.c:228
cparticle_s::time
float time
Definition: client.h:783
INSTANT_PARTICLE
#define INSTANT_PARTICLE
Definition: client.h:778
cparticle_s::alpha
float alpha
Definition: client.h:789
CL_TrackerTrail
void CL_TrackerTrail(vec3_t start, vec3_t end, int particleColor)
Definition: newfx.c:418
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: shared.c:55
CL_AllocParticle
cparticle_t * CL_AllocParticle(void)
Definition: effects.c:856
CL_ColorExplosionParticles
void CL_ColorExplosionParticles(vec3_t org, int color, int run)
Definition: newfx.c:690
CL_Tracker_Shell
void CL_Tracker_Shell(vec3_t origin)
Definition: newfx.c:466