1 #include "g_violence.qh"
5 REGISTER_NET_TEMP(net_gibsplash)
7 bool Violence_GibSplash_SendEntity(entity this, entity to, int sf)
11 WriteHeader(channel, net_gibsplash);
12 WriteByte(channel, this.state); // actually type
13 WriteByte(channel, bound(1, this.cnt * 16, 255)); // gibbage amount multiplier
14 WriteShort(channel, floor(this.origin.x / 4)); // not using a coord here, as gibs don't need this accuracy
15 WriteShort(channel, floor(this.origin.y / 4)); // not using a coord here, as gibs don't need this accuracy
16 WriteShort(channel, floor(this.origin.z / 4)); // not using a coord here, as gibs don't need this accuracy
17 WriteShort(channel, this.oldorigin.x); // acrually compressed velocity
21 void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
23 if(g_cts) // no gibs in CTS
26 entity e = new(gibsplash);
28 e.state = type; // should stay smaller than 15
29 if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker))
30 e.state |= 0x40; // "silence" bit
31 e.state |= 8 * self.species; // gib type, ranges from 0 to 15
33 // if this is a copied dead body, send the num of its player instead
34 // TODO: remove this field, read from model txt files
35 if(self.classname == "body")
36 e.team = num_for_edict(self.enemy);
38 e.team = num_for_edict(self);
43 e.oldorigin_x = compressShortVector(e.velocity);
45 entity cl; FOR_EACH_REALCLIENT(cl) Violence_GibSplash_SendEntity(e, cl, 0);
49 void Violence_GibSplash(entity source, float type, float amount, entity attacker)
51 Violence_GibSplash_At(source.origin + source.view_ofs, source.velocity, type, amount, source, attacker);