icculus quake2 doxygen  1.0 dev
cl_newfx.c File Reference
#include "client.h"

Go to the source code of this file.

Macros

#define RINGS   1
 

Functions

void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up)
 
void vectoangles2 (vec3_t value1, vec3_t angles)
 
void CL_Flashlight (int ent, vec3_t pos)
 
void CL_ColorFlash (vec3_t pos, int ent, int intensity, float r, float g, float b)
 
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 color8)
 
void CL_FlameEffects (centity_t *ent, vec3_t origin)
 
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 (vec3_t org)
 
void CL_Tracker_Explode (vec3_t origin)
 
void CL_TagTrail (vec3_t start, vec3_t end, float color)
 
void CL_ColorExplosionParticles (vec3_t org, int color8, 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)
 

Variables

cparticle_tactive_particles
 
cparticle_tfree_particles
 
cparticle_t particles [MAX_PARTICLES]
 
int cl_numparticles
 
cvar_tvid_ref
 

Macro Definition Documentation

◆ RINGS

#define RINGS   1

Definition at line 509 of file cl_newfx.c.

Function Documentation

◆ CL_BlasterParticles2()

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

Definition at line 1378 of file cl_newfx.c.

1379 {
1380  int i, j;
1381  cparticle_t *p;
1382  float d;
1383  int count;
1384 
1385  count = 40;
1386  for (i=0 ; i<count ; i++)
1387  {
1388  if (!free_particles)
1389  return;
1390  p = free_particles;
1391  free_particles = p->next;
1392  p->next = active_particles;
1393  active_particles = p;
1394 
1395  p->time = cl.time;
1396 #ifndef QMAX
1397  p->color = color + (rand()&7);
1398 #endif
1399  d = rand()&15;
1400  for (j=0 ; j<3 ; j++)
1401  {
1402  p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
1403  p->vel[j] = dir[j] * 30 + crand()*40;
1404  }
1405 
1406  p->accel[0] = p->accel[1] = 0;
1407  p->accel[2] = -PARTICLE_GRAVITY;
1408  p->alpha = 1.0;
1409 
1410  p->alphavel = -1.0 / (0.5 + frand()*0.3);
1411  }
1412 }

Referenced by CL_ParseTEnt().

◆ CL_BlasterTrail2()

void CL_BlasterTrail2 ( vec3_t  start,
vec3_t  end 
)

Definition at line 1421 of file cl_newfx.c.

1422 {
1423  vec3_t move;
1424  vec3_t vec;
1425  float len;
1426  int j;
1427  cparticle_t *p;
1428  int dec;
1429 
1430  VectorCopy (start, move);
1431  VectorSubtract (end, start, vec);
1432  len = VectorNormalize (vec);
1433 
1434  dec = 5;
1435  VectorScale (vec, 5, vec);
1436 
1437  // FIXME: this is a really silly way to have a loop
1438  while (len > 0)
1439  {
1440  len -= dec;
1441 
1442  if (!free_particles)
1443  return;
1444  p = free_particles;
1445  free_particles = p->next;
1446  p->next = active_particles;
1447  active_particles = p;
1448  VectorClear (p->accel);
1449 
1450  p->time = cl.time;
1451 
1452  p->alpha = 1.0;
1453  p->alphavel = -1.0 / (0.3+frand()*0.2);
1454 #ifndef QMAX
1455  p->color = 0xd0;
1456 #endif
1457  for (j=0 ; j<3 ; j++)
1458  {
1459  p->org[j] = move[j] + crand();
1460  p->vel[j] = crand()*5;
1461  p->accel[j] = 0;
1462  }
1463 
1464  VectorAdd (move, vec, move);
1465  }
1466 }

Referenced by CL_AddPacketEntities().

◆ CL_BubbleTrail2()

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

Definition at line 445 of file cl_newfx.c.

446 {
447  vec3_t move;
448  vec3_t vec;
449  float len;
450  int i;
451 #ifndef QMAX
452  int j;
453  cparticle_t *p;
454 #endif
455  float dec;
456 
457  VectorCopy (start, move);
458  VectorSubtract (end, start, vec);
459  len = VectorNormalize (vec);
460 
461  dec = dist;
462  VectorScale (vec, dec, vec);
463 
464  for (i=0 ; i<len ; i+=dec)
465  {
466 #ifdef QMAX
467  setupParticle (
468  0, 0, 0,
469  move[0]+crand()*2, move[1]+crand()*2, move[2]+crand()*2,
470  crand()*5, crand()*5, crand()*5+6,
471  0, 0, 0,
472  255, 255, 255,
473  0, 0, 0,
474  0.75, -1.0 / (1 + frand() * 0.2),
475  (frand()>0.25)? 1 : (frand()>0.5) ? 2 : (frand()>0.75) ? 3 : 4, 1,
477  PART_TRANS|PART_SHADED,
478  NULL,0);
479 #else
480  if (!free_particles)
481  return;
482 
483  p = free_particles;
484  free_particles = p->next;
485  p->next = active_particles;
486  active_particles = p;
487 
488  VectorClear (p->accel);
489  p->time = cl.time;
490 
491  p->alpha = 1.0;
492  p->alphavel = -1.0 / (1+frand()*0.1);
493  p->color = 4 + (rand()&7);
494  for (j=0 ; j<3 ; j++)
495  {
496  p->org[j] = move[j] + crand()*2;
497  p->vel[j] = crand()*10;
498  }
499  p->org[2] -= 4;
500 // p->vel[2] += 6;
501  p->vel[2] += 20;
502 #endif
503  VectorAdd (move, vec, move);
504  }
505 }

