1 .float csqcprojectile_type;
3 float CSQCProjectile_SendEntity(entity to, float sf)
7 // note: flag 0x20 = no trail please
10 if(self.csqcprojectile_clientanimate)
11 sf |= 0x80; // client animated, not interpolated
13 if(self.flags & FL_ONGROUND)
16 if(self.fade_time != 0 && self.fade_rate != 0)
18 ft = (self.fade_time - time) / sys_frametime;
19 fr = (1 / self.fade_rate) / sys_frametime;
20 if(ft <= 255 && fr <= 255 && fr >= 1)
24 WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
25 WriteByte(MSG_ENTITY, sf);
29 WriteCoord(MSG_ENTITY, self.origin_x);
30 WriteCoord(MSG_ENTITY, self.origin_y);
31 WriteCoord(MSG_ENTITY, self.origin_z);
35 WriteCoord(MSG_ENTITY, self.velocity_x);
36 WriteCoord(MSG_ENTITY, self.velocity_y);
37 WriteCoord(MSG_ENTITY, self.velocity_z);
38 WriteCoord(MSG_ENTITY, self.gravity);
43 WriteByte(MSG_ENTITY, ft);
44 WriteByte(MSG_ENTITY, fr);
49 WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
54 .vector csqcprojectile_oldorigin;
55 void CSQCProjectile_Check(entity e)
57 if(e.csqcprojectile_clientanimate)
58 if(e.flags & FL_ONGROUND)
59 if(e.origin != e.csqcprojectile_oldorigin)
60 UpdateCSQCProjectile(e);
61 e.csqcprojectile_oldorigin = e.origin;
64 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
66 Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
68 e.csqcprojectile_clientanimate = clientanimate;
70 if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
78 e.csqcprojectile_type = type;
79 if(!sound_allowed(MSG_BROADCAST, e))
83 void UpdateCSQCProjectile(entity e)
85 if(e.SendEntity == CSQCProjectile_SendEntity)
87 // send new origin data
92 void UpdateCSQCProjectileAfterTeleport(entity e)
94 if(e.SendEntity == CSQCProjectile_SendEntity)
96 // send new origin data and mark as teleported
101 .void(void) csqcprojectile_oldthink;
102 .float csqcprojectile_oldnextthink;
104 void CSQCProjectile_Update_Think()
106 UpdateCSQCProjectile(self);
107 self.think = self.csqcprojectile_oldthink;
108 self.nextthink = max(time, self.csqcprojectile_oldnextthink);
111 void UpdateCSQCProjectileNextFrame(entity e)
113 if(e.SendEntity == CSQCProjectile_SendEntity)
114 if(e.think != CSQCProjectile_Update_Think)
116 e.csqcprojectile_oldthink = e.think;
117 e.csqcprojectile_oldnextthink = e.nextthink;
118 e.think = CSQCProjectile_Update_Think;