]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/csqcprojectile.qc
add a new cheat "impulse 404"; some CSQC refactorings; distribute prandom seed as...
[divverent/nexuiz.git] / data / qcsrc / server / csqcprojectile.qc
1 .float csqcprojectile_type;
2
3 float CSQCProjectile_SendEntity(entity to, float sf)
4 {
5         sf = sf & 0x3F;
6
7         if(self.csqcprojectile_clientanimate)
8                 sf |= 0x80; // client animated, not interpolated
9
10         WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
11         WriteByte(MSG_ENTITY, sf);
12
13         if(sf & 1)
14         {
15                 WriteCoord(MSG_ENTITY, self.origin_x);
16                 WriteCoord(MSG_ENTITY, self.origin_y);
17                 WriteCoord(MSG_ENTITY, self.origin_z);
18
19                 if(sf & 0x80)
20                 {
21                         WriteCoord(MSG_ENTITY, self.velocity_x);
22                         WriteCoord(MSG_ENTITY, self.velocity_y);
23                         WriteCoord(MSG_ENTITY, self.velocity_z);
24                         WriteCoord(MSG_ENTITY, self.gravity);
25                 }
26         }
27
28         if(sf & 2)
29                 WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
30
31         return 1;
32 }
33
34 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
35 {
36         Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
37         
38         e.csqcprojectile_clientanimate = clientanimate;
39         
40         if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
41         {
42                 if(e.gravity == 0)
43                         e.gravity = 1;
44         }
45         else
46                 e.gravity = 0;
47
48         e.csqcprojectile_type = type;
49 }
50
51 void UpdateCSQCProjectile(entity e)
52 {
53         if(e.SendEntity == CSQCProjectile_SendEntity)
54                 e.SendFlags |= 1; // send new origin data
55 }