Referenced by CL_ParseTEnt().

◆ CL_ColorExplosionParticles()

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

Definition at line 1269 of file cl_newfx.c.

1270 {
1271  int i;
1272 #ifdef QMAX
1273  vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
1274 #else
1275  int j;
1276  cparticle_t *p;
1277 #endif
1278  for (i=0 ; i<128 ; i++)
1279  {
1280 #ifdef QMAX
1281 setupParticle (
1282  0, 0, 0,
1283  org[0] + ((rand()%32)-16), org[1] + ((rand()%32)-16), org[2] + ((rand()%32)-16),
1284  (rand()%256)-128, (rand()%256)-128, (rand()%256)-128,
1285  0, 0, 20,
1286  color[0] + (rand() % run), color[1] + (rand() % run), color[2] + (rand() % run),
1287  0, 0, 0,
1288  1.0, -0.4 / (0.6 + frand()*0.2),
1289  2, 1,
1291  0,
1292  NULL,0);
1293 #else
1294  if (!free_particles)
1295  return;
1296  p = free_particles;
1297  free_particles = p->next;
1298  p->next = active_particles;
1299  active_particles = p;
1300 
1301  p->time = cl.time;
1302  p->color = color8 + (rand() % run);
1303  for (j=0 ; j<3 ; j++)
1304  {
1305  p->org[j] = org[j] + ((rand()%32)-16);
1306  p->vel[j] = (rand()%256)-128;
1307  }
1308 
1309  p->accel[0] = p->accel[1] = 0;
1310  p->accel[2] = -PARTICLE_GRAVITY;
1311  p->alpha = 1.0;
1312 
1313  p->alphavel = -0.4 / (0.6 + frand()*0.2);
1314 #endif
1315  }
1316 }

Referenced by CL_ParseTEnt().

◆ CL_ColorFlash()

void CL_ColorFlash ( vec3_t  pos,
int  ent,
int  intensity,
float  r,
float  g,
float  b 
)

Definition at line 112 of file cl_newfx.c.

113 {
114  cdlight_t *dl;
115 
116  if((vidref_val == VIDREF_SOFT) && ((r < 0) || (g<0) || (b<0)))
117  {
118  intensity = -intensity;
119  r = -r;
120  g = -g;
121  b = -b;
122  }
123 
124  dl = CL_AllocDlight (ent);
125  VectorCopy (pos, dl->origin);
126  dl->radius = intensity;
127  dl->minlight = 250;
128  dl->die = cl.time + 100;
129  dl->color[0] = r;
130  dl->color[1] = g;
131  dl->color[2] = b;
132 }

Referenced by CL_ParseTEnt().

◆ CL_DebugTrail()

void CL_DebugTrail ( vec3_t  start,
vec3_t  end 
)

Definition at line 140 of file cl_newfx.c.

141 {
142  vec3_t move;
143  vec3_t vec;
144  float len;
145 #ifndef QMAX
146  cparticle_t *p;
147 #endif
148  float dec;
149  vec3_t right, up;
150 
151  VectorCopy (start, move);
152  VectorSubtract (end, start, vec);
153  len = VectorNormalize (vec);
154 
155  MakeNormalVectors (vec, right, up);
156 
157 // VectorScale(vec, RT2_SKIP, vec);
158 
159 // dec = 1.0;
160 // dec = 0.75;
161  dec = 3;
162  VectorScale (vec, dec, vec);
163  VectorCopy (start, move);
164 
165  while (len > 0)
166  {
167  len -= dec;
168 #ifdef QMAX
169  setupParticle (
170  0, 0, 0,
171  move[0], move[1], move[2],
172  0, 0, 0,
173  0, 0, 0,
174  50, 50, 255,
175  0, 0, 0,
176  1, -0.75,
177  7.5, 0,
179  0,
180  NULL,0);
181 #else
182  if (!free_particles)
183  return;
184  p = free_particles;
185  free_particles = p->next;
186  p->next = active_particles;
187  active_particles = p;
188 
189  p->time = cl.time;
190  VectorClear (p->accel);
191  VectorClear (p->vel);
192  p->alpha = 1.0;
193  p->alphavel = -0.1;
194 // p->alphavel = 0;
195  p->color = 0x74 + (rand()&7);
196  VectorCopy (move, p->org);
197  /*
198  for (j=0 ; j<3 ; j++)
199  {
200  p->org[j] = move[j] + crand()*2;
201  p->vel[j] = crand()*3;
202  p->accel[j] = 0;
203  }
204  */
205 #endif
206  VectorAdd (move, vec, move);
207  }
208 
209 }

Referenced by CL_ParseTEnt().

◆ CL_FlameEffects()

