]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/csqcprojectile.qc
add the missing files
[divverent/nexuiz.git] / data / qcsrc / server / csqcprojectile.qc
1 float CSQCProjectile_SendEntity(entity to, float sf)
2 {
3         sf = sf & 0x3F;
4
5         if(self.csqcprojectile_clientanimate)
6                 sf |= 0x80; // client animated, not interpolated
7
8         if((self.scale != 0 && self.scale != 1) || self.effects != 0)
9                 sf |= 0x40; // scale used
10
11         WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
12         WriteByte(MSG_ENTITY, sf);
13
14         if(sf & 1)
15         {
16                 WriteCoord(MSG_ENTITY, self.origin_x);
17                 WriteCoord(MSG_ENTITY, self.origin_y);
18                 WriteCoord(MSG_ENTITY, self.origin_z);
19
20                 if(sf & 0x80)
21                 {
22                         WriteCoord(MSG_ENTITY, self.velocity_x);
23                         WriteCoord(MSG_ENTITY, self.velocity_y);
24                         WriteCoord(MSG_ENTITY, self.velocity_z);
25                         WriteCoord(MSG_ENTITY, self.gravity);
26                 }
27         }
28
29         if(sf & 2)
30         {
31                 WriteShort(MSG_ENTITY, self.modelindex);
32                 if(sf & 0x40)
33                 {
34                         WriteByte(MSG_ENTITY, bound(0, self.scale / 16.0, 255));
35                         WriteShort(MSG_ENTITY, self.effects & 65535);
36                         WriteByte(MSG_ENTITY, floor(self.effects / 65536));
37                 }
38                 WriteShort(MSG_ENTITY, self.csqcprojectile_flysound);
39                 WriteByte(MSG_ENTITY, 0); // size category
40         }
41
42         return 1;
43 }
44
45 void CSQCProjectile(entity e)
46 {
47         e.SendEntity = CSQCProjectile_SendEntity;
48 }
49
50 void UpdateCSQCProjectile(entity e)
51 {
52         if(e.SendEntity == CSQCProjectile_SendEntity)
53                 e.SendFlags |= 1; // send new origin data
54 }