1 .float csqcprojectile_type;
3 float CSQCProjectile_SendEntity(entity to, float sf)
5 // note: flag 0x20 = no trail please
8 if(self.csqcprojectile_clientanimate)
9 sf |= 0x80; // client animated, not interpolated
11 if(self.flags & FL_ONGROUND)
14 WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
15 WriteByte(MSG_ENTITY, sf);
19 WriteCoord(MSG_ENTITY, self.origin_x);
20 WriteCoord(MSG_ENTITY, self.origin_y);
21 WriteCoord(MSG_ENTITY, self.origin_z);
25 WriteCoord(MSG_ENTITY, self.velocity_x);
26 WriteCoord(MSG_ENTITY, self.velocity_y);
27 WriteCoord(MSG_ENTITY, self.velocity_z);
28 WriteCoord(MSG_ENTITY, self.gravity);
33 WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
38 .vector csqcprojectile_oldorigin;
39 void CSQCProjectile_Check(entity e)
41 if(e.csqcprojectile_clientanimate)
42 if(e.flags & FL_ONGROUND)
43 if(e.origin != e.csqcprojectile_oldorigin)
44 UpdateCSQCProjectile(e);
45 e.csqcprojectile_oldorigin = e.origin;
48 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
50 Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
52 e.csqcprojectile_clientanimate = clientanimate;
54 if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
62 e.csqcprojectile_type = type;
63 if(!sound_allowed(MSG_BROADCAST, e))
67 void UpdateCSQCProjectile(entity e)
69 if(e.SendEntity == CSQCProjectile_SendEntity)
71 // send new origin data
76 void UpdateCSQCProjectileAfterTeleport(entity e)
78 if(e.SendEntity == CSQCProjectile_SendEntity)
80 // send new origin data and mark as teleported
85 .void(void) csqcprojectile_oldthink;
86 .float csqcprojectile_oldnextthink;
88 void CSQCProjectile_Update_Think()
90 UpdateCSQCProjectile(self);
91 self.think = self.csqcprojectile_oldthink;
92 self.nextthink = max(time, self.csqcprojectile_oldnextthink);
95 void UpdateCSQCProjectileNextFrame(entity e)
97 if(e.SendEntity == CSQCProjectile_SendEntity)
98 if(e.think != CSQCProjectile_Update_Think)
100 e.csqcprojectile_oldthink = e.think;
101 e.csqcprojectile_oldnextthink = e.nextthink;
102 e.think = CSQCProjectile_Update_Think;