void CL_FlameEffects ( centity_t ent,
vec3_t  origin 
)

Definition at line 331 of file cl_newfx.c.

332 {
333  int n, count;
334  int j;
335  cparticle_t *p;
336 
337  count = rand() & 0xF;
338 
339  for(n=0;n<count;n++)
340  {
341  if (!free_particles)
342  return;
343 
344  p = free_particles;
345  free_particles = p->next;
346  p->next = active_particles;
347  active_particles = p;
348 
349  VectorClear (p->accel);
350  p->time = cl.time;
351 
352  p->alpha = 1.0;
353  p->alphavel = -1.0 / (1+frand()*0.2);
354 #ifndef QMAX
355  p->color = 226 + (rand() % 4);
356 #endif
357  for (j=0 ; j<3 ; j++)
358  {
359  p->org[j] = origin[j] + crand()*5;
360  p->vel[j] = crand()*5;
361  }
362  p->vel[2] = crand() * -10;
363  p->accel[2] = -PARTICLE_GRAVITY;
364  }
365 
366  count = rand() & 0x7;
367 
368  for(n=0;n<count;n++)
369  {
370  if (!free_particles)
371  return;
372  p = free_particles;
373  free_particles = p->next;
374  p->next = active_particles;
375  active_particles = p;
376  VectorClear (p->accel);
377 
378  p->time = cl.time;
379 
380  p->alpha = 1.0;
381  p->alphavel = -1.0 / (1+frand()*0.5);
382 #ifndef QMAX
383  p->color = 0 + (rand() % 4);
384 #endif
385  for (j=0 ; j<3 ; j++)
386  {
387  p->org[j] = origin[j] + crand()*3;
388  }
389  p->vel[2] = 20 + crand()*5;
390  }
391 
392 }

◆ CL_Flashlight()

void CL_Flashlight ( int  ent,
vec3_t  pos 
)

Definition at line 93 of file cl_newfx.c.

94 {
95  cdlight_t *dl;
96 
97  dl = CL_AllocDlight (ent);
98  VectorCopy (pos, dl->origin);
99  dl->radius = 400;
100  dl->minlight = 250;
101  dl->die = cl.time + 100;
102  dl->color[0] = 1;
103  dl->color[1] = 1;
104  dl->color[2] = 1;
105 }

Referenced by CL_ParseTEnt().

◆ CL_ForceWall()

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

Definition at line 261 of file cl_newfx.c.

262 {
263  vec3_t move;
264  vec3_t vec;
265 #ifdef QMAX
266  vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
267 #else
268  int j;
269  cparticle_t *p;
270 #endif
271 
272  float len;
273 
274  VectorCopy (start, move);
275  VectorSubtract (end, start, vec);
276  len = VectorNormalize (vec);
277 
278  VectorScale (vec, 4, vec);
279 
280  // FIXME: this is a really silly way to have a loop
281  while (len > 0)
282  {
283  len -= 4;
284 
285  if (!free_particles)
286  return;
287 
288  if (frand() > 0.3)
289  {
290 #ifdef QMAX
291  setupParticle (
292  0, 0, 0,
293  move[0] + crand()*3, move[1] + crand()*3, move[2] + crand()*3,
294  0, 0, -40 - (crand()*10),
295  0, 0, 0,
296  color[0]+5, color[1]+5, color[2]+5,
297  0, 0, 0,
298  1, -1.0 / (3.0+frand()*0.5),
299  5, 0,
301  0,
302  NULL,0);
303 #else
304  p = free_particles;
305  free_particles = p->next;
306  p->next = active_particles;
307  active_particles = p;
308  VectorClear (p->accel);
309 
310  p->time = cl.time;
311 
312  p->alpha = 1.0;
313  p->alphavel = -1.0 / (3.0+frand()*0.5);
314  p->color = color8;
315  for (j=0 ; j<3 ; j++)
316  {
317  p->org[j] = move[j] + crand()*3;
318  p->accel[j] = 0;
319  }
320  p->vel[0] = 0;
321  p->vel[1] = 0;
322  p->vel[2] = -40 - (crand()*10);
323 #endif
324 
325  }
326 
327  VectorAdd (move, vec, move);
328  }
329 }

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 400 of file cl_newfx.c.

401 {
402  int i, j;
403  cparticle_t *p;
404  float d;
405 
406  for (i=0 ; i<count ; i++)
407  {
408  if (!free_particles)
409  return;
410  p = free_particles;
411  free_particles = p->next;
412  p->next = active_particles;
413  active_particles = p;
414 
415  p->time = cl.time;
416 #ifndef QMAX
417  if (numcolors > 1)
418  p->color = color + (rand() & numcolors);
419  else
420  p->color = color;
421 #endif
422  d = rand() & dirspread;
423  for (j=0 ; j<3 ; j++)
424  {
425  p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
426  p->vel[j] = crand()*20;
427  }
428 
429  p->accel[0] = p->accel[1] = 0;
430  p->accel[2] = -PARTICLE_GRAVITY;
431 // VectorCopy (accel, p->accel);
432  p->alpha = 1.0;
433 
434  p->alphavel = -1.0 / (0.5 + frand()*alphavel);
435 // p->alphavel = alphavel;
436  }
437 }

