forked from EmeraldTiger/Re-Mobilize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.qc
1884 lines (1552 loc) · 52.7 KB
/
misc.qc
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
// these were moved for various reasons -- dumptruck_ds
// /*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
// Used as a positional target for spotlights, etc.
// */
// /void() info_null =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// remove(self);
// };
//
// /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
// Used as a positional target for lightning.
// */
// void() info_notnull =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
// };
//
// //============================================================================
//
// float START_OFF = 1;
//
// void() light_use =
// {
// if (self.spawnflags & START_OFF)
// {
// lightstyle(self.style, "m");
// self.spawnflags = self.spawnflags - START_OFF;
// }
// else
// {
// lightstyle(self.style, "a");
// self.spawnflags = self.spawnflags + START_OFF;
// }
// };
//
// /*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
// Non-displayed light.
// Default light value is 300
// Default style is 0
// If targeted, it will toggle between on or off.
// */
// void() light =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// if (!self.targetname)
// { // inert light
// remove(self);
// return;
// }
//
// if (self.style >= 32)
// {
// self.use = light_use;
// if (self.spawnflags & START_OFF)
// lightstyle(self.style, "a");
// else
// lightstyle(self.style, "m");
// }
// };
//
// /*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
// Non-displayed light.
// Default light value is 300
// Default style is 0
// If targeted, it will toggle between on or off.
// Makes steady fluorescent humming sound
// */
// void() light_fluoro =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// if (self.style >= 32)
// {
// self.use = light_use;
// if (self.spawnflags & START_OFF)
// lightstyle(self.style, "a");
// else
// lightstyle(self.style, "m");
// }
//
// precache_sound ("ambience/fl_hum1.wav");
// ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
// };
//
// /*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
// Non-displayed light.
// Default light value is 300
// Default style is 10
// Makes sparking, broken fluorescent sound
// */
// void() light_fluorospark =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// if (!self.style)
// self.style = 10;
//
// precache_sound ("ambience/buzz1.wav");
// ambientsound (self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
// };
//
// /*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8)
// Sphere globe light.
// Default light value is 300
// Default style is 0
// */
// void() light_globe =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// precache_model ("progs/s_light.spr");
// setmodel (self, "progs/s_light.spr");
// makestatic (self);
// };
//
/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() FireAmbient =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound ("ambience/fire1.wav");
// attenuate fast
ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_fire (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
ambinet fire sound effects added for consistency
same as FireAmbient
*/
void() ambient_fire =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
FireAmbient();
};
//
// /*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
// Short wall torch
// Default light value is 200
// Default style is 0
// */
// void() light_torch_small_walltorch =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// precache_model ("progs/flame.mdl");
// setmodel (self, "progs/flame.mdl");
// FireAmbient ();
// makestatic (self);
// };
//
// /*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
// Large yellow flame ball
// */
// void() light_flame_large_yellow =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// precache_model ("progs/flame2.mdl");
// setmodel (self, "progs/flame2.mdl");
// self.frame = 1;
// FireAmbient ();
// makestatic (self);
// };
//
// /*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
// Small yellow flame ball
// */
// void() light_flame_small_yellow =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// precache_model ("progs/flame2.mdl");
// setmodel (self, "progs/flame2.mdl");
// FireAmbient ();
// makestatic (self);
// };
//
// /*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
// Small white flame ball
// */
// void() light_flame_small_white =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// precache_model ("progs/flame2.mdl");
// setmodel (self, "progs/flame2.mdl");
// FireAmbient ();
// makestatic (self);
// };
//
/*QUAKED light_candle (0 1 0) (-10 -10 -40) (10 10 40) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/candle.mdl"); }
==========
Spawnflags
==========
START_OFF - switchable lights only - light is off by default
FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
==========
Keys
==========
"light" "n"
Set the light intensity. Negative values are also allowed and will cause the entity to subtract light cast by other entities. Default 300.
"wait" "n"
Scale the fade distance of the light by "n". Values of n > 1 make the light fade more quickly with distance, and values < 1 make the light fade more slowly (and thus reach further). Default 1.
"delay" "n"
Select an attenuation formaula for the light:
0 => Linear attenuation (default)
1 => 1/x attenuation
2 => 1/(x^2) attenuation
3 => No attenuation (same brightness at any distance)
4 => "local minlight" - No attenuation and like minlight,
it won't raise the lighting above it's light value.
Unlike minlight, it will only affect surfaces within
line of sight of the entity.
5 => 1/(x^2) attenuation, but slightly more attenuated and
without the extra bright effect that "delay 2" has
near the source.
"_falloff" "n"
Sets the distance at which the light drops to 0, in map units.
In this mode, "wait" is ignored and "light" only controls the brightness at the center of the light, and no longer affects the falloff distance.
Only supported on linear attenuation (delay 0) lights currently.
"_color" "r g b"
Specify red(r), green(g) and blue(b) components for the colour of the light. RGB component values are between 0 and 255 (between 0 and 1 is also accepted). Default is white light ("255 255 255").
"target" "name"
Turns the light into a spotlight, with the direction of light being towards another entity with it�s "targetname" key set to "name".
"mangle" "yaw pitch roll"
Turns the light into a spotlight and specifies the direction of light using yaw, pitch and roll in degrees. Yaw specifies the angle around the Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0). Often easier than the "target" method.
"angle" "n"
Specifies the angle in degrees for a spotlight cone. Default 40.
"_softangle" "n"
Specifies the angle in degrees for an inner spotlight cone (must be less than the "angle" cone. Creates a softer transition between the full brightness of the inner cone to the edge of the outer cone. Default 0 (disabled).
"targetname" "name"
Turns the light into a switchable light, toggled by another entity targeting it�s name.
"speed" "n"
If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
"style" "n"
Set the animated light style. Default 0.
"style2" "n"
Set the animated light style for a switchable light, because style will be overriden if a targetname is set. Default 0.
"_anglescale" "n" | "_anglesense" "n"
Sets a scaling factor for how much influence the angle of incidence of light on a surface has on the brightness of the surface. n must be between 0.0 and 1.0. Smaller values mean less attenuation, with zero meaning that angle of incidence has no effect at all on the brightness. Default 0.5.
"_dirtscale" "n" | "_dirtgain" "n"
Override the global "_dirtscale" or "_dirtgain" settings to change how this light is affected by dirtmapping (ambient occlusion). See descriptions of these keys in the worldspawn section.
"_dirt" "n"
Overrides the worldspawn setting of "_dirt" for this particular light. -1 to disable dirtmapping (ambient occlusion) for this light, making it illuminate the dirtmapping shadows. 1 to enable ambient occlusion for this light. Default is to defer to the worldspawn setting.
"_deviance" "n"
Split up the light into a sphere of randomly positioned lights within radius "n" (in world units). Useful to give shadows a wider penumbra. "_samples" specifies the number of lights in the sphere. The "light" value is automatically scaled down for most lighting formulas (except linear and non-additive minlight) to attempt to keep the brightness equal. Default is 0, do not split up lights.
"_samples" "n"
Number of lights to use for "_deviance". Default 16 (only used if "_deviance" is set).
"_surface" "texturename"
Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above the surfaces.
"_surface_offset" "n"
Controls the offset lights are placed above surfaces for "_surface". Default 2.
"_surface_spotlight" "n"
For a surface light template (i.e. a light with "_surface" set), setting this to "1" makes each instance into a spotlight, with the direction of light pointing along the surface normal. In other words, it automatically sets "mangle" on each of the generated lights.
"_project_texture" "texture"
Specifies that a light should project this texture. The texture must be used in the map somewhere.
"_project_mangle" "yaw pitch roll"
Specifies the yaw/pitch/roll angles for a texture projection (overriding mangle).
"_project_fov" "n"
Specifies the fov angle for a texture projection. Default 90.
"_bouncescale" "n"
Scales the amount of light that is contributed by bounces. Default is 1.0, 0.0 disables bounce lighting for this light.
"_sun" "n"
Set to 1 to make this entity a sun, as an alternative to using the sunlight worldspawn keys. If the light targets an info_null entity, the direction towards that entity sets sun direction. The light itself is disabled, so it can be placed anywhere in the map.
The following light properties correspond to these sunlight settings:
light => _sunlight
mangle => _sunlight_mangle
deviance => _sunlight_penumbra
_color => _sunlight_color
_dirt => _sunlight_dirt
_anglescale => _anglescale
//dumptruck_ds taken from honey (originally from Rogue)
White candle
*/
void() light_candle =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model ("progs/candle.mdl");
setmodel (self, "progs/candle.mdl");
makestatic (self);
};
void() model_candle_think =
{
self.frame = self.frame + 1;
if (self.frame > 3)
self.frame = 0;
self.nextthink = time + 0.1;
};
void() model_candle =
{
precache_model ("progs/candle.mdl");
setmodel (self, "progs/candle.mdl");
self.think = model_candle_think;
self.nextthink = time + 0.1;
};
//============================================================================
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model ("progs/lavaball.mdl"); }
Flying lava balls
speed - set vertical speed of fireballs. default 1000.
*/
void() fire_fly;
void() fire_touch;
void() misc_fireball =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
// 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
// self.nextthink = time + (random() * 5);
self.nextthink = time + 0.1 + (random() * 5);
// 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
self.think = fire_fly;
if (!self.speed)
self.speed = 1000; // fixed typo QIP - dumptruck_ds
};
void() fire_fly =
{
local entity fireball;
fireball = spawn();
fireball.solid = SOLID_TRIGGER;
fireball.movetype = MOVETYPE_TOSS;
fireball.velocity = '0 0 1000';
fireball.velocity_x = (random() * 100) - 50;
fireball.velocity_y = (random() * 100) - 50;
fireball.velocity_z = self.speed + (random() * 200);
fireball.classname = "fireball";
setmodel (fireball, "progs/lavaball.mdl");
setsize (fireball, '0 0 0', '0 0 0');
setorigin (fireball, self.origin);
fireball.nextthink = time + 5;
fireball.think = SUB_Remove;
fireball.touch = fire_touch;
self.nextthink = time + (random() * 5) + 3;
self.think = fire_fly;
};
void() fire_touch =
{
T_Damage (other, self, self, 20);
remove(self);
};
//============================================================================
void() barrel_explode =
{
self.takedamage = DAMAGE_NO;
self.classname = "explo_box";
// did say self.owner
T_RadiusDamage (self, self, 160, world);
sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
particle (self.origin, '0 0 0', 75, 255);
self.origin_z = self.origin_z + 32;
BecomeExplosion ();
SUB_UseTargets();
};
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model("maps/b_explob.bsp");
}
Explosive box
*/
void() misc_explobox =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
local float oldz;
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
if(self.spawnflags & MISC_MODEL_GRAVITY) self.movetype = MOVETYPE_TOSS;
precache_model ("maps/b_explob.bsp");
setmodel (self, "maps/b_explob.bsp");
precache_sound ("weapons/r_exp3.wav");
self.health = 20;
self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM;
self.touch = monster_touch; // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
}
};
/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model("maps/b_exbox2.bsp");
}
Smaller explosive box
*/
void() misc_explobox2 =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
local float oldz;
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
if(self.spawnflags & MISC_MODEL_GRAVITY) self.movetype = MOVETYPE_TOSS;
precache_model2 ("maps/b_exbox2.bsp");
setmodel (self, "maps/b_exbox2.bsp");
precache_sound ("weapons/r_exp3.wav");
self.health = 20;
self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM;
self.touch = monster_touch; // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
}
};
/*==============================================================================
trap_spikeshooter from Hipnotic -- with additions by dumptruck_ds
==============================================================================*/
//MED 11/09/96 added new spawnflags -- taken from hipdefs.qc - dumptruck_ds
float SPAWNFLAG_SUPERSPIKE = 1;
float SPAWNFLAG_LASER = 2;
float SPAWNFLAG_LAVABALL = 4;
float SPAWNFLAG_ROCKET = 8;
float SPAWNFLAG_VOREBALL = 16;
float SPAWNFLAG_GRENADE = 32;
float SPAWNFLAG_GIBS = 64;
float SPAWNFLAG_SILENT = 128;
void() ShalMissileTouch = //moved from Shalrath to enable shooter version
{
if (other == self.owner)
return; // don't explode on owner
if (other.classname == "monster_zombie")
T_Damage (other, self, self, 110);
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
BecomeExplosion ();
// self.velocity = '0 0 0';
// self.touch = SUB_Null;
// setmodel (self, "progs/s_explod.spr");
// self.solid = SOLID_NOT;
// s_explode1 ();
};
void() ZombieGrenadeTouch = //moved from zombie.qc to enable shooter version
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage)
{
T_Damage (other, self, self.owner, 10 );
sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
remove (self);
return;
}
sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
self.velocity = '0 0 0';
self.avelocity = '0 0 0';
self.touch = SUB_Remove;
};
void(vector org, vector vec) LaunchLaser;
//MED 11/09/96 added lava ball and rocket
//dumptruck_ds added voreball and grenades
void() spikeshooter_use =
{
local entity lavaball;
local entity voreball;
local entity rockettrap;
local entity gnade;
local entity zgibs;
if (self.spawnflags & SPAWNFLAG_LASER)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
LaunchLaser (self.origin, self.movedir);
newmis.spawnflags = self.spawnflags;
}
else if (self.spawnflags & SPAWNFLAG_LAVABALL)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "boss1/throw.wav", 1, ATTN_NORM); //dms
// sound (self, CHAN_VOICE, "knight/sword2.wav", 1, ATTN_NORM); //dms
// sound (self, CHAN_VOICE, "weapons/ax1.wav", 1, ATTN_NORM); //dms
lavaball = spawn();
lavaball.movetype = MOVETYPE_FLYMISSILE;
lavaball.solid = SOLID_BBOX;
lavaball.classname = "lavaball";
// set lavaball speed
lavaball.velocity = self.movedir * 600; //was 300 dms
lavaball.angles = vectoangles(lavaball.velocity);
lavaball.owner = self;
lavaball.touch = ShalMissileTouch;
setmodel (lavaball, "progs/lavaball.mdl"); //dms
setsize (lavaball, '0 0 0', '0 0 0');
setorigin (lavaball, self.origin);
lavaball.avelocity = '0 0 400';
lavaball.nextthink = time + 5;
lavaball.think = SUB_Remove;
}
else if (self.spawnflags & SPAWNFLAG_ROCKET)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "weapons/sgun1.wav", 1, ATTN_NORM);
rockettrap = spawn();
rockettrap.movetype = MOVETYPE_FLYMISSILE;
rockettrap.solid = SOLID_BBOX;
rockettrap.classname = "rockettrap";
// set rocket speed
rockettrap.velocity = self.movedir * 1000;
rockettrap.angles = vectoangles(rockettrap.velocity);
rockettrap.owner = self;
rockettrap.touch = T_MissileTouch;
setmodel (rockettrap, "progs/missile.mdl"); //dms
setsize (rockettrap, '0 0 0', '0 0 0');
setorigin (rockettrap, self.origin);
// rockettrap.avelocity = '0 0 400';
rockettrap.nextthink = time + 5;
rockettrap.think = SUB_Remove;
}
else if (self.spawnflags & SPAWNFLAG_VOREBALL)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "shalrath/attack2.wav", 1, ATTN_NORM);
voreball = spawn();
voreball.movetype = MOVETYPE_FLYMISSILE;
voreball.solid = SOLID_BBOX;
voreball.classname = "voreball";
// set voreball speed
voreball.velocity = self.movedir * 600; //was 300 dms
voreball.angles = vectoangles(voreball.velocity);
voreball.owner = self;
voreball.touch = ShalMissileTouch;
setmodel (voreball, "progs/v_spike.mdl"); //dms
setsize (voreball, '0 0 0', '0 0 0');
setorigin (voreball, self.origin);
voreball.avelocity = '0 0 400';
voreball.nextthink = time + 5;
voreball.think = SUB_Remove;
}
else if (self.spawnflags & SPAWNFLAG_GRENADE)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "weapons/grenade.wav", 1, ATTN_NORM);
gnade = spawn();
gnade.movetype = MOVETYPE_BOUNCE;
// gnade.movetype = MOVETYPE_FLYMISSILE;
gnade.solid = SOLID_BBOX;
gnade.classname = "gnade";
// set grenade speed
// gnade.velocity = self.movedir * 600; //was 300 dms
gnade.velocity = self.movedir * 600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
gnade.angles = vectoangles(gnade.velocity);
gnade.owner = self;
gnade.touch = GrenadeTouch;
setmodel (gnade, "progs/grenade.mdl"); //dms
setsize (gnade, '0 0 0', '0 0 0');
setorigin (gnade, self.origin);
gnade.avelocity = '300 300 300';
gnade.nextthink = time + 2.5;
gnade.think = GrenadeExplode;
}
else if (self.spawnflags & SPAWNFLAG_GIBS)
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "zombie/z_shot1.wav", 1, ATTN_NORM);
zgibs = spawn ();
zgibs.owner = self;
zgibs.movetype = MOVETYPE_BOUNCE;
zgibs.solid = SOLID_BBOX;
zgibs.classname = "zgibs";
setmodel (zgibs, "progs/zom_gib.mdl");
setsize (zgibs, '0 0 0', '0 0 0');
setorigin (zgibs, self.origin);
zgibs.velocity = self.movedir * 600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
zgibs.avelocity = '3000 1000 2000';
zgibs.touch = ZombieGrenadeTouch;
// set missile duration
zgibs.nextthink = time + 2.5;
zgibs.think = SUB_Remove;
}
else
{
if (!(self.spawnflags & SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
launch_spike (self.origin, self.movedir);
newmis.velocity = self.movedir * 500;
if (self.spawnflags & SPAWNFLAG_SUPERSPIKE)
newmis.touch = superspike_touch;
}
};
//MED 11/01/96 added state capability
void() shooter_think =
{
if (self.state)
{
spikeshooter_use ();
}
self.nextthink = time + self.wait;
};
/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED.
*/
//MED 11/01/96 commented out setmovedir
void() trap_spikeshooter =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.proj_speed_mod <= 0)
self.proj_speed_mod = 1;
SetMovedir ();
self.use = spikeshooter_use;
if (self.spawnflags & SPAWNFLAG_LASER)
{
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
}
else if (self.spawnflags & SPAWNFLAG_LAVABALL)
{
precache_model ("progs/lavaball.mdl");
// precache_sound2 ("knight/sword2.wav"); //dms
precache_sound2 ("boss1/throw.wav"); //dms
}
else if (self.spawnflags & SPAWNFLAG_ROCKET)
{
precache_model ("progs/missile.mdl");
precache_sound ("weapons/sgun1.wav");
}
else if (self.spawnflags & SPAWNFLAG_VOREBALL)
{
precache_model ("progs/v_spike.mdl");
precache_sound ("shalrath/attack2.wav");
}
else if (self.spawnflags & SPAWNFLAG_GRENADE)
{
precache_model ("progs/grenade.mdl");
precache_sound ("weapons/grenade.wav"); // grenade launcher
}
else if (self.spawnflags & SPAWNFLAG_GIBS)
{
precache_model ("progs/zom_gib.mdl");
precache_sound ("zombie/z_shot1.wav"); // Zombie gibs
precache_sound ("zombie/z_miss.wav");
precache_sound ("zombie/z_hit.wav");
}
else
precache_sound ("weapons/spike2.wav");
};
/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
*/
void() trap_shooter =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
trap_spikeshooter ();
if (self.wait == 0)
self.wait = 1;
//MED 11/01/96 added state capability
self.state = 1;
self.nextthink = self.nextthink + self.wait + self.ltime;
self.think = shooter_think;
};
//MED 11/01/96 added new use function
void() trap_shooter_use =
{
self.state = 1 - self.state;
};
//MED 11/01/96 added new function
/*QUAKED trap_switched_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
"state" 0 initially off, 1 initially on. (0 default)
*/
void() trap_switched_shooter =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
trap_spikeshooter ();
if (self.wait == 0)
self.wait = 1;
//MED 11/01/96 added state capability
self.nextthink = self.nextthink + self.wait + self.ltime;
self.think = shooter_think;
self.use = trap_shooter_use;
};
/*
===============================================================================
===============================================================================
*/
void() make_bubbles;
void() bubble_remove;
void() bubble_bob;
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
air bubbles entity
*/
void() air_bubbles =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove (self);
return;
}
precache_model ("progs/s_bubble.spr");
self.nextthink = time + 1;
self.think = make_bubbles;
};
void() make_bubbles =
{
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random() + 0.5;
self.think = make_bubbles;
};
void() bubble_split =
{
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = self.velocity;
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 1;
bubble.cnt = 10;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.frame = 1;
self.cnt = 10;
if (self.waterlevel != 3)
remove (self);
};
void() bubble_remove =
{
if (other.classname == self.classname)
{
// dprint ("bump");
return;
}
remove(self);
};
void() bubble_bob =
{
local float rnd1, rnd2, rnd3;
self.cnt = self.cnt + 1;
if (self.cnt == 4)
bubble_split();
if (self.cnt == 20)
remove(self);
rnd1 = self.velocity_x + (-10 + (random() * 20));
rnd2 = self.velocity_y + (-10 + (random() * 20));
rnd3 = self.velocity_z + 10 + random() * 10;
if (rnd1 > 10)
rnd1 = 5;
if (rnd1 < -10)
rnd1 = -5;
if (rnd2 > 10)
rnd2 = 5;
if (rnd2 < -10)
rnd2 = -5;
if (rnd3 < 10)
rnd3 = 15;
if (rnd3 > 30)
rnd3 = 25;
self.velocity_x = rnd1;
self.velocity_y = rnd2;
self.velocity_z = rnd3;
self.nextthink = time + 0.5;
self.think = bubble_bob;
};
/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
Just for the debugging level. Don't use
*/
void() viewthing =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
precache_model ("progs/player.mdl");
setmodel (self, "progs/player.mdl");
};
/*
==============================================================================
SIMPLE BMODELS
==============================================================================
*/
void() func_wall_use =
{ // change to alternate textures
self.frame = 1 - self.frame;
};
/*QUAKED func_wall (0 .5 .8) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
This is just a solid wall if not inhibitted
*/
void() func_wall =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.angles = '0 0 0';
self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
self.solid = SOLID_BSP;
self.use = func_wall_use;
setmodel (self, self.model);
};
/*QUAKED func_illusionary (0 .5 .8) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
A simple entity that looks solid but lets you walk through it.
*/
void() func_illusionary =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
setmodel (self, self.model);
makestatic (self);