]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/g_violence.c
made cl_client.c compile again - you can not assign a string to a float field without...
[divverent/nexuiz.git] / qcsrc / gamec / g_violence.c
1 void GibTouch ()
2 {
3         te_blood (self.origin + '0 0 1', '0 0 30', 10);
4
5         float r;
6         r = random ();
7         if (r < 0.60)
8                         sound (self, CHAN_IMPACT, "misc/gib_splat01.wav", 1, ATTN_NORM);
9         else if (r < 0.65)
10                         sound (self, CHAN_IMPACT, "misc/gib_splat02.wav", 1, ATTN_NORM);
11         else if (r < 0.70)
12                         sound (self, CHAN_IMPACT, "misc/gib_splat03.wav", 1, ATTN_NORM);
13         else if (r < 0.75)
14                         sound (self, CHAN_IMPACT, "misc/gib_splat04.wav", 1, ATTN_NORM);
15         self.health = self.health - 11;
16         if (self.health <= -12)
17         {
18                 self.event_damage = nullfunction;
19                 SUB_VanishOrRemove (self);
20         }
21 }
22
23 // changes by LordHavoc on 03/30/04
24 // TossGib now takes a gib entity so it can be used for tossing heads
25 // gib.velocity now uses randomvec() instead of a bunch of manual random calls
26 // merged Gib() into PlayerGib()
27 void TossGib (entity gib, string mdlname, vector org, vector v, float destroyontouch)
28 {
29         if (gib == world)
30         {
31                 gib = spawn ();
32                 gib.norespawn = TRUE;
33         }
34         gib.classname = "gib";
35         gib.movetype = MOVETYPE_BOUNCE;
36         gib.solid = SOLID_CORPSE;
37
38         setmodel (gib, mdlname);
39         setsize (gib, '-8 -8 -8', '8 8 8');
40         setorigin (gib, org);
41
42         gib.health = -1;
43         gib.takedamage = DAMAGE_YES;
44         gib.damageforcescale = 3.5;
45         //gib.event_damage = GibDamage;
46         if (destroyontouch == 1)
47                 gib.touch = GibTouch;
48
49         gib.velocity = v + randomvec() * 450;
50         gib.avelocity = randomvec() * 300;
51
52         SUB_SetFade (gib, time + 12 + random () * 4);
53 }