◆ CL_Heatbeam()

void CL_Heatbeam ( vec3_t  start,
vec3_t  forward 
)

Definition at line 615 of file cl_newfx.c.

616 {
617  vec3_t move;
618  vec3_t vec;
619  float len;
620  int j;
621  cparticle_t *p;
622  vec3_t right, up;
623  int i;
624  float c, s;
625  vec3_t dir;
626  float ltime;
627  float step = 32.0, rstep;
628  float start_pt;
629  float rot;
630  float variance;
631  vec3_t end;
632 
633  VectorMA (start, 4096, forward, end);
634 
635  VectorCopy (start, move);
636  VectorSubtract (end, start, vec);
637  len = VectorNormalize (vec);
638 
639  // FIXME - pmm - these might end up using old values?
640 // MakeNormalVectors (vec, right, up);
642  VectorCopy (cl.v_up, up);
643  if (vidref_val == VIDREF_GL)
644  { // GL mode
645  VectorMA (move, -0.5, right, move);
646  VectorMA (move, -0.5, up, move);
647  }
648  // otherwise assume SOFT
649 
650  ltime = (float) cl.time/1000.0;
651  start_pt = fmod(ltime*96.0,step);
652  VectorMA (move, start_pt, vec, move);
653 
654  VectorScale (vec, step, vec);
655 
656 // Com_Printf ("%f\n", ltime);
657  rstep = M_PI/10.0;
658  for (i=start_pt ; i<len ; i+=step)
659  {
660  if (i>step*5) // don't bother after the 5th ring
661  break;
662 
663  for (rot = 0; rot < M_PI*2; rot += rstep)
664  {
665 
666  if (!free_particles)
667  return;
668 
669  p = free_particles;
670  free_particles = p->next;
671  p->next = active_particles;
672  active_particles = p;
673 
674  p->time = cl.time;
675  VectorClear (p->accel);
676 // rot+= fmod(ltime, 12.0)*M_PI;
677 // c = cos(rot)/2.0;
678 // s = sin(rot)/2.0;
679 // variance = 0.4 + ((float)rand()/(float)RAND_MAX) *0.2;
680  variance = 0.5;
681  c = cos(rot)*variance;
682  s = sin(rot)*variance;
683 
684  // trim it so it looks like it's starting at the origin
685  if (i < 10)
686  {
687  VectorScale (right, c*(i/10.0), dir);
688  VectorMA (dir, s*(i/10.0), up, dir);
689  }
690  else
691  {
692  VectorScale (right, c, dir);
693  VectorMA (dir, s, up, dir);
694  }
695 
696  p->alpha = 0.5;
697  // p->alphavel = -1.0 / (1+frand()*0.2);
698  p->alphavel = -1000.0;
699  // p->color = 0x74 + (rand()&7);
700 #ifndef QMAX
701  p->color = 223 - (rand()&7);
702 #endif
703  for (j=0 ; j<3 ; j++)
704  {
705  p->org[j] = move[j] + dir[j]*3;
706  // p->vel[j] = dir[j]*6;
707  p->vel[j] = 0;
708  }
709  }
710  VectorAdd (move, vec, move);
711  }
712 }

Referenced by CL_AddPlayerBeams().

◆ CL_MonsterPlasma_Shell()

void CL_MonsterPlasma_Shell ( vec3_t  origin)

Definition at line 1029 of file cl_newfx.c.

1030 {
1031  vec3_t dir;
1032  int i;
1033  cparticle_t *p;
1034 
1035  for(i=0;i<40;i++)
1036  {
1037  if (!free_particles)
1038  return;
1039  p = free_particles;
1040  free_particles = p->next;
1041  p->next = active_particles;
1042  active_particles = p;
1043  VectorClear (p->accel);
1044 
1045  p->time = cl.time;
1046 
1047  p->alpha = 1.0;
1049 #ifndef QMAX
1050  p->color = 0xe0;
1051 #endif
1052  dir[0] = crand();
1053  dir[1] = crand();
1054  dir[2] = crand();
1055  VectorNormalize(dir);
1056 
1057  VectorMA(origin, 10, dir, p->org);
1058 // VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
1059  }
1060 }

Referenced by CL_AddPlayerBeams().

◆ CL_Nukeblast()

void CL_Nukeblast ( cl_sustain_t self)

Definition at line 1101 of file cl_newfx.c.

1102 {
1103  vec3_t dir;
1104  int i;
1105  cparticle_t *p;
1106 #ifndef QMAX
1107  static int colortable[4] = {110, 112, 114, 116};
1108 #endif
1109  float ratio;
1110 
1111  ratio = 1.0 - (((float)self->endtime - (float)cl.time)/1000.0);
1112 
1113  for(i=0;i<700;i++)
1114  {
1115  if (!free_particles)
1116  return;
1117  p = free_particles;
1118  free_particles = p->next;
1119  p->next = active_particles;
1120  active_particles = p;
1121  VectorClear (p->accel);
1122 
1123  p->time = cl.time;
1124 
1125  p->alpha = 1.0;
1127 #ifndef QMAX
1128  p->color = colortable[rand()&3];
1129 #endif
1130  dir[0] = crand();
1131  dir[1] = crand();
1132  dir[2] = crand();
1133  VectorNormalize(dir);
1134 
1135  VectorMA(self->org, (200.0 * ratio), dir, p->org);
1136 // VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
1137  }
1138 }

