1 .float csqcprojectile_type;
3 float CSQCProjectile_SendEntity(entity to, float sf)
8 // note: flag 0x10 = no trail please
11 if(self.csqcprojectile_clientanimate)
12 sf |= 0x80; // client animated, not interpolated
14 if(self.flags & FL_ONGROUND)
17 if(self.fade_time != 0 && self.fade_rate != 0)
19 ft = (self.fade_time - time) / sys_frametime;
20 fr = (1 / self.fade_rate) / sys_frametime;
21 if(ft <= 255 && fr <= 255 && fr >= 1)
25 // HACK: subflags for sendflags = 0x80
29 if (self.movetype == MOVETYPE_BOUNCEMISSILE || self.movetype == MOVETYPE_BOUNCE)
32 WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
33 WriteByte(MSG_ENTITY, sf);
37 WriteCoord(MSG_ENTITY, self.origin_x);
38 WriteCoord(MSG_ENTITY, self.origin_y);
39 WriteCoord(MSG_ENTITY, self.origin_z);
43 WriteCoord(MSG_ENTITY, self.velocity_x);
44 WriteCoord(MSG_ENTITY, self.velocity_y);
45 WriteCoord(MSG_ENTITY, self.velocity_z);
46 WriteCoord(MSG_ENTITY, self.gravity);
48 WriteByte(MSG_ENTITY, s);
52 WriteCoord(MSG_ENTITY, self.bouncefactor);
53 WriteCoord(MSG_ENTITY, self.bouncestop);
59 WriteByte(MSG_ENTITY, ft);
60 WriteByte(MSG_ENTITY, fr);
65 WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
70 .vector csqcprojectile_oldorigin;
71 void CSQCProjectile_Check(entity e)
73 if(e.csqcprojectile_clientanimate)
74 if(e.flags & FL_ONGROUND)
75 if(e.origin != e.csqcprojectile_oldorigin)
76 UpdateCSQCProjectile(e);
77 e.csqcprojectile_oldorigin = e.origin;
80 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
82 Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
84 e.csqcprojectile_clientanimate = clientanimate;
86 if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
94 e.csqcprojectile_type = type;
95 if(!sound_allowed(MSG_BROADCAST, e))
99 void UpdateCSQCProjectile(entity e)
101 if(e.SendEntity == CSQCProjectile_SendEntity)
103 // send new origin data
108 void UpdateCSQCProjectileAfterTeleport(entity e)
110 if(e.SendEntity == CSQCProjectile_SendEntity)
112 // send new origin data and mark as teleported
117 .void(void) csqcprojectile_oldthink;
118 .float csqcprojectile_oldnextthink;
120 void CSQCProjectile_Update_Think()
122 UpdateCSQCProjectile(self);
123 self.think = self.csqcprojectile_oldthink;
124 self.nextthink = max(time, self.csqcprojectile_oldnextthink);
127 void UpdateCSQCProjectileNextFrame(entity e)
129 if(e.SendEntity == CSQCProjectile_SendEntity)
130 if(e.think != CSQCProjectile_Update_Think)
132 e.csqcprojectile_oldthink = e.think;
133 e.csqcprojectile_oldnextthink = e.nextthink;
134 e.think = CSQCProjectile_Update_Think;