-
Notifications
You must be signed in to change notification settings - Fork 10
/
cl_tempent.c
2034 lines (1826 loc) · 52.5 KB
/
cl_tempent.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_tent.c -- client side temporary entities
#include "client.h"
#include "particles.h"
void CL_LightningBeam(vec3_t start, vec3_t end, int srcEnt, int dstEnt, float size);
typedef enum
{
ex_free, ex_explosion, ex_misc, ex_flash, ex_mflash, ex_poly, ex_poly2
} exptype_t;
typedef struct
{
exptype_t type;
entity_t ent;
int frames;
float light;
vec3_t lightcolor;
float start;
int baseframe;
} explosion_t;
#define MAX_EXPLOSIONS 512 // was 32
explosion_t cl_explosions[MAX_EXPLOSIONS];
#define MAX_BEAMS 512 // was 32
typedef struct
{
int entity;
int dest_entity;
struct model_s *model;
int endtime;
vec3_t offset;
vec3_t start, end;
} beam_t;
beam_t cl_beams[MAX_BEAMS];
//PMM - added this for player-linked beams. Currently only used by the plasma beam
beam_t cl_playerbeams[MAX_BEAMS];
#define MAX_LASERS 512 // was 32
typedef struct
{
entity_t ent;
int endtime;
} laser_t;
laser_t cl_lasers[MAX_LASERS];
//ROGUE
cl_sustain_t cl_sustains[MAX_SUSTAINS];
//ROGUE
//PGM
extern void CL_TeleportParticles (vec3_t org);
//PGM
// Psychospaz's enhanced particle code
void CL_Explosion_Particle (vec3_t org, float scale, qboolean rocket);
void CL_Explosion_FlashParticle (vec3_t org, float size, qboolean large);
void CL_BloodHit (vec3_t org, vec3_t dir);
void CL_GreenBloodHit (vec3_t org, vec3_t dir);
void CL_ParticleEffectSparks (vec3_t org, vec3_t dir, vec3_t color, int count);
void CL_ParticleBulletDecal(vec3_t org, vec3_t dir, float size);
void CL_ParticlePlasmaBeamDecal(vec3_t org, vec3_t dir, float size);
void CL_ParticleBlasterDecal (vec3_t org, vec3_t dir, float size, int red, int green, int blue);
void CL_Explosion_Decal (vec3_t org, float size, int decalnum);
void CL_Explosion_Sparks (vec3_t org, int size, int count);
void CL_BFGExplosionParticles (vec3_t org);
clientMedia_t clMedia;
void ReadTextureSurfaceAssignments();
/*
=================
CL_RegisterTEntSounds
=================
*/
void CL_RegisterTEntSounds (void)
{
int i;
char name[MAX_QPATH];
clMedia.sfx_ric[0] = S_RegisterSound ("world/ric1.wav");
clMedia.sfx_ric[1] = S_RegisterSound ("world/ric2.wav");
clMedia.sfx_ric[2] = S_RegisterSound ("world/ric3.wav");
clMedia.sfx_lashit = S_RegisterSound("weapons/lashit.wav");
clMedia.sfx_spark[0] = S_RegisterSound ("world/spark5.wav");
clMedia.sfx_spark[1] = S_RegisterSound ("world/spark6.wav");
clMedia.sfx_spark[2] = S_RegisterSound ("world/spark7.wav");
clMedia.sfx_railg = S_RegisterSound ("weapons/railgf1a.wav");
clMedia.sfx_rockexp = S_RegisterSound ("weapons/rocklx1a.wav");
clMedia.sfx_grenexp = S_RegisterSound ("weapons/grenlx1a.wav");
clMedia.sfx_watrexp = S_RegisterSound ("weapons/xpld_wat.wav");
// Xatrix
clMedia.sfx_plasexp = S_RegisterSound ("weapons/plasexpl.wav");
// Rogue
clMedia.sfx_lightning = S_RegisterSound ("weapons/tesla.wav");
clMedia.sfx_disrexp = S_RegisterSound ("weapons/disrupthit.wav");
// shockwave impact
clMedia.sfx_shockhit = S_RegisterSound ("weapons/shockhit.wav");
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/step%i.wav", i+1);
clMedia.sfx_footsteps[i] = S_RegisterSound (name);
}
// Lazarus footstep sounds
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_metal%i.wav", i+1);
clMedia.sfx_metal_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_dirt%i.wav", i+1);
clMedia.sfx_dirt_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_duct%i.wav", i+1);
clMedia.sfx_vent_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_grate%i.wav", i+1);
clMedia.sfx_grate_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_tile%i.wav", i+1);
clMedia.sfx_tile_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_grass%i.wav", i+1);
clMedia.sfx_grass_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_snow%i.wav", i+1);
clMedia.sfx_snow_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_carpet%i.wav", i+1);
clMedia.sfx_carpet_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_force%i.wav", i+1);
clMedia.sfx_force_footsteps[i] = S_RegisterSound (name);
}
for (i=0 ; i<4 ; i++) {
Com_sprintf (name, sizeof(name), "player/pl_gravel%i.wav", i+1);
clMedia.sfx_gravel_footsteps[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_ice%i.wav", i+1);
clMedia.sfx_ice_footsteps[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_sand%i.wav", i+1);
clMedia.sfx_sand_footsteps[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_wood%i.wav", i+1);
clMedia.sfx_wood_footsteps[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_slosh%i.wav", i+1);
clMedia.sfx_slosh[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_wade%i.wav", i+1);
clMedia.sfx_wade[i] = S_RegisterSound (name);
}
for (i=0; i<2; i++) {
Com_sprintf (name, sizeof(name), "mud/wade_mud%i.wav", i+1);
clMedia.sfx_mud_wade[i] = S_RegisterSound (name);
}
for (i=0; i<4; i++) {
Com_sprintf (name, sizeof(name), "player/pl_ladder%i.wav", i+1);
clMedia.sfx_ladder[i] = S_RegisterSound (name);
}
// read footstep defintion file
if (cl_footstep_override->value)
ReadTextureSurfaceAssignments();
// end Lazarus footstep sounds
S_RegisterSound ("player/land1.wav");
S_RegisterSound ("player/fall2.wav");
S_RegisterSound ("player/fall1.wav");
}
/*
=================
CL_RegisterTEntModels
=================
*/
void CL_RegisterTEntModels (void)
{
clMedia.mod_explode = R_RegisterModel ("models/objects/explode/tris.md2");
clMedia.mod_smoke = R_RegisterModel ("models/objects/smoke/tris.md2");
clMedia.mod_flash = R_RegisterModel ("models/objects/flash/tris.md2");
clMedia.mod_parasite_segment = R_RegisterModel ("models/monsters/parasite/segment/tris.md2");
clMedia.mod_grapple_cable = R_RegisterModel ("models/ctf/segment/tris.md2");
clMedia.mod_parasite_tip = R_RegisterModel ("models/monsters/parasite/tip/tris.md2");
clMedia.mod_explo = R_RegisterModel ("models/objects/r_explode/tris.md2");
clMedia.mod_bfg_explo = R_RegisterModel ("sprites/s_bfg2.sp2");
clMedia.mod_powerscreen = R_RegisterModel ("models/items/armor/effect/tris.md2");
// Rogue
clMedia.mod_explo_big = R_RegisterModel ("models/objects/r_explode2/tris.md2");
clMedia.mod_lightning = R_RegisterModel ("models/proj/lightning/tris.md2");
clMedia.mod_heatbeam = R_RegisterModel ("models/proj/beam/tris.md2");
clMedia.mod_monster_heatbeam = R_RegisterModel ("models/proj/widowbeam/tris.md2");
// new effect models
clMedia.mod_shocksplash = R_RegisterModel ("models/objects/shocksplash/tris.md2");
R_RegisterModel ("models/objects/laser/tris.md2");
R_RegisterModel ("models/objects/grenade2/tris.md2");
R_RegisterModel ("models/weapons/v_machn/tris.md2");
R_RegisterModel ("models/weapons/v_handgr/tris.md2");
R_RegisterModel ("models/weapons/v_shotg2/tris.md2");
R_RegisterModel ("models/objects/gibs/bone/tris.md2");
R_RegisterModel ("models/objects/gibs/sm_meat/tris.md2");
R_RegisterModel ("models/objects/gibs/bone2/tris.md2");
// Xatrix
// R_RegisterModel ("models/objects/blaser/tris.md2");
R_DrawFindPic ("w_machinegun");
R_DrawFindPic ("a_bullets");
R_DrawFindPic ("i_health");
R_DrawFindPic ("a_grenades");
}
/*
=================
CL_ClearTEnts
=================
*/
void CL_ClearTEnts (void)
{
memset (cl_beams, 0, sizeof(cl_beams));
memset (cl_explosions, 0, sizeof(cl_explosions));
memset (cl_lasers, 0, sizeof(cl_lasers));
//ROGUE
memset (cl_playerbeams, 0, sizeof(cl_playerbeams));
memset (cl_sustains, 0, sizeof(cl_sustains));
//ROGUE
}
/*
=================
CL_AllocExplosion
=================
*/
explosion_t *CL_AllocExplosion (void)
{
int i;
int time;
int index;
for (i=0; i<MAX_EXPLOSIONS; i++)
{
if (cl_explosions[i].type == ex_free)
{
memset (&cl_explosions[i], 0, sizeof (cl_explosions[i]));
return &cl_explosions[i];
}
}
// find the oldest explosion
time = cl.time;
index = 0;
for (i=0; i<MAX_EXPLOSIONS; i++)
if (cl_explosions[i].start < time)
{
time = cl_explosions[i].start;
index = i;
}
memset (&cl_explosions[index], 0, sizeof (cl_explosions[index]));
return &cl_explosions[index];
}
void CL_Explosion_Flash (vec3_t origin, int dist, int size, qboolean plasma)
{
int i,j,k;
int limit = (plasma)?1:2;
vec3_t org;
if (cl_particle_scale->value > 1 || plasma)
{
for (i=0; i<limit; i++)
CL_Explosion_FlashParticle(origin, size+2*dist, true);
return;
}
for (i=-1; i<2; i+=2)
for (j=-1; j<2; j+=2)
for (k=-1; k<2; k+=2)
{
org[0]=origin[0]+i*dist;
org[1]=origin[1]+j*dist;
org[2]=origin[2]+k*dist;
CL_Explosion_FlashParticle(org, size, false);
}
}
/*
=================
CL_SmokeAndFlash
=================
*/
void CL_SmokeAndFlash(vec3_t origin)
{
explosion_t *ex;
ex = CL_AllocExplosion ();
VectorCopy (origin, ex->ent.origin);
ex->type = ex_flash;
ex->ent.flags |= RF_FULLBRIGHT;
ex->frames = 2;
ex->start = cl.frame.servertime - 100;
ex->ent.model = clMedia.mod_flash;
}
/*
=================
CL_ParseParticles
=================
*/
void CL_ParseParticles (void)
{
int color, count;
vec3_t pos, dir;
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
color = MSG_ReadByte (&net_message);
count = MSG_ReadByte (&net_message);
CL_ParticleEffect (pos, dir, color, count);
}
/*
=================
CL_ParseBeam
=================
*/
int CL_ParseBeam (struct model_s *model)
{
int ent;
vec3_t start, end;
beam_t *b;
int i;
ent = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
// override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
{
b->entity = ent;
b->model = model;
b->endtime = cl.time + 200;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorClear (b->offset);
return ent;
}
// 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 = model;
b->endtime = cl.time + 200;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorClear (b->offset);
return ent;
}
}
Com_Printf ("beam list overflow!\n");
return ent;
}
/*
=================
CL_ParseBeam2
=================
*/
int CL_ParseBeam2 (struct model_s *model)
{
int ent;
vec3_t start, end, offset;
beam_t *b;
int i;
ent = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
MSG_ReadPos (&net_message, offset);
// Com_Printf ("end- %f %f %f\n", end[0], end[1], end[2]);
// override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
{
b->entity = ent;
b->model = model;
b->endtime = cl.time + 200;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorCopy (offset, b->offset);
return ent;
}
// 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 = model;
b->endtime = cl.time + 200;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorCopy (offset, b->offset);
return ent;
}
}
Com_Printf ("beam list overflow!\n");
return ent;
}
// ROGUE
/*
=================
CL_ParsePlayerBeam
- adds to the cl_playerbeam array instead of the cl_beams array
=================
*/
int CL_ParsePlayerBeam (struct model_s *model)
{
int ent;
vec3_t start, end, offset;
beam_t *b;
int i;
ent = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
// PMM - network optimization
if (model == clMedia.mod_heatbeam)
VectorSet(offset, 2, 7, -3);
else if (model == clMedia.mod_monster_heatbeam)
{
model = clMedia.mod_heatbeam;
VectorSet(offset, 0, 0, 0);
}
else
MSG_ReadPos (&net_message, offset);
// Com_Printf ("end- %f %f %f\n", end[0], end[1], end[2]);
// override any beam with the same entity
// PMM - For player beams, we only want one per player (entity) so..
for (i=0, b=cl_playerbeams; i<MAX_BEAMS; i++, b++)
{
if (b->entity == ent)
{
b->entity = ent;
b->model = model;
b->endtime = cl.time + 200;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorCopy (offset, b->offset);
return ent;
}
}
// find a free beam
for (i=0, b=cl_playerbeams; i<MAX_BEAMS; i++, b++)
{
if (!b->model || b->endtime < cl.time)
{
b->entity = ent;
b->model = model;
b->endtime = cl.time + 100; // PMM - this needs to be 100 to prevent multiple heatbeams
VectorCopy (start, b->start);
VectorCopy (end, b->end);
VectorCopy (offset, b->offset);
return ent;
}
}
Com_Printf ("beam list overflow!\n");
return ent;
}
//rogue
/*
=================
CL_ParseLightning
=================
*/
// Psychspaz's enhanced particles
int CL_ParseLightning ()
{
vec3_t start,end; // ,move,vec;
int srcEnt, dstEnt; // , len, dec;
srcEnt = MSG_ReadShort (&net_message);
dstEnt = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
CL_LightningBeam(start, end, srcEnt, dstEnt, 5);
return srcEnt;
}
/*
=================
CL_ParseLaser
=================
*/
// Psychspaz's enhanced particles
void CL_ParseLaser (int colors)
{
vec3_t start,end;
vec3_t move;
vec3_t vec;
vec3_t point;
float len;
float dec;
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
VectorSubtract (end, start, vec);
len = VectorNormalize (vec);
VectorCopy (vec, point);
dec = 20;
VectorScale (vec, dec, vec);
VectorCopy (start, move);
while (len > 0)
{
len -= dec;
CL_SetupParticle (
point[0], point[1], point[2],
move[0], move[1], move[2],
0, 0, 0,
0, 0, 0,
50, 255, 50,
0, 0, 0,
1, -2.5,
GL_SRC_ALPHA, GL_ONE,
dec*TWOTHIRDS, 0,
particle_beam,
PART_DIRECTION,
NULL,0);
VectorAdd (move, vec, move);
}
}
//=============
//ROGUE
void CL_ParseSteam (void)
{
vec3_t pos, dir;
int id, i;
int r;
int cnt;
int color;
int magnitude;
cl_sustain_t *s, *free_sustain;
id = MSG_ReadShort (&net_message); // an id of -1 is an instant effect
if (id != -1) // sustains
{
//Com_Printf ("Sustain effect id %d\n", id);
free_sustain = NULL;
for (i=0, s=cl_sustains; i<MAX_SUSTAINS; i++, s++)
{
if (s->id == 0)
{
free_sustain = s;
break;
}
}
if (free_sustain)
{
s->id = id;
s->count = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, s->org);
MSG_ReadDir (&net_message, s->dir);
r = MSG_ReadByte (&net_message);
s->color = r & 0xff;
s->magnitude = MSG_ReadShort (&net_message);
s->endtime = cl.time + MSG_ReadLong (&net_message);
s->think = CL_ParticleSteamEffect2;
s->thinkinterval = 100;
s->nextthink = cl.time;
}
else
{
//Com_Printf ("No free sustains!\n");
// FIXME - read the stuff anyway
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
r = MSG_ReadByte (&net_message);
magnitude = MSG_ReadShort (&net_message);
magnitude = MSG_ReadLong (&net_message); // really interval
}
}
else // instant
{
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
r = MSG_ReadByte (&net_message);
magnitude = MSG_ReadShort (&net_message);
color = r & 0xff;
CL_ParticleSteamEffect (pos, dir,
color8red(color), color8green(color), color8blue(color),
-20, -20, -20, cnt, magnitude);
//CL_ParticleSteamEffect (pos, dir, 240, 240, 240, -20, -20, -20, cnt, magnitude);
//S_StartSound (pos, 0, 0, clMedia.sfx_lashit, 1, ATTN_NORM, 0);
}
}
void CL_ParseWidow (void)
{
vec3_t pos;
int id, i;
cl_sustain_t *s, *free_sustain;
id = MSG_ReadShort (&net_message);
free_sustain = NULL;
for (i=0, s=cl_sustains; i<MAX_SUSTAINS; i++, s++)
{
if (s->id == 0)
{
free_sustain = s;
break;
}
}
if (free_sustain)
{
s->id = id;
MSG_ReadPos (&net_message, s->org);
s->endtime = cl.time + 2100;
s->think = CL_Widowbeamout;
s->thinkinterval = 1;
s->nextthink = cl.time;
}
else // no free sustains
{
// FIXME - read the stuff anyway
MSG_ReadPos (&net_message, pos);
}
}
void CL_ParseNuke (void)
{
vec3_t pos;
int i;
cl_sustain_t *s, *free_sustain;
free_sustain = NULL;
for (i=0, s=cl_sustains; i<MAX_SUSTAINS; i++, s++)
{
if (s->id == 0)
{
free_sustain = s;
break;
}
}
if (free_sustain)
{
s->id = 21000;
MSG_ReadPos (&net_message, s->org);
s->endtime = cl.time + 1000;
s->think = CL_Nukeblast;
s->thinkinterval = 1;
s->nextthink = cl.time;
}
else // no free sustains
{
// FIXME - read the stuff anyway
MSG_ReadPos (&net_message, pos);
}
}
//ROGUE
//=============
// Psychospaz's enhanced particle code
void CL_GunSmokeEffect (vec3_t org, vec3_t dir)
{
vec3_t velocity, origin;
int j;
for (j=0 ; j<3 ; j++)
{
origin[j] = org[j] + dir[j]*10;
velocity[j] = 10*dir[j];
}
velocity[2] = 10;
CL_ParticleSmokeEffect (origin, velocity, 10);
}
/*
=================
CL_ParseTEnt
=================
*/
static byte splash_color[] = {0x00, 0xe0, 0xb0, 0x50, 0xd0, 0xe0, 0xe8};
void CL_ParseTEnt (void)
{
int type;
vec3_t pos, pos2, dir;
explosion_t *ex;
int cnt;
int color;
int r, i;
int ent;
int magnitude;
type = MSG_ReadByte (&net_message);
switch (type)
{
case TE_BLOOD: // bullet hitting flesh
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
// Psychospaz's enhanced particle code
CL_BloodHit (pos, dir);
break;
case TE_GUNSHOT: // bullet hitting wall
case TE_SPARKS:
case TE_BULLET_SPARKS:
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
// Psychospaz's enhanced particle code
if (type == TE_BULLET_SPARKS)
VectorScale(dir, 2, dir);
{
vec3_t color = { 255, 125, 10 };
CL_ParticleEffectSparks (pos, dir, color, (type == TE_GUNSHOT)? 5 : 10);
}
if (type != TE_SPARKS)
{
CL_GunSmokeEffect (pos, dir);
if (type == TE_GUNSHOT || type == TE_BULLET_SPARKS)
CL_ParticleBulletDecal(pos, dir, 2.5);
// impact sound
cnt = rand()&15;
if (cnt == 1)
S_StartSound (pos, 0, 0, clMedia.sfx_ric[0], 1, ATTN_NORM, 0);
else if (cnt == 2)
S_StartSound (pos, 0, 0, clMedia.sfx_ric[1], 1, ATTN_NORM, 0);
else if (cnt == 3)
S_StartSound (pos, 0, 0, clMedia.sfx_ric[2], 1, ATTN_NORM, 0);
}
break;
case TE_SHOTGUN: // bullet hitting wall
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
// Psychospaz's enhanced particle code
CL_GunSmokeEffect (pos, dir);
CL_ParticleBulletDecal(pos, dir, 2.8);
{
vec3_t color = { 200, 100, 10 };
CL_ParticleEffectSparks (pos, dir, color, 8);
}
break;
case TE_SCREEN_SPARKS:
case TE_SHIELD_SPARKS:
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
if (type == TE_SCREEN_SPARKS)
CL_ParticleEffect (pos, dir, 0xd0, 40);
else
CL_ParticleEffect (pos, dir, 0xb0, 40);
//FIXME : replace or remove this sound
S_StartSound (pos, 0, 0, clMedia.sfx_lashit, 1, ATTN_NORM, 0);
break;
case TE_SPLASH: // bullet hitting water
cnt = MSG_ReadByte (&net_message);
cnt = min(cnt, 40); // cap at 40
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
r = MSG_ReadByte (&net_message);
if (r > 6)
color = 0x00;
else
color = splash_color[r];
// Psychospaz's enhanced particle code
CL_ParticleEffectSplash (pos, dir, color, cnt);
if (r == SPLASH_SPARKS)
{
r = rand() & 3;
if (r == 0)
S_StartSound (pos, 0, 0, clMedia.sfx_spark[0], 1, ATTN_STATIC, 0);
else if (r == 1)
S_StartSound (pos, 0, 0, clMedia.sfx_spark[1], 1, ATTN_STATIC, 0);
else
S_StartSound (pos, 0, 0, clMedia.sfx_spark[2], 1, ATTN_STATIC, 0);
}
break;
case TE_LASER_SPARKS:
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadDir (&net_message, dir);
color = MSG_ReadByte (&net_message);
CL_ParticleEffect2 (pos, dir, color, cnt);
break;
case TE_RAILTRAIL: // railgun effect
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, pos2);
CL_RailTrail (pos, pos2, false);
S_StartSound (pos2, 0, 0, clMedia.sfx_railg, 1, ATTN_NORM, 0);
break;
// 12/23/2001 - red railgun trail
case TE_RAILTRAIL2: // red railgun effect
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, pos2);
CL_RailTrail (pos, pos2, true);
S_StartSound (pos2, 0, 0, clMedia.sfx_railg, 1, ATTN_NORM, 0);
break;
case TE_EXPLOSION2:
case TE_GRENADE_EXPLOSION:
case TE_GRENADE_EXPLOSION_WATER:
MSG_ReadPos (&net_message, pos);
if (cl_old_explosions->value)
{
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
ex->ent.flags = RF_FULLBRIGHT|RF_NOSHADOW; // noshadow flag
ex->start = cl.frame.servertime - 100;
ex->light = 350;
ex->lightcolor[0] = 1.0;
ex->lightcolor[1] = 0.5;
ex->lightcolor[2] = 0.5;
ex->ent.model = clMedia.mod_explo;
ex->frames = 19;
ex->baseframe = 30;
ex->ent.angles[1] = rand() % 360;
}
else {
CL_Explosion_Particle (pos, 0, false);
if (type!=TE_GRENADE_EXPLOSION_WATER)
CL_Explosion_Flash (pos, 10, 50, false);
}
CL_Explosion_Sparks (pos, 16, 128);
if (type != TE_EXPLOSION2)
CL_Explosion_Decal (pos, 50, particle_burnmark);
if (type == TE_GRENADE_EXPLOSION_WATER)
S_StartSound (pos, 0, 0, clMedia.sfx_watrexp, 1, ATTN_NORM, 0);
else
S_StartSound (pos, 0, 0, clMedia.sfx_grenexp, 1, ATTN_NORM, 0);
break;
// RAFAEL
case TE_PLASMA_EXPLOSION:
MSG_ReadPos (&net_message, pos);
if (cl_old_explosions->value)
{
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
ex->ent.flags = RF_FULLBRIGHT|RF_NOSHADOW; // noshadow flag
ex->start = cl.frame.servertime - 100;
ex->light = 350;
ex->lightcolor[0] = 1.0;
ex->lightcolor[1] = 0.5;
ex->lightcolor[2] = 0.5;
ex->ent.angles[1] = rand() % 360;
ex->ent.model = clMedia.mod_explo;
if (frand() < 0.5)
ex->baseframe = 15;
ex->frames = 15;
}
else {
CL_Explosion_Particle (pos, 0, true);
CL_Explosion_Flash (pos, 10, 50, true);
}
CL_Explosion_Sparks (pos, 16, 128);
CL_Explosion_Decal (pos, 50, particle_burnmark);
if (cl_plasma_explo_sound->value)
S_StartSound (pos, 0, 0, clMedia.sfx_plasexp, 1, ATTN_NORM, 0);
else
S_StartSound (pos, 0, 0, clMedia.sfx_rockexp, 1, ATTN_NORM, 0);
break;
case TE_EXPLOSION1_BIG: // PMM
MSG_ReadPos (&net_message, pos);
if (cl_old_explosions->value)
{
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
ex->ent.flags = RF_FULLBRIGHT|RF_NOSHADOW; // noshadow flag
ex->start = cl.frame.servertime - 100;
ex->light = 350;
ex->lightcolor[0] = 1.0;
ex->lightcolor[1] = 0.5;
ex->lightcolor[2] = 0.5;
ex->ent.angles[1] = rand() % 360;
ex->ent.model = clMedia.mod_explo_big;
if (frand() < 0.5)
ex->baseframe = 15;
ex->frames = 15;
}
else {
CL_Explosion_Particle (pos, 150, true); // increased size
CL_Explosion_Flash (pos, 30, 150, false);
}
CL_Explosion_Sparks (pos, 48, 128);
S_StartSound (pos, 0, 0, clMedia.sfx_rockexp, 1, ATTN_NORM, 0);
break;
case TE_EXPLOSION1_NP: // PMM
MSG_ReadPos (&net_message, pos);
if (cl_old_explosions->value)
{
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
ex->ent.flags = RF_FULLBRIGHT|RF_NOSHADOW; // noshadow flag
ex->start = cl.frame.servertime - 100;
ex->light = 350;
ex->lightcolor[0] = 1.0;
ex->lightcolor[1] = 0.5;
ex->lightcolor[2] = 0.5;
ex->ent.angles[1] = rand() % 360;
ex->ent.model = clMedia.mod_explo;
if (frand() < 0.5)
ex->baseframe = 15;
ex->frames = 15;
}
else {
CL_Explosion_Particle (pos, 50, true);