Referenced by CL_ParseNuke().

◆ CL_ParticleSmokeEffect()

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

Definition at line 1331 of file cl_newfx.c.

1332 {
1333  int i, j;
1334  cparticle_t *p;
1335  float d;
1336  vec3_t r, u;
1337 
1338  MakeNormalVectors (dir, r, u);
1339 
1340  for (i=0 ; i<count ; i++)
1341  {
1342  if (!free_particles)
1343  return;
1344  p = free_particles;
1345  free_particles = p->next;
1346  p->next = active_particles;
1347  active_particles = p;
1348 
1349  p->time = cl.time;
1350 #ifndef QMAX
1351  p->color = color + (rand()&7);
1352 #endif
1353  for (j=0 ; j<3 ; j++)
1354  {
1355  p->org[j] = org[j] + magnitude*0.1*crand();
1356 // p->vel[j] = dir[j]*magnitude;
1357  }
1358  VectorScale (dir, magnitude, p->vel);
1359  d = crand()*magnitude/3;
1360  VectorMA (p->vel, d, r, p->vel);
1361  d = crand()*magnitude/3;
1362  VectorMA (p->vel, d, u, p->vel);
1363 
1364  p->accel[0] = p->accel[1] = p->accel[2] = 0;
1365  p->alpha = 1.0;
1366 
1367  p->alphavel = -1.0 / (0.5 + frand()*0.3);
1368  }
1369 }

Referenced by CL_ParseTEnt().

◆ CL_ParticleSteamEffect()

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

Definition at line 844 of file cl_newfx.c.

845 {
846  int i, j;
847  cparticle_t *p;
848  float d;
849  vec3_t r, u;
850 
851 // vectoangles2 (dir, angle_dir);
852 // AngleVectors (angle_dir, f, r, u);
853 
854  MakeNormalVectors (dir, r, u);
855 
856  for (i=0 ; i<count ; i++)
857  {
858  if (!free_particles)
859  return;
860  p = free_particles;
861  free_particles = p->next;
862  p->next = active_particles;
863  active_particles = p;
864 
865  p->time = cl.time;
866 #ifndef QMAX
867  p->color = color + (rand()&7);
868 #endif
869  for (j=0 ; j<3 ; j++)
870  {
871  p->org[j] = org[j] + magnitude*0.1*crand();
872 // p->vel[j] = dir[j]*magnitude;
873  }
874  VectorScale (dir, magnitude, p->vel);
875  d = crand()*magnitude/3;
876  VectorMA (p->vel, d, r, p->vel);
877  d = crand()*magnitude/3;
878  VectorMA (p->vel, d, u, p->vel);
879 
880  p->accel[0] = p->accel[1] = 0;
881  p->accel[2] = -PARTICLE_GRAVITY/2;
882  p->alpha = 1.0;
883 
884  p->alphavel = -1.0 / (0.5 + frand()*0.3);
885  }
886 }

Referenced by CL_ParseSteam(), and CL_ParseTEnt().

◆ CL_ParticleSteamEffect2()

void CL_ParticleSteamEffect2 ( cl_sustain_t self)

Definition at line 888 of file cl_newfx.c.

890 {
891  int i, j;
892  cparticle_t *p;
893  float d;
894  vec3_t r, u;
895  vec3_t dir;
896 
897 // vectoangles2 (dir, angle_dir);
898 // AngleVectors (angle_dir, f, r, u);
899 
900  VectorCopy (self->dir, dir);
901  MakeNormalVectors (dir, r, u);
902 
903  for (i=0 ; i<self->count ; i++)
904  {
905  if (!free_particles)
906  return;
907  p = free_particles;
908  free_particles = p->next;
909  p->next = active_particles;
910  active_particles = p;
911 
912  p->time = cl.time;
913 #ifndef QMAX
914  p->color = self->color + (rand()&7);
915 #endif
916  for (j=0 ; j<3 ; j++)
917  {
918  p->org[j] = self->org[j] + self->magnitude*0.1*crand();
919 // p->vel[j] = dir[j]*magnitude;
920  }
921  VectorScale (dir, self->magnitude, p->vel);
922  d = crand()*self->magnitude/3;
923  VectorMA (p->vel, d, r, p->vel);
924  d = crand()*self->magnitude/3;
925  VectorMA (p->vel, d, u, p->vel);
926 
927  p->accel[0] = p->accel[1] = 0;
928  p->accel[2] = -PARTICLE_GRAVITY/2;
929  p->alpha = 1.0;
930 
931  p->alphavel = -1.0 / (0.5 + frand()*0.3);
932  }
933  self->nextthink += self->thinkinterval;
934 }

Referenced by CL_ParseSteam().

◆ CL_SmokeTrail()

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

Definition at line 216 of file cl_newfx.c.

