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