-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathcl_fx.c
2306 lines (1940 loc) · 48.5 KB
/
cl_fx.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
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (C) 1997-2001 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.
*/
// cl_fx.c -- entity effects parsing and management
#include "client.h"
void CL_LogoutEffect (vec3_t org, int type);
void CL_ItemRespawnParticles (vec3_t org);
static vec3_t avelocities [NUMVERTEXNORMALS];
extern struct model_s *cl_mod_smoke;
extern struct model_s *cl_mod_flash;
/*
==============================================================
LIGHT STYLE MANAGEMENT
==============================================================
*/
typedef struct
{
int length;
float value[3];
float map[MAX_QPATH];
} clightstyle_t;
clightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
int lastofs;
/*
================
CL_ClearLightStyles
================
*/
void CL_ClearLightStyles (void)
{
memset (cl_lightstyle, 0, sizeof(cl_lightstyle));
lastofs = -1;
}
/*
================
CL_RunLightStyles
================
*/
void CL_RunLightStyles (void)
{
int ofs;
int i;
clightstyle_t *ls;
ofs = cl.time / 100;
if (ofs == lastofs)
return;
lastofs = ofs;
for (i=0,ls=cl_lightstyle ; i<MAX_LIGHTSTYLES ; i++, ls++)
{
if (!ls->length)
{
ls->value[0] = ls->value[1] = ls->value[2] = 1.0;
continue;
}
if (ls->length == 1)
ls->value[0] = ls->value[1] = ls->value[2] = ls->map[0];
else
ls->value[0] = ls->value[1] = ls->value[2] = ls->map[ofs%ls->length];
}
}
void CL_SetLightstyle (int i)
{
char *s;
int j, k;
s = cl.configstrings[i+CS_LIGHTS];
j = (int)strlen (s);
if (j >= MAX_QPATH)
Com_Error (ERR_DROP, "svc_lightstyle length=%i", j);
cl_lightstyle[i].length = j;
for (k=0 ; k<j ; k++)
cl_lightstyle[i].map[k] = (float)(s[k]-'a')/(float)('m'-'a');
}
/*
================
CL_AddLightStyles
================
*/
void CL_AddLightStyles (void)
{
int i;
clightstyle_t *ls;
for (i=0,ls=cl_lightstyle ; i<MAX_LIGHTSTYLES ; i++, ls++)
V_AddLightStyle (i, ls->value[0], ls->value[1], ls->value[2]);
}
/*
==============================================================
DLIGHT MANAGEMENT
==============================================================
*/
cdlight_t cl_dlights[MAX_DLIGHTS];
/*
================
CL_ClearDlights
================
*/
void CL_ClearDlights (void)
{
memset (cl_dlights, 0, sizeof(cl_dlights));
}
/*
===============
CL_AllocDlight
===============
*/
cdlight_t *CL_AllocDlight (int key)
{
int i;
cdlight_t *dl;
// first look for an exact key match
if (key)
{
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->key == key)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
}
}
// then look for anything else
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->die < cl.time)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
}
dl = &cl_dlights[0];
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
/*
===============
CL_NewDlight
===============
*/
void CL_NewDlight (int key, float x, float y, float z, float radius, float time)
{
cdlight_t *dl;
dl = CL_AllocDlight (key);
dl->origin[0] = x;
dl->origin[1] = y;
dl->origin[2] = z;
dl->radius = radius;
dl->die = cl.time + time;
}
/*
===============
CL_RunDLights
===============
*/
void CL_RunDLights (void)
{
int i;
cdlight_t *dl;
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (!dl->radius)
continue;
if (dl->die < cl.time)
{
dl->radius = 0;
return;
}
dl->radius -= cls.frametime*dl->decay;
if (dl->radius < 0)
dl->radius = 0;
}
}
/*
==============
CL_ParseMuzzleFlash
==============
*/
void CL_ParseMuzzleFlash (void)
{
vec3_t fv, rv;
cdlight_t *dl;
int i, weapon;
centity_t *pl;
int silenced;
float volume;
char soundname[64];
i = MSG_ReadShort (&net_message);
if (i < 1 || i >= MAX_EDICTS)
Com_Error (ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
weapon = MSG_ReadByte (&net_message);
silenced = weapon & MZ_SILENCED;
weapon &= ~MZ_SILENCED;
pl = &cl_entities[i];
dl = CL_AllocDlight (i);
VectorCopy (pl->current.origin, dl->origin);
AngleVectors (pl->current.angles, fv, rv, NULL);
VectorMA (dl->origin, 18, fv, dl->origin);
VectorMA (dl->origin, 16, rv, dl->origin);
if (silenced)
dl->radius = 100 + (rand()&31);
else
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time; // + 0.1;
if (silenced)
volume = 0.2;
else
volume = 1;
switch (weapon)
{
case MZ_BLASTER:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_BLUEHYPERBLASTER:
dl->color[0] = 0;dl->color[1] = 0;dl->color[2] = 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_HYPERBLASTER:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_MACHINEGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
break;
case MZ_SHOTGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1);
break;
case MZ_SSHOTGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0);
break;
case MZ_CHAINGUN1:
dl->radius = 200 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.25;dl->color[2] = 0;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
break;
case MZ_CHAINGUN2:
dl->radius = 225 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05);
break;
case MZ_CHAINGUN3:
dl->radius = 250 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066);
break;
case MZ_RAILGUN:
dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_ROCKET:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1);
break;
case MZ_GRENADE:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1);
break;
case MZ_BFG:
dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__f1y.wav"), volume, ATTN_NORM, 0);
break;
case MZ_LOGIN:
dl->color[0] = 0;dl->color[1] = 1; dl->color[2] = 0;
dl->die = cl.time + 1.0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
CL_LogoutEffect (pl->current.origin, weapon);
break;
case MZ_LOGOUT:
dl->color[0] = 1;dl->color[1] = 0; dl->color[2] = 0;
dl->die = cl.time + 1.0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
CL_LogoutEffect (pl->current.origin, weapon);
break;
case MZ_RESPAWN:
dl->color[0] = 1;dl->color[1] = 1; dl->color[2] = 0;
dl->die = cl.time + 1.0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
CL_LogoutEffect (pl->current.origin, weapon);
break;
// RAFAEL
case MZ_PHALANX:
dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0);
break;
// RAFAEL
case MZ_IONRIPPER:
dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0);
break;
// ======================
// PGM
case MZ_ETF_RIFLE:
dl->color[0] = 0.9;dl->color[1] = 0.7;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0);
break;
case MZ_SHOTGUN2:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotg2.wav"), volume, ATTN_NORM, 0);
break;
case MZ_HEATBEAM:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 100;
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_BLASTER2:
dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0;
// FIXME - different sound for blaster2 ??
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_TRACKER:
// negative flashes handled the same in gl/soft until CL_AddDLights
dl->color[0] = -1;dl->color[1] = -1;dl->color[2] = -1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), volume, ATTN_NORM, 0);
break;
case MZ_NUKE1:
dl->color[0] = 1;dl->color[1] = 0;dl->color[2] = 0;
dl->die = cl.time + 100;
break;
case MZ_NUKE2:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 100;
break;
case MZ_NUKE4:
dl->color[0] = 0;dl->color[1] = 0;dl->color[2] = 1;
dl->die = cl.time + 100;
break;
case MZ_NUKE8:
dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 1;
dl->die = cl.time + 100;
break;
// PGM
// ======================
}
}
/*
==============
CL_ParseMuzzleFlash2
==============
*/
void CL_ParseMuzzleFlash2 (void)
{
int ent;
vec3_t origin;
int flash_number;
cdlight_t *dl;
vec3_t forward, right;
char soundname[64];
ent = MSG_ReadShort (&net_message);
if (ent < 1 || ent >= MAX_EDICTS)
Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
flash_number = MSG_ReadByte (&net_message);
// locate the origin
AngleVectors (cl_entities[ent].current.angles, forward, right, NULL);
origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1];
origin[1] = cl_entities[ent].current.origin[1] + forward[1] * monster_flash_offset[flash_number][0] + right[1] * monster_flash_offset[flash_number][1];
origin[2] = cl_entities[ent].current.origin[2] + forward[2] * monster_flash_offset[flash_number][0] + right[2] * monster_flash_offset[flash_number][1] + monster_flash_offset[flash_number][2];
dl = CL_AllocDlight (ent);
VectorCopy (origin, dl->origin);
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time; // + 0.1;
switch (flash_number)
{
case MZ2_INFANTRY_MACHINEGUN_1:
case MZ2_INFANTRY_MACHINEGUN_2:
case MZ2_INFANTRY_MACHINEGUN_3:
case MZ2_INFANTRY_MACHINEGUN_4:
case MZ2_INFANTRY_MACHINEGUN_5:
case MZ2_INFANTRY_MACHINEGUN_6:
case MZ2_INFANTRY_MACHINEGUN_7:
case MZ2_INFANTRY_MACHINEGUN_8:
case MZ2_INFANTRY_MACHINEGUN_9:
case MZ2_INFANTRY_MACHINEGUN_10:
case MZ2_INFANTRY_MACHINEGUN_11:
case MZ2_INFANTRY_MACHINEGUN_12:
case MZ2_INFANTRY_MACHINEGUN_13:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_SOLDIER_MACHINEGUN_1:
case MZ2_SOLDIER_MACHINEGUN_2:
case MZ2_SOLDIER_MACHINEGUN_3:
case MZ2_SOLDIER_MACHINEGUN_4:
case MZ2_SOLDIER_MACHINEGUN_5:
case MZ2_SOLDIER_MACHINEGUN_6:
case MZ2_SOLDIER_MACHINEGUN_7:
case MZ2_SOLDIER_MACHINEGUN_8:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_GUNNER_MACHINEGUN_1:
case MZ2_GUNNER_MACHINEGUN_2:
case MZ2_GUNNER_MACHINEGUN_3:
case MZ2_GUNNER_MACHINEGUN_4:
case MZ2_GUNNER_MACHINEGUN_5:
case MZ2_GUNNER_MACHINEGUN_6:
case MZ2_GUNNER_MACHINEGUN_7:
case MZ2_GUNNER_MACHINEGUN_8:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_ACTOR_MACHINEGUN_1:
case MZ2_SUPERTANK_MACHINEGUN_1:
case MZ2_SUPERTANK_MACHINEGUN_2:
case MZ2_SUPERTANK_MACHINEGUN_3:
case MZ2_SUPERTANK_MACHINEGUN_4:
case MZ2_SUPERTANK_MACHINEGUN_5:
case MZ2_SUPERTANK_MACHINEGUN_6:
case MZ2_TURRET_MACHINEGUN: // PGM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_BOSS2_MACHINEGUN_L1:
case MZ2_BOSS2_MACHINEGUN_L2:
case MZ2_BOSS2_MACHINEGUN_L3:
case MZ2_BOSS2_MACHINEGUN_L4:
case MZ2_BOSS2_MACHINEGUN_L5:
case MZ2_CARRIER_MACHINEGUN_L1: // PMM
case MZ2_CARRIER_MACHINEGUN_L2: // PMM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0);
break;
case MZ2_SOLDIER_BLASTER_1:
case MZ2_SOLDIER_BLASTER_2:
case MZ2_SOLDIER_BLASTER_3:
case MZ2_SOLDIER_BLASTER_4:
case MZ2_SOLDIER_BLASTER_5:
case MZ2_SOLDIER_BLASTER_6:
case MZ2_SOLDIER_BLASTER_7:
case MZ2_SOLDIER_BLASTER_8:
case MZ2_TURRET_BLASTER: // PGM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck2.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_FLYER_BLASTER_1:
case MZ2_FLYER_BLASTER_2:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("flyer/flyatck3.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_MEDIC_BLASTER_1:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("medic/medatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_HOVER_BLASTER_1:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("hover/hovatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_FLOAT_BLASTER_1:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("floater/fltatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_SOLDIER_SHOTGUN_1:
case MZ2_SOLDIER_SHOTGUN_2:
case MZ2_SOLDIER_SHOTGUN_3:
case MZ2_SOLDIER_SHOTGUN_4:
case MZ2_SOLDIER_SHOTGUN_5:
case MZ2_SOLDIER_SHOTGUN_6:
case MZ2_SOLDIER_SHOTGUN_7:
case MZ2_SOLDIER_SHOTGUN_8:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_TANK_BLASTER_1:
case MZ2_TANK_BLASTER_2:
case MZ2_TANK_BLASTER_3:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_TANK_MACHINEGUN_1:
case MZ2_TANK_MACHINEGUN_2:
case MZ2_TANK_MACHINEGUN_3:
case MZ2_TANK_MACHINEGUN_4:
case MZ2_TANK_MACHINEGUN_5:
case MZ2_TANK_MACHINEGUN_6:
case MZ2_TANK_MACHINEGUN_7:
case MZ2_TANK_MACHINEGUN_8:
case MZ2_TANK_MACHINEGUN_9:
case MZ2_TANK_MACHINEGUN_10:
case MZ2_TANK_MACHINEGUN_11:
case MZ2_TANK_MACHINEGUN_12:
case MZ2_TANK_MACHINEGUN_13:
case MZ2_TANK_MACHINEGUN_14:
case MZ2_TANK_MACHINEGUN_15:
case MZ2_TANK_MACHINEGUN_16:
case MZ2_TANK_MACHINEGUN_17:
case MZ2_TANK_MACHINEGUN_18:
case MZ2_TANK_MACHINEGUN_19:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0);
break;
case MZ2_CHICK_ROCKET_1:
case MZ2_TURRET_ROCKET: // PGM
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_TANK_ROCKET_1:
case MZ2_TANK_ROCKET_2:
case MZ2_TANK_ROCKET_3:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_SUPERTANK_ROCKET_1:
case MZ2_SUPERTANK_ROCKET_2:
case MZ2_SUPERTANK_ROCKET_3:
case MZ2_BOSS2_ROCKET_1:
case MZ2_BOSS2_ROCKET_2:
case MZ2_BOSS2_ROCKET_3:
case MZ2_BOSS2_ROCKET_4:
case MZ2_CARRIER_ROCKET_1:
// case MZ2_CARRIER_ROCKET_2:
// case MZ2_CARRIER_ROCKET_3:
// case MZ2_CARRIER_ROCKET_4:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_GUNNER_GRENADE_1:
case MZ2_GUNNER_GRENADE_2:
case MZ2_GUNNER_GRENADE_3:
case MZ2_GUNNER_GRENADE_4:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_GLADIATOR_RAILGUN_1:
// PMM
case MZ2_CARRIER_RAILGUN:
case MZ2_WIDOW_RAIL:
// pmm
dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0;
break;
// --- Xian's shit starts ---
case MZ2_MAKRON_BFG:
dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5;
//S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/bfg_fire.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_MAKRON_BLASTER_1:
case MZ2_MAKRON_BLASTER_2:
case MZ2_MAKRON_BLASTER_3:
case MZ2_MAKRON_BLASTER_4:
case MZ2_MAKRON_BLASTER_5:
case MZ2_MAKRON_BLASTER_6:
case MZ2_MAKRON_BLASTER_7:
case MZ2_MAKRON_BLASTER_8:
case MZ2_MAKRON_BLASTER_9:
case MZ2_MAKRON_BLASTER_10:
case MZ2_MAKRON_BLASTER_11:
case MZ2_MAKRON_BLASTER_12:
case MZ2_MAKRON_BLASTER_13:
case MZ2_MAKRON_BLASTER_14:
case MZ2_MAKRON_BLASTER_15:
case MZ2_MAKRON_BLASTER_16:
case MZ2_MAKRON_BLASTER_17:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/blaster.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_JORG_MACHINEGUN_L1:
case MZ2_JORG_MACHINEGUN_L2:
case MZ2_JORG_MACHINEGUN_L3:
case MZ2_JORG_MACHINEGUN_L4:
case MZ2_JORG_MACHINEGUN_L5:
case MZ2_JORG_MACHINEGUN_L6:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_JORG_MACHINEGUN_R1:
case MZ2_JORG_MACHINEGUN_R2:
case MZ2_JORG_MACHINEGUN_R3:
case MZ2_JORG_MACHINEGUN_R4:
case MZ2_JORG_MACHINEGUN_R5:
case MZ2_JORG_MACHINEGUN_R6:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
break;
case MZ2_JORG_BFG_1:
dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5;
break;
case MZ2_BOSS2_MACHINEGUN_R1:
case MZ2_BOSS2_MACHINEGUN_R2:
case MZ2_BOSS2_MACHINEGUN_R3:
case MZ2_BOSS2_MACHINEGUN_R4:
case MZ2_BOSS2_MACHINEGUN_R5:
case MZ2_CARRIER_MACHINEGUN_R1: // PMM
case MZ2_CARRIER_MACHINEGUN_R2: // PMM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
break;
// ======
// ROGUE
case MZ2_STALKER_BLASTER:
case MZ2_DAEDALUS_BLASTER:
case MZ2_MEDIC_BLASTER_2:
case MZ2_WIDOW_BLASTER:
case MZ2_WIDOW_BLASTER_SWEEP1:
case MZ2_WIDOW_BLASTER_SWEEP2:
case MZ2_WIDOW_BLASTER_SWEEP3:
case MZ2_WIDOW_BLASTER_SWEEP4:
case MZ2_WIDOW_BLASTER_SWEEP5:
case MZ2_WIDOW_BLASTER_SWEEP6:
case MZ2_WIDOW_BLASTER_SWEEP7:
case MZ2_WIDOW_BLASTER_SWEEP8:
case MZ2_WIDOW_BLASTER_SWEEP9:
case MZ2_WIDOW_BLASTER_100:
case MZ2_WIDOW_BLASTER_90:
case MZ2_WIDOW_BLASTER_80:
case MZ2_WIDOW_BLASTER_70:
case MZ2_WIDOW_BLASTER_60:
case MZ2_WIDOW_BLASTER_50:
case MZ2_WIDOW_BLASTER_40:
case MZ2_WIDOW_BLASTER_30:
case MZ2_WIDOW_BLASTER_20:
case MZ2_WIDOW_BLASTER_10:
case MZ2_WIDOW_BLASTER_0:
case MZ2_WIDOW_BLASTER_10L:
case MZ2_WIDOW_BLASTER_20L:
case MZ2_WIDOW_BLASTER_30L:
case MZ2_WIDOW_BLASTER_40L:
case MZ2_WIDOW_BLASTER_50L:
case MZ2_WIDOW_BLASTER_60L:
case MZ2_WIDOW_BLASTER_70L:
case MZ2_WIDOW_RUN_1:
case MZ2_WIDOW_RUN_2:
case MZ2_WIDOW_RUN_3:
case MZ2_WIDOW_RUN_4:
case MZ2_WIDOW_RUN_5:
case MZ2_WIDOW_RUN_6:
case MZ2_WIDOW_RUN_7:
case MZ2_WIDOW_RUN_8:
dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_WIDOW_DISRUPTOR:
dl->color[0] = -1;dl->color[1] = -1;dl->color[2] = -1;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_WIDOW_PLASMABEAM:
case MZ2_WIDOW2_BEAMER_1:
case MZ2_WIDOW2_BEAMER_2:
case MZ2_WIDOW2_BEAMER_3:
case MZ2_WIDOW2_BEAMER_4:
case MZ2_WIDOW2_BEAMER_5:
case MZ2_WIDOW2_BEAM_SWEEP_1:
case MZ2_WIDOW2_BEAM_SWEEP_2:
case MZ2_WIDOW2_BEAM_SWEEP_3:
case MZ2_WIDOW2_BEAM_SWEEP_4:
case MZ2_WIDOW2_BEAM_SWEEP_5:
case MZ2_WIDOW2_BEAM_SWEEP_6:
case MZ2_WIDOW2_BEAM_SWEEP_7:
case MZ2_WIDOW2_BEAM_SWEEP_8:
case MZ2_WIDOW2_BEAM_SWEEP_9:
case MZ2_WIDOW2_BEAM_SWEEP_10:
case MZ2_WIDOW2_BEAM_SWEEP_11:
dl->radius = 300 + (rand()&100);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 200;
break;
// ROGUE
// ======
// --- Xian's shit ends ---
}
}
/*
===============
CL_AddDLights
===============
*/
void CL_AddDLights (void)
{
int i;
cdlight_t *dl;
dl = cl_dlights;
//=====
//PGM
if(vidref_val == VIDREF_GL)
{
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (!dl->radius)
continue;
V_AddLight (dl->origin, dl->radius,
dl->color[0], dl->color[1], dl->color[2]);
}
}
else
{
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (!dl->radius)
continue;
// negative light in software. only black allowed
if ((dl->color[0] < 0) || (dl->color[1] < 0) || (dl->color[2] < 0))
{
dl->radius = -(dl->radius);
dl->color[0] = 1;
dl->color[1] = 1;
dl->color[2] = 1;
}
V_AddLight (dl->origin, dl->radius,
dl->color[0], dl->color[1], dl->color[2]);
}
}
//PGM
//=====
}
/*
==============================================================
PARTICLE MANAGEMENT
==============================================================
*/
/*
// THIS HAS BEEN RELOCATED TO CLIENT.H
typedef struct particle_s
{
struct particle_s *next;
float time;
vec3_t org;
vec3_t vel;
vec3_t accel;
float color;
float colorvel;
float alpha;
float alphavel;
} cparticle_t;
#define PARTICLE_GRAVITY 40
*/
cparticle_t *active_particles, *free_particles;
cparticle_t particles[MAX_PARTICLES];
int cl_numparticles = MAX_PARTICLES;
/*
===============
CL_ClearParticles
===============
*/
void CL_ClearParticles (void)
{
int i;
free_particles = &particles[0];
active_particles = NULL;
for (i=0 ;i<cl_numparticles ; i++)
particles[i].next = &particles[i+1];
particles[cl_numparticles-1].next = NULL;
}
/*
===============
CL_ParticleEffect
Wall impact puffs
===============
*/
void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count)
{
int i, j;
cparticle_t *p;
float d;
for (i=0 ; i<count ; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->time = cl.time;
p->color = color + (rand()&7);
d = rand()&31;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
p->vel[j] = crand()*20;
}
p->accel[0] = p->accel[1] = 0;
p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3);
}
}
/*
===============
CL_ParticleEffect2
===============
*/
void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count)
{
int i, j;
cparticle_t *p;
float d;
for (i=0 ; i<count ; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->time = cl.time;
p->color = color;
d = rand()&7;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
p->vel[j] = crand()*20;
}
p->accel[0] = p->accel[1] = 0;
p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3);
}
}
// RAFAEL
/*
===============
CL_ParticleEffect3
===============
*/
void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count)
{
int i, j;
cparticle_t *p;
float d;