217 {
218  vec3_t move;
219  vec3_t vec;
220  float len;
221  int j;
222  cparticle_t *p;
223 
224  VectorCopy (start, move);
225  VectorSubtract (end, start, vec);
226  len = VectorNormalize (vec);
227 
228  VectorScale (vec, spacing, vec);
229 
230  // FIXME: this is a really silly way to have a loop
231  while (len > 0)
232  {
233  len -= spacing;
234 
235  if (!free_particles)
236  return;
237  p = free_particles;
238  free_particles = p->next;
239  p->next = active_particles;
240  active_particles = p;
241  VectorClear (p->accel);
242 
243  p->time = cl.time;
244 
245  p->alpha = 1.0;
246  p->alphavel = -1.0 / (1+frand()*0.5);
247 #ifndef QMAX
248  p->color = colorStart + (rand() % colorRun);
249 #endif
250  for (j=0 ; j<3 ; j++)
251  {
252  p->org[j] = move[j] + crand()*3;
253  p->accel[j] = 0;
254  }
255  p->vel[2] = 20 + crand()*5;
256 
257  VectorAdd (move, vec, move);
258  }
259 }

◆ CL_TagTrail()

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

Definition at line 1218 of file cl_newfx.c.

1219 {
1220  vec3_t move;
1221  vec3_t vec;
1222  float len;
1223  int j;
1224  cparticle_t *p;
1225  int dec;
1226 
1227  VectorCopy (start, move);
1228  VectorSubtract (end, start, vec);
1229  len = VectorNormalize (vec);
1230 
1231  dec = 5;
1232  VectorScale (vec, 5, vec);
1233 
1234  while (len >= 0)
1235  {
1236  len -= dec;
1237 
1238  if (!free_particles)
1239  return;
1240  p = free_particles;
1241  free_particles = p->next;
1242  p->next = active_particles;
1243  active_particles = p;
1244  VectorClear (p->accel);
1245 
1246  p->time = cl.time;
1247 
1248  p->alpha = 1.0;
1249  p->alphavel = -1.0 / (0.8+frand()*0.2);
1250 #ifndef QMAX
1251  p->color = color;
1252 #endif
1253  for (j=0 ; j<3 ; j++)
1254  {
1255  p->org[j] = move[j] + crand()*16;
1256  p->vel[j] = crand()*5;
1257  p->accel[j] = 0;
1258  }
1259 
1260  VectorAdd (move, vec, move);
1261  }
1262 }

Referenced by CL_AddPacketEntities().

◆ CL_Tracker_Explode()

void CL_Tracker_Explode ( vec3_t  origin)

Definition at line 1177 of file cl_newfx.c.

1178 {
1179  vec3_t dir, backdir;
1180  int i;
1181  cparticle_t *p;
1182 
1183  for(i=0;i<300;i++)
1184  {
1185  if (!free_particles)
1186  return;
1187  p = free_particles;
1188  free_particles = p->next;
1189  p->next = active_particles;
1190  active_particles = p;
1191  VectorClear (p->accel);
1192 
1193  p->time = cl.time;
1194 
1195  p->alpha = 1.0;
1196  p->alphavel = -1.0;
1197 #ifndef QMAX
1198  p->color = 0;
1199 #endif
1200  dir[0] = crand();
1201  dir[1] = crand();
1202  dir[2] = crand();
1203  VectorNormalize(dir);
1204  VectorScale(dir, -1, backdir);
1205 
1206  VectorMA(origin, 64, dir, p->org);
1207  VectorScale(backdir, 64, p->vel);
1208  }
1209 
1210 }

◆ CL_Tracker_Shell()

void CL_Tracker_Shell ( vec3_t  origin)

Definition at line 997 of file cl_newfx.c.

998 {
999  vec3_t dir;
1000  int i;
1001  cparticle_t *p;
1002 
1003  for(i=0;i<300;i++)
1004  {
1005  if (!free_particles)
1006  return;
1007  p = free_particles;
1008  free_particles = p->next;
1009  p->next = active_particles;
1010  active_particles = p;
1011  VectorClear (p->accel);
1012 
1013  p->time = cl.time;
1014 
1015  p->alpha = 1.0;
1017 #ifndef QMAX
1018  p->color = 0;
1019 #endif
1020  dir[0] = crand();
1021  dir[1] = crand();
1022  dir[2] = crand();
1023  VectorNormalize(dir);
1024 
1025  VectorMA(origin, 40, dir, p->org);
1026  }
1027 }

Referenced by CL_AddPacketEntities().

◆ CL_TrackerTrail()

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

Definition at line 941 of file cl_newfx.c.

