3 float VSF_SETUP = 1; /// Send vehicle type etc
4 float VSF_ORIGIN = 2; /// Send location
5 float VSF_MOVEMENT = 4; /// Send movement update (and angles)
6 float VSF_AVEL = 8; /// Send Angular velocity
7 float VSF_STATS = 16; /// Send ammo, health etc
8 float VSF_EXTRA = 32; /// Send additional data (turret rotations etc). Handeld per vehicle type.
9 float VSF_ANIMINFO = 64; /// Animation info
11 float VSF_FULL_UPDATE = 16777215; /// Send everything
14 #define VSF_FARDISTANCE 2000
15 float send_vehile(entity to, float sf)
18 var void WriteFunc(float, float);
20 dist = vlen(self.origin - to.origin);
21 if(dist > VSF_FARDISTANCE && to != self.owner)
24 // Always send a movement and origin to owner
26 sf |= VSF_ORIGIN | VSF_MOVEMENT;
28 WriteByte(MSG_ENTITY, ENT_CLIENT_VEHICLE);
30 // We need to know client-side what was sent
31 WriteByte(MSG_ENTITY, sf);
35 WriteByte(MSG_ENTITY, self.hud); //vehicle type = hud
36 WriteByte(MSG_ENTITY, self.team);
37 WriteShort(MSG_ENTITY, self.colormap);
38 WriteShort(MSG_ENTITY, self.vehicle_flags);
43 WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord);
44 WriteFunc(MSG_ENTITY, self.origin_x);
45 WriteFunc(MSG_ENTITY, self.origin_y);
46 WriteFunc(MSG_ENTITY, self.origin_z);
51 WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord);
52 WriteFunc(MSG_ENTITY, self.velocity_x);
53 WriteFunc(MSG_ENTITY, self.velocity_y);
54 WriteFunc(MSG_ENTITY, self.velocity_z);
56 WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteAngle);
57 WriteFunc(MSG_ENTITY, self.angles_x);
58 WriteFunc(MSG_ENTITY, self.angles_y);
59 WriteFunc(MSG_ENTITY, self.angles_z);
64 WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord);
65 WriteFunc(MSG_ENTITY, self.avelocity_x);
66 WriteFunc(MSG_ENTITY, self.avelocity_y);
67 WriteFunc(MSG_ENTITY, self.avelocity_z);
74 WriteByte(MSG_ENTITY, 1);
75 WriteByte(MSG_ENTITY, self.vehicle_shield);
76 WriteByte(MSG_ENTITY, self.vehicle_energy);
78 WriteByte(MSG_ENTITY, self.vehicle_ammo1);
79 WriteByte(MSG_ENTITY, self.vehicle_reload1);
81 WriteByte(MSG_ENTITY, self.vehicle_ammo2);
82 WriteByte(MSG_ENTITY, self.vehicle_reload2);
86 WriteByte(MSG_ENTITY, 0);
88 WriteByte(MSG_ENTITY, self.vehicle_health);
92 self.vehile_send_exta(to, sf);
97 void net_link_vehile()
99 self.SendFlags = 0xFFFFFF;
100 Net_LinkEntity(self, FALSE, 0, send_vehile);
105 void vehicle_spiderbot_assemble()
110 void vehicle_racer_assemble()
115 void vehicle_raptor_assemble()
120 void vehicle_bumblebee_assemble()
125 void Net_ReadVehicle(float bIsNew)
128 var float ReadFunc();
132 /*setmodel(self, "models/vehicles/wakizashi.dpm");
133 self.move_movetype = MOVETYPE_BOUNCE;
134 self.entremove = VehicleRacerRemove;
135 setsize(self, '-60 -60 -20', '60 60 20');
136 self.draw = VehicleRacerDraw;
143 self.vehicle_hud = ReadByte();
144 self.team = ReadByte();
145 self.colormap = ReadShort();
146 self.vehicle_flags = ReadShort();
148 switch(self.vehicle_hud)
151 vehicle_racer_assemble();
154 vehicle_spiderbot_assemble();
157 vehicle_raptor_assemble();
160 vehicle_bumblebee_assemble();
169 ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord);
170 self.origin_x = ReadCoord();
171 self.origin_y = ReadCoord();
172 self.origin_z = ReadCoord();
173 self.move_origin = self.origin;
176 if(sf & VSF_MOVEMENT)
178 ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord);
179 self.velocity_x = ReadFunc();
180 self.velocity_y = ReadFunc();
181 self.velocity_z = ReadFunc();
183 ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadAngle);
184 self.angles_x = ReadFunc();
185 self.angles_y = ReadFunc();
186 self.angles_z = ReadFunc();
188 self.move_velocity = self.velocity;
189 self.move_angles = self.angles;
194 ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord);
195 self.avelocity_x = ReadFunc();
196 self.avelocity_y = ReadFunc();
197 self.avelocity_z = ReadFunc();
204 self.vehicle_shield = ReadByte();
205 self.vehicle_energy = ReadByte();
206 self.vehicle_ammo1 = ReadByte();
207 self.vehicle_reload1 = ReadByte();
208 self.vehicle_ammo2 = ReadByte();
209 self.vehicle_reload2 = ReadByte();
211 self.vehicle_health = ReadByte();
215 self.vehile_read_exta(sf);
221 #endif // VEHICLES_CSQC