Quake II RTX doxygen  1.0 dev
newfx.c File Reference
#include "client.h"

Go to the source code of this file.

Functions

void CL_DebugTrail (vec3_t start, vec3_t end)
 
void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing)
 
void CL_ForceWall (vec3_t start, vec3_t end, int color)
 
void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int numcolors, int dirspread, float alphavel)
 
void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist)
 
void CL_Heatbeam (vec3_t start, vec3_t forward)
 
void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude)
 
void CL_ParticleSteamEffect2 (cl_sustain_t *self)
 
void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor)
 
void CL_Tracker_Shell (vec3_t origin)
 
void CL_MonsterPlasma_Shell (vec3_t origin)
 
void CL_Widowbeamout (cl_sustain_t *self)
 
void CL_Nukeblast (cl_sustain_t *self)
 
void CL_WidowSplash (void)
 
void CL_Tracker_Explode (vec3_t origin)
 
void CL_TagTrail (vec3_t start, vec3_t end, int color)
 
void CL_ColorExplosionParticles (vec3_t org, int color, int run)
 
void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude)
 
void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color)
 
void CL_BlasterTrail2 (vec3_t start, vec3_t end)
 
void CL_IonripperTrail (vec3_t start, vec3_t ent)
 
void CL_TrapParticles (entity_t *ent)
 
void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count)
 

Function Documentation

◆ CL_BlasterParticles2()

void CL_BlasterParticles2 ( vec3_t  org,
vec3_t  dir,
unsigned int  color 
)

Definition at line 761 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_BlasterTrail2()

void CL_BlasterTrail2 ( vec3_t  start,
vec3_t  end 
)

Definition at line 798 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_BubbleTrail2()

void CL_BubbleTrail2 ( vec3_t  start,
vec3_t  end,
int  dist 
)

Definition at line 228 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_ColorExplosionParticles()

void CL_ColorExplosionParticles ( vec3_t  org,
int  color,
int  run 
)

Definition at line 690 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_DebugTrail()

void CL_DebugTrail ( vec3_t  start,
vec3_t  end 
)

Definition at line 63 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_ForceWall()

void CL_ForceWall ( vec3_t  start,
vec3_t  end,
int  color 
)

Definition at line 143 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_GenericParticleEffect()

void CL_GenericParticleEffect ( vec3_t  org,
vec3_t  dir,
int  color,
int  count,
int  numcolors,
int  dirspread,
float  alphavel 
)

Definition at line 191 of file newfx.c.

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 }

◆ CL_Heatbeam()

void CL_Heatbeam ( vec3_t  start,
vec3_t  forward 
)

Definition at line 266 of file newfx.c.

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 }

Referenced by CL_AddPlayerBeams().

◆ CL_IonripperTrail()

void CL_IonripperTrail ( vec3_t  start,
vec3_t  ent 
)

Definition at line 843 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_MonsterPlasma_Shell()

void CL_MonsterPlasma_Shell ( vec3_t  origin)

Definition at line 493 of file newfx.c.

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 }

Referenced by CL_AddPlayerBeams().

◆ CL_Nukeblast()

void CL_Nukeblast ( cl_sustain_t self)

Definition at line 551 of file newfx.c.

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 }

Referenced by CL_ParseNuke().

◆ CL_ParticleEffect3()

void CL_ParticleEffect3 ( vec3_t  org,
vec3_t  dir,
int  color,
int  count 
)

Definition at line 989 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_ParticleSmokeEffect()

void CL_ParticleSmokeEffect ( vec3_t  org,
vec3_t  dir,
int  color,
int  count,
int  magnitude 
)

Definition at line 721 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

◆ CL_ParticleSteamEffect()

void CL_ParticleSteamEffect ( vec3_t  org,
vec3_t  dir,
int  color,
int  count,
int  magnitude 
)

Definition at line 341 of file newfx.c.

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 }

Referenced by CL_ParseSteam(), and CL_ParseTEnt().

◆ CL_ParticleSteamEffect2()

void CL_ParticleSteamEffect2 ( cl_sustain_t self)

Definition at line 375 of file newfx.c.

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 }

Referenced by CL_ParseSteam().

◆ CL_SmokeTrail()

void CL_SmokeTrail ( vec3_t  start,
vec3_t  end,
int  colorStart,
int  colorRun,
int  spacing 
)

Definition at line 105 of file newfx.c.

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 }

◆ CL_TagTrail()

void CL_TagTrail ( vec3_t  start,
vec3_t  end,
int  color 
)

Definition at line 646 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_Tracker_Explode()

void CL_Tracker_Explode ( vec3_t  origin)

Definition at line 611 of file newfx.c.

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 }

◆ CL_Tracker_Shell()

void CL_Tracker_Shell ( vec3_t  origin)

Definition at line 466 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_TrackerTrail()

void CL_TrackerTrail ( vec3_t  start,
vec3_t  end,
int  particleColor 
)

Definition at line 418 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_TrapParticles()

void CL_TrapParticles ( entity_t *  ent)

Definition at line 897 of file newfx.c.

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 }

Referenced by CL_AddPacketEntities().

◆ CL_Widowbeamout()

void CL_Widowbeamout ( cl_sustain_t self)

Definition at line 520 of file newfx.c.

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 }

Referenced by CL_ParseWidow().

◆ CL_WidowSplash()

void CL_WidowSplash ( void  )

Definition at line 582 of file newfx.c.

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 }

Referenced by CL_ParseTEnt().

tent_params_t::pos1
vec3_t pos1
Definition: client.h:661
cparticle_s
Definition: client.h:780
cparticle_s::vel
vec3_t vel
Definition: client.h:786
cparticle_s::accel
vec3_t accel
Definition: client.h:787
client_state_s::v_up
vec3_t v_up
Definition: client.h:258
vec3_origin
vec3_t vec3_origin
Definition: shared.c:21
cl_sustain_s::org
vec3_t org
Definition: client.h:747
cl_sustain_s::dir
vec3_t dir
Definition: client.h:748
cparticle_s::alphavel
float alphavel
Definition: client.h:790
forward
static vec3_t forward
Definition: p_view.c:27
cparticle_s::org
vec3_t org
Definition: client.h:785
origin
static vec3_t origin
Definition: mesh.c:27
cl_sustain_s::magnitude
int magnitude
Definition: client.h:751
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_sustain_s::endtime
int endtime
Definition: client.h:744
cl
client_state_t cl
Definition: main.c:99
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
color
static vec4_t color
Definition: mesh.c:33
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
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: shared.c:55
CL_AllocParticle
cparticle_t * CL_AllocParticle(void)
Definition: effects.c:856