942 {
943  vec3_t move;
944  vec3_t vec;
945  vec3_t forward,right,up,angle_dir;
946  float len;
947  int j;
948  cparticle_t *p;
949  int dec;
950  float dist;
951 
952  VectorCopy (start, move);
953  VectorSubtract (end, start, vec);
954  len = VectorNormalize (vec);
955 
956  VectorCopy(vec, forward);
957  vectoangles2 (forward, angle_dir);
958  AngleVectors (angle_dir, forward, right, up);
959 
960  dec = 3;
961  VectorScale (vec, 3, vec);
962 
963  // FIXME: this is a really silly way to have a loop
964  while (len > 0)
965  {
966  len -= dec;
967 
968  if (!free_particles)
969  return;
970  p = free_particles;
971  free_particles = p->next;
972  p->next = active_particles;
973  active_particles = p;
974  VectorClear (p->accel);
975 
976  p->time = cl.time;
977 
978  p->alpha = 1.0;
979  p->alphavel = -2.0;
980 #ifndef QMAX
981  p->color = particleColor;
982 #endif
983  dist = DotProduct(move, forward);
984  VectorMA(move, 8 * cos(dist), up, p->org);
985  for (j=0 ; j<3 ; j++)
986  {
987 // p->org[j] = move[j] + crand();
988  p->vel[j] = 0;
989  p->accel[j] = 0;
990  }
991  p->vel[2] = 5;
992 
993  VectorAdd (move, vec, move);
994  }
995 }

Referenced by CL_AddPacketEntities().

◆ CL_Widowbeamout()

void CL_Widowbeamout ( cl_sustain_t self)

Definition at line 1062 of file cl_newfx.c.

1063 {
1064  vec3_t dir;
1065  int i;
1066  cparticle_t *p;
1067 #ifndef QMAX
1068  static int colortable[4] = {2*8,13*8,21*8,18*8};
1069 #endif
1070  float ratio;
1071 
1072  ratio = 1.0 - (((float)self->endtime - (float)cl.time)/2100.0);
1073 
1074  for(i=0;i<300;i++)
1075  {
1076  if (!free_particles)
1077  return;
1078  p = free_particles;
1079  free_particles = p->next;
1080  p->next = active_particles;
1081  active_particles = p;
1082  VectorClear (p->accel);
1083 
1084  p->time = cl.time;
1085 
1086  p->alpha = 1.0;
1088 #ifndef QMAX
1089  p->color = colortable[rand()&3];
1090 #endif
1091  dir[0] = crand();
1092  dir[1] = crand();
1093  dir[2] = crand();
1094  VectorNormalize(dir);
1095 
1096  VectorMA(self->org, (45.0 * ratio), dir, p->org);
1097 // VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
1098  }
1099 }

Referenced by CL_ParseWidow().

◆ CL_WidowSplash()

void CL_WidowSplash ( vec3_t  org)

Definition at line 1140 of file cl_newfx.c.

1141 {
1142 #ifndef QMAX
1143  static int colortable[4] = {2*8,13*8,21*8,18*8};
1144 #endif
1145  int i;
1146  cparticle_t *p;
1147  vec3_t dir;
1148 
1149  for (i=0 ; i<256 ; i++)
1150  {
1151  if (!free_particles)
1152  return;
1153  p = free_particles;
1154  free_particles = p->next;
1155  p->next = active_particles;
1156  active_particles = p;
1157 
1158  p->time = cl.time;
1159 #ifndef QMAX
1160  p->color = colortable[rand()&3];
1161 #endif
1162  dir[0] = crand();
1163  dir[1] = crand();
1164  dir[2] = crand();
1165  VectorNormalize(dir);
1166  VectorMA(org, 45.0, dir, p->org);
1167  VectorMA(vec3_origin, 40.0, dir, p->vel);
1168 
1169  p->accel[0] = p->accel[1] = 0;
1170  p->alpha = 1.0;
1171 
1172  p->alphavel = -0.8 / (0.5 + frand()*0.3);
1173  }
1174 
1175 }

Referenced by CL_ParseTEnt().

◆ MakeNormalVectors()

void MakeNormalVectors ( vec3_t  forward,
vec3_t  right,
vec3_t  up 
)

Definition at line 1669 of file cl_fx.c.

1670 {
1671  float d;
1672 
1673  // this rotate and negat guarantees a vector
1674  // not colinear with the original
1675  right[1] = -forward[0];
1676  right[2] = forward[1];
1677  right[0] = forward[2];
1678 
1679  d = DotProduct (right, forward);
1680  VectorMA (right, -d, forward, right);
1683 }

Referenced by CL_DebugTrail(), CL_ParticleSmokeEffect(), CL_ParticleSteamEffect(), CL_ParticleSteamEffect2(), CL_RailSprial(), and CL_RailTrail().

◆ vectoangles2()

void vectoangles2 ( vec3_t  value1,
vec3_t  angles 
)

Definition at line 54 of file cl_newfx.c.

55 {
56  float forward;
57  float yaw, pitch;
58 
59  if (value1[1] == 0 && value1[0] == 0)
60  {
61  yaw = 0;
62  if (value1[2] > 0)
63  pitch = 90;
64  else
65  pitch = 270;
66  }
67  else
68  {
69  // PMM - fixed to correct for pitch of 0
70  if (value1[0])
71  yaw = (atan2(value1[1], value1[0]) * 180 / M_PI);
72  else if (value1[1] > 0)
73  yaw = 90;
74  else
75  yaw = 270;
76 
77  if (yaw < 0)
78  yaw += 360;
79 
80  forward = sqrt (value1[0]*value1[0] + value1[1]*value1[1]);
81  pitch = (atan2(value1[2], forward) * 180 / M_PI);
82  if (pitch < 0)
83  pitch += 360;
84  }
85 
86  angles[PITCH] = -pitch;
87  angles[YAW] = yaw;
88  angles[ROLL] = 0;
89 }

