1 .float csqcprojectile_type;
3 float CSQCProjectile_SendEntity(entity to, float sf)
7 // note: flag 0x08 = no trail please (teleport bit)
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)
27 WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
28 WriteByte(MSG_ENTITY, sf);
32 WriteCoord(MSG_ENTITY, self.origin_x);
33 WriteCoord(MSG_ENTITY, self.origin_y);
34 WriteCoord(MSG_ENTITY, self.origin_z);
38 WriteCoord(MSG_ENTITY, self.velocity_x);
39 WriteCoord(MSG_ENTITY, self.velocity_y);
40 WriteCoord(MSG_ENTITY, self.velocity_z);
42 WriteCoord(MSG_ENTITY, self.gravity);
47 WriteByte(MSG_ENTITY, ft);
48 WriteByte(MSG_ENTITY, fr);
53 WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
58 .vector csqcprojectile_oldorigin;
59 void CSQCProjectile_Check(entity e)
61 if(e.csqcprojectile_clientanimate)
62 if(e.flags & FL_ONGROUND)
63 if(e.origin != e.csqcprojectile_oldorigin)
64 UpdateCSQCProjectile(e);
65 e.csqcprojectile_oldorigin = e.origin;
68 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
70 Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
72 e.csqcprojectile_clientanimate = clientanimate;
74 if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
82 e.csqcprojectile_type = type;
83 if(!sound_allowed(MSG_BROADCAST, e))
87 void UpdateCSQCProjectile(entity e)
89 if(e.SendEntity == CSQCProjectile_SendEntity)
91 // send new origin data
96 void UpdateCSQCProjectileAfterTeleport(entity e)
98 if(e.SendEntity == CSQCProjectile_SendEntity)
100 // send new origin data
102 // mark as teleported
107 .void(void) csqcprojectile_oldthink;
108 .float csqcprojectile_oldnextthink;
110 void CSQCProjectile_Update_Think()
112 UpdateCSQCProjectile(self);
113 self.think = self.csqcprojectile_oldthink;
114 self.nextthink = max(time, self.csqcprojectile_oldnextthink);
117 void UpdateCSQCProjectileNextFrame(entity e)
119 if(e.SendEntity == CSQCProjectile_SendEntity)
120 if(e.think != CSQCProjectile_Update_Think)
122 e.csqcprojectile_oldthink = e.think;
123 e.csqcprojectile_oldnextthink = e.nextthink;
124 e.think = CSQCProjectile_Update_Think;