forked from QW-Group/ezquake-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcl_tent.c
719 lines (629 loc) · 17.6 KB
/
cl_tent.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$Id: cl_tent.c,v 1.25 2007-01-05 09:50:28 qqshka Exp $
*/
// cl_tent.c -- client side temporary entities
#include "quakedef.h"
#define MAX_BEAMS 32
typedef struct {
int entity;
model_t *model;
float endtime;
vec3_t start, end;
} beam_t;
beam_t cl_beams[MAX_BEAMS];
static vec3_t playerbeam_end;
#define MAX_EXPLOSIONS 32
typedef struct explosion_s {
struct explosion_s *prev, *next;
vec3_t origin;
float start;
model_t *model;
} explosion_t;
// cl_free_explosions = linear linked list of free explosions
explosion_t cl_explosions[MAX_EXPLOSIONS];
explosion_t cl_explosions_headnode, *cl_free_explosions;
static model_t *cl_explo_mod, *cl_bolt1_mod, *cl_bolt2_mod, *cl_bolt3_mod, *cl_beam_mod;
sfx_t *cl_sfx_wizhit, *cl_sfx_knighthit, *cl_sfx_tink1, *cl_sfx_ric1, *cl_sfx_ric2, *cl_sfx_ric3, *cl_sfx_r_exp3;
cvar_t r_lgblood = {"r_lgbloodColor", "225"};
cvar_t r_shiftbeam = {"r_shiftbeam", "0"};
void CL_InitTEnts (void) {
cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav");
cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav");
cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav");
cl_sfx_ric1 = S_PrecacheSound ("weapons/ric1.wav");
cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav");
cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav");
cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav");
Cvar_SetCurrentGroup(CVAR_GROUP_EYECANDY);
Cvar_Register(&r_lgblood);
Cvar_Register(&r_shiftbeam);
Cvar_ResetCurrentGroup();
}
void CL_ClearTEnts (void) {
int i;
cl_explo_mod = cl_bolt1_mod = cl_bolt2_mod = cl_bolt3_mod = cl_beam_mod = NULL;
memset (&cl_beams, 0, sizeof(cl_beams));
memset (&cl_explosions, 0, sizeof(cl_explosions));
// link explosions
cl_free_explosions = cl_explosions;
cl_explosions_headnode.next = cl_explosions_headnode.prev = &cl_explosions_headnode;
for (i = 0; i < MAX_EXPLOSIONS - 1; i++)
cl_explosions[i].next = &cl_explosions[i + 1];
}
explosion_t *CL_AllocExplosion (void) {
explosion_t *ex;
if (cl_free_explosions) {
// take a free explosion if possible
ex = cl_free_explosions;
cl_free_explosions = ex->next;
} else {
// grab the oldest one otherwise
ex = cl_explosions_headnode.prev;
ex->prev->next = ex->next;
ex->next->prev = ex->prev;
}
// put the explosion at the start of the list
ex->prev = &cl_explosions_headnode;
ex->next = cl_explosions_headnode.next;
ex->next->prev = ex;
ex->prev->next = ex;
return ex;
}
void CL_FreeExplosion (explosion_t *ex) {
// remove from linked active list
ex->prev->next = ex->next;
ex->next->prev = ex->prev;
// insert into front linked free list
ex->next = cl_free_explosions;
cl_free_explosions = ex;
}
static void CL_ParseBeam (int type) {
int ent, i;
vec3_t start, end;
beam_t *b;
struct model_s *m;
ent = MSG_ReadShort ();
start[0] = MSG_ReadCoord ();
start[1] = MSG_ReadCoord ();
start[2] = MSG_ReadCoord ();
end[0] = MSG_ReadCoord ();
end[1] = MSG_ReadCoord ();
end[2] = MSG_ReadCoord ();
switch (type) {
case 1:
if (!cl_bolt1_mod)
cl_bolt1_mod = Mod_ForName ("progs/bolt.mdl", true);
m = cl_bolt1_mod;
break;
case 2:
if (!cl_bolt2_mod)
cl_bolt2_mod = Mod_ForName ("progs/bolt2.mdl", true);
m = cl_bolt2_mod;
break;
case 3:
if (!cl_bolt3_mod)
cl_bolt3_mod = Mod_ForName ("progs/bolt3.mdl", true);
m = cl_bolt3_mod;
break;
case 4: default:
if (!cl_beam_mod)
cl_beam_mod = Mod_ForName ("progs/beam.mdl", true);
m = cl_beam_mod;
break;
}
if (ent == cl.viewplayernum + 1)
VectorCopy (end, playerbeam_end); // for cl_fakeshaft
// override any beam with the same entity
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
if (b->entity == ent) {
b->model = m;
b->endtime = cl.time + 0.2;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
return;
}
}
// find a free beam
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
if (!b->model || b->endtime < cl.time) {
b->entity = ent;
b->model = m;
b->endtime = cl.time + 0.2;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
return;
}
}
Com_DPrintf ("beam list overflow!\n");
}
void CL_ExplosionSprite (vec3_t pos) {
explosion_t *ex;
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->origin);
ex->start = cl.time;
if (!cl_explo_mod)
cl_explo_mod = Mod_ForName ("progs/s_explod.spr", true);
ex->model = cl_explo_mod;
}
void CL_ParseTEnt (void) {
int rnd, cnt, type;
vec3_t pos;
dlight_t *dl;
#ifdef GLQUAKE
byte col[2];
#endif
pos[0] = pos[1] = pos[2] = 0;
type = MSG_ReadByte ();
switch (type) {
case TE_WIZSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_sparks.value && !Rulesets_RestrictParticles())
{
col[0] = 0; col[1] = 124; col[2] = 0;
SparkGen (pos, col, 20, 90, 1);
}
else
#endif
R_RunParticleEffect (pos, vec3_origin, 20, 30);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
case TE_KNIGHTSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_sparks.value && !Rulesets_RestrictParticles())
{
col[0] = 255; col[1] = 77; col[2] = 0;
SparkGen (pos, col, 20, 150, 1);
}
else
#endif
R_RunParticleEffect (pos, vec3_origin, 226, 20);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_spikes.value && !Rulesets_RestrictParticles())
VXNailhit (pos, 10*amf_part_spikes.value);
else
#endif
R_RunParticleEffect (pos, vec3_origin, 0, 10);
if ( rand() % 5 ) {
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} else {
rnd = rand() & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2)
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
case TE_SUPERSPIKE: // super spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_spikes.value && !Rulesets_RestrictParticles())
VXNailhit (pos, 20*amf_part_spikes.value);
else
#endif
R_RunParticleEffect (pos, vec3_origin, 0, 20);
if ( rand() % 5 ) {
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} else {
rnd = rand() & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2)
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
case TE_EXPLOSION: // rocket explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_explosiontype.value == 2)
{
#ifdef GLQUAKE
if (amf_part_teleport.value)
VXTeleport(pos);
else
#endif
R_TeleportSplash (pos); //teleport splash
#ifdef GLQUAKE
if (amf_coronas_tele.value)
NewCorona (C_BLUEFLASH, pos);
#endif
}
else if (r_explosiontype.value == 3)
{
R_RunParticleEffect (pos, vec3_origin, 225, 50); //lightning blood
}
else if (r_explosiontype.value == 4)
{
R_RunParticleEffect (pos, vec3_origin, 73, 20 * 32); //big blood
}
else if (r_explosiontype.value == 5)
{
R_RunParticleEffect (pos, vec3_origin, 0, 20 * 14); //dbl gunshot
}
else if (r_explosiontype.value == 6)
{
#ifdef GLQUAKE
if (amf_part_blobexplosion.value)
VXBlobExplosion(pos);
else
#endif
R_BlobExplosion (pos); //blob explosion
#ifdef GLQUAKE
//VULT CORONAS
if (amf_coronas.value)
NewCorona (C_BLUEFLASH, pos);
}
else if (r_explosiontype.value == 7 && qmb_initialized && gl_part_explosions.value)
{
QMB_DetpackExplosion (pos); //detpack explosion
#endif
}
#ifdef GLQUAKE
//VULT PARTICLES
else if (r_explosiontype.value == 8)
{
FuelRodExplosion (pos);
}
// START shaman FIX 1026019
// else if (r_explosiontype.value == 9)
// {
// BurningExplosion (pos);
// }
// END shaman FIX 1026019
#endif
else
{ //sprite and particles
#ifdef GLQUAKE
if (amf_part_explosion.value)
VXExplosion(pos);
else
#endif
R_ParticleExplosion (pos); //normal explosion
}
if (r_explosionlight.value)
{
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + 200 * bound(0, r_explosionlight.value, 1);
dl->die = cl.time + 0.5;
dl->decay = 300;
#ifdef GLQUAKE
if (r_explosiontype.value == 8)
dl->type = lt_green;
else
#endif
{
customlight_t cst_lt = {0};
dlightColorEx(r_explosionlightcolor.value, r_explosionlightcolor.string, lt_explosion, true, &cst_lt);
dl->type = cst_lt.type;
#ifdef GLQUAKE
if (dl->type == lt_custom)
VectorCopy(cst_lt.color, dl->color);
#endif
}
#ifdef GLQUAKE
//VULT CORONAS
if (amf_coronas.value && r_explosiontype.value != 7 && r_explosiontype.value != 2 && r_explosiontype.value != 8)
NewCorona (C_FLASH, pos);
#endif
}
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
case TE_TAREXPLOSION: // tarbaby explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_blobexplosion.value)
VXBlobExplosion(pos);
else
#endif
R_BlobExplosion (pos); //blob explosion
//VULT CORONAS
#ifdef GLQUAKE
if (amf_coronas.value)
NewCorona (C_BLUEFLASH, pos);
#endif
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
case TE_LIGHTNING1: // lightning bolts
CL_ParseBeam (1);
break;
case TE_LIGHTNING2: // lightning bolts
CL_ParseBeam (2);
break;
case TE_LIGHTNING3: // lightning bolts
CL_ParseBeam (3);
break;
case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_LavaSplash (pos);
break;
case TE_TELEPORT:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_telesplash.value){
#ifdef GLQUAKE
if (amf_part_teleport.value)
VXTeleport(pos);
else
#endif
R_TeleportSplash (pos); //teleport splash
#ifdef GLQUAKE
if (amf_coronas_tele.value)
NewCorona (C_BLUEFLASH, pos);
#endif
}
break;
case TE_GUNSHOT: // bullet hitting wall
if (cls.nqdemoplayback)
cnt = 1;
else
cnt = MSG_ReadByte ();
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_gunshot.value && !Rulesets_RestrictParticles())
VXGunshot (pos, 5*cnt*amf_part_gunshot.value);
else
#endif
R_RunParticleEffect (pos, vec3_origin, 0, 20*cnt);
break;
case TE_BLOOD: // bullets hitting body
if (cls.nqdemoplayback) {
// NQ_TE_EXPLOSION2
int colorStart, colorLength;
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
colorStart = MSG_ReadByte ();
colorLength = MSG_ReadByte ();
//## CL_ParticleExplosion2 (pos, colorStart, colorLength);
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
}
cnt = MSG_ReadByte ();
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLQUAKE
if (amf_part_blood.value)
VXBlood (pos, 5*cnt*amf_part_blood.value);
else
#endif
R_RunParticleEffect (pos, vec3_origin, 73, 20*cnt);
break;
case TE_LIGHTNINGBLOOD: // lightning hitting body
if (cls.nqdemoplayback) {
// NQ_TE_BEAM - grappling hook beam
CL_ParseBeam (4);
break;
}
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_RunParticleEffect (pos, vec3_origin, r_lgblood.value, 50); // 225 default
break;
default:
Host_Error("CL_ParseTEnt: bad type");
}
// Save the temp entities.
VectorCopy(pos, temp_entities.list[temp_entities.count].pos);
temp_entities.list[temp_entities.count].time = cls.demoplayback ? cls.demotime : cls.realtime; // FIXME: Use realtime here?
temp_entities.list[temp_entities.count].type = type;
temp_entities.count = (temp_entities.count + 1 >= MAX_TEMP_ENTITIES) ? 0 : temp_entities.count + 1;
}
void vectoangles(vec3_t vec, vec3_t ang);
#define MAX_LIGHTNINGBEAMS 10
//VULT LIGHTNING
void CL_UpdateBeams (void) {
int i;
beam_t *b;
vec3_t dist, org;
entity_t ent;
float d, yaw, pitch, forward, fakeshaft;
extern cvar_t v_viewheight;
#ifdef GLQUAKE
float lg_size = bound(3, amf_lightning_size.value, 30);
int beamstodraw, j, k;
qbool sparks = false;
vec3_t beamstart[MAX_LIGHTNINGBEAMS], beamend[MAX_LIGHTNINGBEAMS];
#endif
memset (&ent, 0, sizeof(entity_t));
ent.colormap = vid.colormap;
#ifdef GLQUAKE
beamstodraw = bound(1, amf_lightning.value, MAX_LIGHTNINGBEAMS);
#endif
fakeshaft = bound(0, cl_fakeshaft.value, cl.fakeshaft);
// update lightning
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
if (!b->model || b->endtime < cl.time)
continue;
// if coming from the player, update the start position
if (b->entity == cl.viewplayernum + 1) {
VectorCopy (cl.simorg, b->start);
b->start[2] += cl.crouch + bound(-7, v_viewheight.value, 4);
VectorMA(b->start, r_shiftbeam.value, vright, b->start);
if (cl_fakeshaft.value) {
vec3_t forward, v, org, ang;
float delta;
trace_t trace;
VectorSubtract (playerbeam_end, cl.simorg, v);
v[2] -= 22; // adjust for view height
vectoangles (v, ang);
// lerp pitch
ang[0] = -ang[0];
if (ang[0] < -180)
ang[0] += 360;
ang[0] += (cl.simangles[0] - ang[0]) * fakeshaft;
// lerp yaw
delta = cl.simangles[1] - ang[1];
if (delta > 180)
delta -= 360;
if (delta < -180)
delta += 360;
ang[1] += delta * fakeshaft;
ang[2] = 0;
AngleVectors (ang, forward, NULL, NULL);
VectorScale (forward, 600, forward);
VectorCopy (cl.simorg, org);
org[2] += 16;
VectorAdd (org, forward, b->end);
trace = PM_TraceLine (org, b->end);
if (trace.fraction < 1)
VectorCopy (trace.endpos, b->end);
}
}
// calculate pitch and yaw
VectorSubtract (b->end, b->start, dist);
if (dist[1] == 0 && dist[0] == 0) {
yaw = 0;
pitch = (dist[2] > 0) ? 90 : 270;
} else {
yaw = atan2(dist[1], dist[0]) * 180 / M_PI;
if (yaw < 0)
yaw += 360;
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
pitch = atan2(dist[2], forward) * 180 / M_PI;
if (pitch < 0)
pitch += 360;
}
// add new entities for the lightning
VectorCopy (b->start, org);
#ifdef GLQUAKE
for (k=0;k<beamstodraw;k++)
VectorCopy (b->start, beamstart[k]);
#endif
d = VectorNormalize(dist);
VectorScale (dist, 30, dist);
for ( ; d > 0; d -= 30)
{
#ifdef GLQUAKE
if (!amf_lightning.value || Rulesets_RestrictParticles())
{
#endif
VectorCopy (org, ent.origin);
ent.model = b->model;
ent.angles[0] = pitch;
ent.angles[1] = yaw;
ent.angles[2] = rand() % 360;
if (!Rulesets_RestrictParticles())
ent.alpha = r_shaftalpha.value;
CL_AddEntity (&ent);
#ifdef GLQUAKE
}
else
{
if (!ISPAUSED)
{
//VULT - Some people might like their lightning beams thicker
for (k=0;k<beamstodraw;k++)
{
VectorAdd (org, dist, beamend[k]);
for (j=0;j<3;j++)
// START shaman RFE 1022310
// beamend[k][j]+=(rand()%40)-20;
// beamend[k][j]+=(rand()%((int)lg_size*2))-(int)lg_size; // can be rendered this way too, seems more or less equal
beamend[k][j]+=f_rnd(-lg_size, lg_size);
// END shaman RFE 1022310
VX_LightningBeam (beamstart[k], beamend[k]);
VectorCopy (beamend[k], beamstart[k]);
}
}
}
//VULT LIGHTNING
//The infamous d-light glow has been replaced with a simple corona so it doesn't light up the room anymore
if (amf_coronas.value && amf_lightning.value && !ISPAUSED)
{
if (b->entity == cl.viewplayernum + 1 && !((cls.demoplayback || cl.spectator) && amf_camera_chase.value))
NewCorona (C_SMALLLIGHTNING, org);
else
NewCorona (C_LIGHTNING, org);
}
#endif
VectorAdd (org, dist, org);
#ifdef GLQUAKE
//VULT LIGHTNING SPARKS
if (amf_lightning_sparks.value && (cls.demoplayback || cl.spectator) && !sparks && !ISPAUSED)
{
trace_t trace;
trace = PM_TraceLine (org, b->end);
if (trace.fraction < 1)
{
byte col[3] = {60,100,240};
SparkGen (trace.endpos, col, (int)(3*amf_lightning_sparks.value), 300, 0.25);
sparks = true;
}
}
#endif
}
}
}
void CL_UpdateExplosions (void) {
int f;
explosion_t *ex, *next, *hnode;
entity_t ent;
memset (&ent, 0, sizeof(entity_t));
ent.colormap = vid.colormap;
hnode = &cl_explosions_headnode;
for (ex = hnode->next; ex != hnode; ex = next) {
next = ex->next;
f = 10 * (cl.time - ex->start);
if (f >= ex->model->numframes) {
CL_FreeExplosion (ex);
continue;
}
VectorCopy (ex->origin, ent.origin);
ent.model = ex->model;
ent.frame = f;
CL_AddEntity (&ent);
}
}
void CL_UpdateTEnts (void) {
CL_UpdateBeams ();
CL_UpdateExplosions ();
#ifdef GLQUAKE
//VULT MOTION TRAILS
if (amf_motiontrails.value || MotionBlurCount) //dont stop removing trails if we have 'em
CL_UpdateBlurs();
#endif
}