Referenced by CL_LaserStun(), and CL_TrackerTrail().

Variable Documentation

◆ active_particles

◆ cl_numparticles

int cl_numparticles

Definition at line 65 of file cl_fx.c.

Referenced by CL_ClearParticles().

◆ free_particles

◆ particles

Definition at line 63 of file cl_fx.c.

Referenced by CL_ClearParticles(), and GL_DrawParticles().

◆ vid_ref

cvar_t* vid_ref

Definition at line 43 of file vid_dll.c.

Referenced by R_Register(), VID_CheckChanges(), VID_Init(), VID_LoadRefresh(), and VID_Restart_f().

particle_s::vel
vec3_t vel
Definition: client.h:416
YAW
#define YAW
Definition: q_shared.h:66
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
cdlight_t::radius
float radius
Definition: client.h:339
cl_sustain::magnitude
int magnitude
Definition: client.h:377
particle_s::time
float time
Definition: client.h:413
client_state_t::v_up
vec3_t v_up
Definition: client.h:153
particle_s::accel
vec3_t accel
Definition: client.h:417
CL_AllocDlight
cdlight_t * CL_AllocDlight(int key)
Definition: cl_fx.c:249
frand
float frand(void)
Definition: common.c:1398
cdlight_t::die
float die
Definition: client.h:340
cl_sustain::endtime
int endtime
Definition: client.h:370
cdlight_t
Definition: client.h:334
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
VectorClear
#define VectorClear(a)
Definition: q_shared.h:159
i
int i
Definition: q_shared.c:305
particle_s::org
vec3_t org
Definition: client.h:415
PITCH
#define PITCH
Definition: q_shared.h:65
M_PI
#define M_PI
Definition: q_shared.h:135
free_particles
cparticle_t * free_particles
Definition: cl_newfx.c:24
intensity
cvar_t * intensity
Definition: gl_image.c:30
vectoangles2
void vectoangles2(vec3_t value1, vec3_t angles)
Definition: cl_newfx.c:54
MakeNormalVectors
void MakeNormalVectors(vec3_t forward, vec3_t right, vec3_t up)
Definition: cl_fx.c:1669
j
GLint j
Definition: qgl_win.c:150
particle_s::next
struct particle_s * next
Definition: client.h:411
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
active_particles
cparticle_t * active_particles
Definition: cl_fx.c:62
particle_s::alphavel
float alphavel
Definition: client.h:426
color8green
int color8green(int color8)
Definition: cl_fxmax.c:97
particle_bubble
@ particle_bubble
Definition: particles.h:12
particle_s
Definition: client.h:409
CrossProduct
void CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross)
Definition: q_shared.c:753
r
GLdouble GLdouble r
Definition: qgl_win.c:336
VIDREF_GL
#define VIDREF_GL
Definition: q_shared.h:1226
ROLL
#define ROLL
Definition: q_shared.h:67
forward
static vec3_t forward
Definition: p_view.c:29
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:155
particle_s::alpha
float alpha
Definition: client.h:425
cdlight_t::color
vec3_t color
Definition: client.h:337
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
NULL
#define NULL
Definition: q_shared.h:60
setupParticle
cparticle_t * setupParticle(float angle0, float angle1, float angle2, float org0, float org1, float org2, float vel0, float vel1, float vel2, float accel0, float accel1, float accel2, float color0, float color1, float color2, float colorvel0, float colorvel1, float colorvel2, float alpha, float alphavel, float size, float sizevel, int image, int flags, void(*think)(cparticle_t *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time), qboolean thinknext)
Definition: cl_fxmax.c:978
VIDREF_SOFT
#define VIDREF_SOFT
Definition: q_shared.h:1227
color8red
int color8red(int color8)
Definition: cl_fxmax.c:93
client_state_t::time
int time
Definition: client.h:147
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
client_state_t::v_right
vec3_t v_right
Definition: client.h:153
particle_generic
@ particle_generic
Definition: particles.h:6
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
INSTANT_PARTICLE
#define INSTANT_PARTICLE
Definition: client.h:456
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
up
static vec3_t up
Definition: p_view.c:29
cl_sustain::org
vec3_t org
Definition: client.h:373
color8blue
int color8blue(int color8)
Definition: cl_fxmax.c:101
sqrt
double sqrt(double x)
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
cl_sustain::dir
vec3_t dir
Definition: client.h:374
cdlight_t::minlight
float minlight
Definition: client.h:342
cdlight_t::origin
vec3_t origin
Definition: client.h:338
right
GLdouble right
Definition: qgl_win.c:159
crand
float crand(void)
Definition: common.c:1403
cl
client_state_t cl
Definition: cl_main.c:106
PARTICLE_GRAVITY
#define PARTICLE_GRAVITY
Definition: client.h:453
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
vidref_val
int vidref_val
Definition: cl_ents.c:28
particle_s::color
float color
Definition: client.h:422
count
GLint GLsizei count
Definition: qgl_win.c:128