1 void SUB_RemoveOnNoImpact()
3 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
9 // TODO maybe bounce of walls, make more gibs, etc.
11 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
17 sound(self, CHAN_PAIN, strcat("misc/gib_splat0", ftos(floor(random() * 4 + 1)), ".wav"), VOL_BASE, ATTN_NORM);
18 pointparticles(particleeffectnum("blood"), self.origin + '0 0 1', '0 0 30', 10);
28 Movetype_Physics(FALSE);
30 if(self.touch == Gib_Touch) // don't do this for the "chunk" thingie...
31 trailparticles(self, particleeffectnum("TR_SLIGHTBLOOD"), oldorg, self.origin);
33 trailparticles(self, particleeffectnum("TR_BLOOD"), oldorg, self.origin);
36 self.alpha = bound(0, self.nextthink - time, 1);
44 void TossGib (string mdlname, vector org, vector v, float destroyontouch)
48 // TODO remove some gibs according to cl_nogibs
51 gib.classname = "gib";
52 gib.move_movetype = MOVETYPE_BOUNCE;
54 gib.solid = SOLID_CORPSE;
56 setmodel (gib, mdlname); // precision set above
58 setsize (gib, '-8 -8 -8', '8 8 8');
62 gib.move_touch = Gib_Touch;
64 gib.move_touch = SUB_RemoveOnNoImpact;
66 gib.move_origin = gib.origin = org;
67 gib.move_velocity = v + randomvec();
68 gib.move_avelocity = randomvec() * vlen(gib.move_velocity);
70 gib.damageforcescale = 3.5;
72 gib.nextthink = time + 12 + random () * 4;
77 float amount, type, isgentle;
78 vector org, vel, mi, ma;
80 float c, gibfactor, randomvalue;
82 type = ReadByte(); // gibbage type
83 amount = ReadByte() / 16.0; // gibbage amount
84 org_x = ReadShort() * 4 + 2;
85 org_y = ReadShort() * 4 + 2;
86 org_z = ReadShort() * 4 + 2;
87 vel = decompressShortVector(ReadShort());
88 mi = decompressShortVector(ReadShort());
89 ma = decompressShortVector(ReadShort());
92 type |= 0x80; // set gentle bit
93 isgentle = (type & 0x80 || cvar("cl_gentle"));
95 gibfactor = 1 - cvar("cl_nogibs");
104 self.origin = org; // for the sounds
109 sound (self, CHAN_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM);
111 if(random() < amount)
112 TossGib("models/gibs/eye.md3", org, vel + randomvec() * 150, 0);
113 te_bloodshower(org + mi, org + ma, 1200, 1000 * amount);
114 if(random() < amount)
115 TossGib("models/gibs/bloodyskull.md3", org, vel + randomvec() * 100, 0);
117 for(c = 0; c < amount; ++c)
119 randomvalue = amount - c;
121 if(random() < randomvalue)
122 TossGib ("models/gibs/arm.md3", org, vel + randomvec() * (random() * 120 + 90),0);
123 if(random() < randomvalue)
124 TossGib ("models/gibs/arm.md3", org, vel + randomvec() * (random() * 120 + 90),0);
125 if(random() < randomvalue)
126 TossGib ("models/gibs/chest.md3", org + '0 0 -12', vel + randomvec() * (random() * 120 + 80),0);
127 if(random() < randomvalue)
128 TossGib ("models/gibs/smallchest.md3", org, vel + randomvec() * (random() * 120 + 80),0);
129 if(random() < randomvalue)
130 TossGib ("models/gibs/leg1.md3", org + '0 0 -5', vel + randomvec() * (random() * 120 + 85),0);
131 if(random() < randomvalue)
132 TossGib ("models/gibs/leg2.md3", org + '0 0 -9', vel + randomvec() * (random() * 120 + 85),0);
134 // these splat on impact
135 if(random() < randomvalue)
136 TossGib ("models/gibs/chunk.mdl", org, vel + randomvec() * 450,1);
137 if(random() < randomvalue)
138 TossGib ("models/gibs/chunk.mdl", org, vel + randomvec() * 450,1);
139 if(random() < randomvalue)
140 TossGib ("models/gibs/chunk.mdl", org, vel + randomvec() * 450,1);
141 if(random() < randomvalue)
142 TossGib ("models/gibs/chunk.mdl", org, vel + randomvec() * 450,1);
146 pointparticles(particleeffectnum("blood"), org, vel, amount);
149 if(random() < amount)
150 TossGib ("models/gibs/chunk.mdl", org, vel, 1);
153 pointparticles(particleeffectnum("damage_dissolve"), org, vel, amount);
156 pointparticles(particleeffectnum("damage_hit"), org, vel, amount);
159 // no gibs in gentle mode, sorry
164 void GibSplash_Precache()
166 precache_model("models/gibs/chunk.mdl");
167 precache_model("models/gibs/leg1.md3");
168 precache_model("models/gibs/leg2.md3");
169 precache_model("models/gibs/chest.md3");
170 precache_model("models/gibs/smallchest.md3");
171 precache_model("models/gibs/arm.md3");
172 precache_model("models/gibs/bloodyskull.md3");
173 precache_model("models/gibs/eye.md3");