Remove `-Wno-double-declaration`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / tturrets.qc
1 string tid2info_base;
2 string tid2info_head;
3 string tid2info_name;
4 vector  tid2info_min;
5 vector  tid2info_max;
6
7 void turret_tid2info(float _tid);
8 void turret_precache(float _tid);
9 float turret_is_precache[TID_LAST];
10
11 void turrets_precache()
12 {
13     turret_precache(TID_COMMON);
14 }
15
16 void turret_precache(int _tid)
17 {
18     if (!turret_is_precache[TID_COMMON])
19     {
20         precache_sound ("weapons/rocket_impact.wav");
21         precache_model ("models/turrets/base-gib1.md3");
22         precache_model ("models/turrets/base-gib2.md3");
23         precache_model ("models/turrets/base-gib3.md3");
24         precache_model ("models/turrets/base-gib4.md3");
25         precache_model ("models/turrets/head-gib1.md3");
26         precache_model ("models/turrets/head-gib2.md3");
27         precache_model ("models/turrets/head-gib3.md3");
28         precache_model ("models/turrets/head-gib4.md3");
29         precache_model ("models/turrets/terrainbase.md3");
30         precache_model ("models/turrets/base.md3");
31         precache_model ("models/turrets/rocket.md3");
32     }
33     turret_tid2info(_tid);
34     if(turret_is_precache[_tid])
35         return;
36
37     switch(_tid)
38     {
39         case TID_EWHEEL:
40             precache_model ("models/turrets/ewheel-base2.md3");
41             precache_model ("models/turrets/ewheel-gun1.md3");
42             break;
43         case TID_FLAC:
44             precache_model ("models/turrets/flac.md3");
45             break;
46         case TID_FUSION:
47             precache_model ("models/turrets/reactor.md3");
48             break;
49         case TID_HELLION:
50             precache_model ("models/turrets/hellion.md3");
51             break;
52         case TID_HK:
53             precache_model ("models/turrets/hk.md3");
54             break;
55         case TID_MACHINEGUN:
56             precache_model ("models/turrets/machinegun.md3");
57             precache_sound ("weapons/uzi_fire.wav");
58             break;
59         case TID_MLRS:
60             precache_model ("models/turrets/mlrs.md3");
61             break;
62         case TID_PHASER:
63             precache_model ("models/turrets/phaser.md3");
64             precache_model ("models/turrets/phaser_beam.md3");
65             precache_sound ("turrets/phaser.wav");
66             break;
67         case TID_PLASMA:
68             precache_model ("models/turrets/plasma.md3");
69             break;
70         case TID_PLASMA_DUAL:
71             precache_model ("models/turrets/plasmad.md3");
72             break;
73         case TID_TESLA:
74             precache_model ("models/turrets/tesla_head.md3");
75             precache_model ("models/turrets/tesla_base.md3");
76             break;
77         case TID_WALKER:
78             precache_model ("models/turrets/walker_head_minigun.md3");
79             precache_model ("models/turrets/walker_body.md3");
80             precache_sound ("weapons/uzi_fire.wav");
81             break;
82     }
83     turret_is_precache[_tid] = true;
84 }
85
86 void turret_tid2info(float _tid)
87 {
88     tid2info_base = "models/turrets/base.md3";
89     tid2info_min = '-32 -32 0';
90     tid2info_max = '32 32 64';
91
92     switch(_tid)
93     {
94         case TID_EWHEEL:
95             tid2info_base = "models/turrets/ewheel-base2.md3";
96             tid2info_head = "models/turrets/ewheel-gun1.md3";
97             tid2info_name = "eWheel";
98             break;
99         case TID_FLAC:
100             tid2info_head = "models/turrets/flac.md3";
101             tid2info_name = "Flac Cannon";
102             break;
103         case TID_FUSION:
104             tid2info_head = "models/turrets/reactor.md3";
105             tid2info_name = "Fusion Reactor";
106             tid2info_min = '-34 -34 0';
107             tid2info_max = '34 34 90';
108             break;
109         case TID_HELLION:
110             tid2info_head = "models/turrets/hellion.md3";
111             tid2info_name = "Hellion";
112             break;
113         case TID_HK:
114             tid2info_head = "models/turrets/hk.md3";
115             tid2info_name = "Hunter-Killer";
116             break;
117         case TID_MACHINEGUN:
118             tid2info_head = "models/turrets/machinegun.md3";
119             tid2info_name = "Machinegun";
120             break;
121         case TID_MLRS:
122             tid2info_head = "models/turrets/mlrs.md3";
123             tid2info_name = "MLRS";
124             break;
125         case TID_PHASER:
126             tid2info_head = "models/turrets/phaser.md3";
127             tid2info_name = "Phaser";
128             break;
129         case TID_PLASMA:
130             tid2info_head = "models/turrets/plasma.md3";
131             tid2info_name = "Plasma";
132             break;
133         case TID_PLASMA_DUAL:
134             tid2info_head = "models/turrets/plasmad.md3";
135             tid2info_name = "Dual Plasma";
136             break;
137         case TID_TESLA:
138             tid2info_base = "models/turrets/tesla_base.md3";
139             tid2info_head = "models/turrets/tesla_head.md3";
140             tid2info_name = "Tesla coil";
141             tid2info_min = '-60 -60 0';
142             tid2info_max  ='60 60 128';
143             break;
144         case TID_WALKER:
145             tid2info_base = "models/turrets/walker_body.md3";
146             tid2info_head = "models/turrets/walker_head_minigun.md3";
147             tid2info_name = "Walker";
148             tid2info_min = '-70 -70 0';
149             tid2info_max = '70 70 95';
150             break;
151     }
152 }
153
154 void turret_remove()
155 {
156     remove(self.tur_head);
157     //remove(self.enemy);
158     self.tur_head = world;
159 }
160
161 .vector glowmod;
162 void turret_changeteam()
163 {
164         switch(self.team - 1)
165         {
166         case NUM_TEAM_1: // Red
167             self.glowmod = '2 0 0';
168             self.teamradar_color = '1 0 0';
169             break;
170
171         case NUM_TEAM_2: // Blue
172             self.glowmod = '0 0 2';
173             self.teamradar_color = '0 0 1';
174             break;
175
176         case NUM_TEAM_3: // Yellow
177             self.glowmod = '1 1 0';
178             self.teamradar_color = '1 1 0';
179             break;
180
181         case NUM_TEAM_4: // Pink
182             self.glowmod = '1 0 1';
183             self.teamradar_color = '1 0 1';
184             break;
185         }
186
187         if(self.team)
188         self.colormap = 1024 + (self.team - 1) * 17;
189
190         self.tur_head.colormap = self.colormap;
191         self.tur_head.glowmod = self.glowmod;
192
193 }
194
195 void turret_head_draw()
196 {
197     self.drawmask = MASK_NORMAL;
198 }
199
200 void turret_draw()
201 {
202     float dt;
203
204     dt = time - self.move_time;
205     self.move_time = time;
206     if(dt <= 0)
207         return;
208
209     self.tur_head.angles += dt * self.tur_head.move_avelocity;
210
211     if (self.health < 127)
212     {
213         dt = random();
214
215         if(dt < 0.03)
216             te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
217     }
218
219     if(self.health < 85)
220     if(dt < 0.01)
221         pointparticles(particleeffectnum("smoke_large"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
222
223     if(self.health < 32)
224     if(dt < 0.015)
225         pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
226
227 }
228
229 void turret_draw2d()
230 {
231         if(self.netname == "")
232             return;
233
234         if(!autocvar_g_waypointsprite_turrets)
235                 return;
236
237     if(autocvar_cl_hidewaypoints)
238         return;
239
240         float dist = vlen(self.origin - view_origin);
241     float t = (GetPlayerColor(player_localnum) + 1);
242
243         vector o;
244         string txt;
245
246         if(autocvar_cl_vehicles_hud_tactical)
247         if(dist < 10240 && t != self.team)
248         {
249         // TODO: Vehicle tactical hud
250         o = project_3d_to_2d(self.origin + '0 0 32');
251         if(o.z < 0
252         || o.x < (vid_conwidth * waypointsprite_edgeoffset_left)
253         || o.y < (vid_conheight * waypointsprite_edgeoffset_top)
254         || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
255         || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
256             return; // Dont draw wp's for turrets out of view
257         o_z = 0;
258         if(hud != HUD_NORMAL)
259         {
260             switch(hud)
261             {
262                 case HUD_SPIDERBOT:
263                 case HUD_WAKIZASHI:
264                 case HUD_RAPTOR:
265                 case HUD_BUMBLEBEE:
266                     if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
267                         txt = "gfx/vehicles/vth-mover.tga";
268                     else
269                         txt = "gfx/vehicles/vth-stationary.tga";
270
271                     vector pz = drawgetimagesize(txt) * 0.25;
272                     drawpic(o - pz * 0.5, txt, pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
273                     break;
274             }
275         }
276         }
277
278         if(dist > self.maxdistance)
279         return;
280
281         string spriteimage = self.netname;
282         float a = self.alpha * autocvar_hud_panel_fg_alpha;
283         vector rgb = spritelookupcolor(spriteimage, self.teamradar_color);
284
285
286         if(self.maxdistance > waypointsprite_normdistance)
287                 a *= pow(bound(0, (self.maxdistance - dist) / (self.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
288         else if(self.maxdistance > 0)
289                 a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
290
291         if(rgb == '0 0 0')
292         {
293                 self.teamradar_color = '1 0 1';
294                 printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
295         }
296
297         txt = self.netname;
298         if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
299                 txt = _("Spam");
300         else
301                 txt = spritelookuptext(spriteimage);
302
303         if(time - floor(time) > 0.5 && t == self.team)
304         {
305                 if(self.helpme && time < self.helpme)
306                 {
307                     a *= SPRITE_HELPME_BLINK;
308                     txt = sprintf(_("%s under attack!"), txt);
309                 }
310                 else
311                         a *= spritelookupblinkvalue(spriteimage);
312         }
313
314         if(autocvar_g_waypointsprite_uppercase)
315                 txt = strtoupper(txt);
316
317         if(a > 1)
318         {
319                 rgb *= a;
320                 a = 1;
321         }
322
323         if(a <= 0)
324             return;
325
326         rgb = fixrgbexcess(rgb);
327
328         o = project_3d_to_2d(self.origin + '0 0 64');
329         if(o.z < 0
330         || o.x < (vid_conwidth * waypointsprite_edgeoffset_left)
331         || o.y < (vid_conheight * waypointsprite_edgeoffset_top)
332         || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
333         || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
334             return; // Dont draw wp's for turrets out of view
335
336         o_z = 0;
337
338         float edgedistance_min, crosshairdistance;
339                 edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)),
340         (o.x - (vid_conwidth * waypointsprite_edgeoffset_left)),
341         (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o.x,
342         (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o.y);
343
344         float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
345
346         crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
347
348         t = waypointsprite_scale * vidscale;
349         a *= waypointsprite_alpha;
350
351         {
352                 a = a * (1 - (1 - waypointsprite_distancefadealpha) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
353                 t = t * (1 - (1 - waypointsprite_distancefadescale) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
354         }
355         if (edgedistance_min < waypointsprite_edgefadedistance) {
356                 a = a * (1 - (1 - waypointsprite_edgefadealpha) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
357                 t = t * (1 - (1 - waypointsprite_edgefadescale) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
358         }
359         if(crosshairdistance < waypointsprite_crosshairfadedistance) {
360                 a = a * (1 - (1 - waypointsprite_crosshairfadealpha) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
361                 t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
362         }
363
364         o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
365     o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
366     drawhealthbar(
367             o,
368             0,
369             self.health / 255,
370             '0 0 0',
371             '0 0 0',
372             0.5 * SPRITE_HEALTHBAR_WIDTH * t,
373             0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
374             SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
375             SPRITE_HEALTHBAR_BORDER * t,
376             0,
377             rgb,
378             a * SPRITE_HEALTHBAR_BORDERALPHA,
379             rgb,
380             a * SPRITE_HEALTHBAR_HEALTHALPHA,
381             DRAWFLAG_NORMAL
382             );
383 }
384
385 void turret_walker_draw()
386 {
387     float dt;
388
389     dt = time - self.move_time;
390     self.move_time = time;
391     if(dt <= 0)
392         return;
393
394     fixedmakevectors(self.angles);
395     movelib_groundalign4point(300, 100, 0.25, 45);
396     setorigin(self, self.origin + self.velocity * dt);
397     self.tur_head.angles += dt * self.tur_head.move_avelocity;
398     self.angles_y = self.move_angles.y;
399
400     if (self.health < 127)
401     if(random() < 0.15)
402         te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
403 }
404
405 void turret_ewheel_draw()
406 {
407     float dt;
408
409     dt = time - self.move_time;
410     self.move_time = time;
411     if(dt <= 0)
412         return;
413
414     fixedmakevectors(self.angles);
415     setorigin(self, self.origin + self.velocity * dt);
416     self.tur_head.angles += dt * self.tur_head.move_avelocity;
417     self.angles_y = self.move_angles.y;
418
419     if (self.health < 127)
420     if(random() < 0.05)
421         te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
422 }
423
424 void turret_construct()
425 {
426     if(self.tur_head == world)
427         self.tur_head = spawn();
428
429     turret_tid2info(self.turret_type);
430     self.netname = tid2info_name;
431
432     setorigin(self, self.origin);
433     setmodel(self, tid2info_base);
434     setmodel(self.tur_head, tid2info_head);
435     setsize(self, tid2info_min, tid2info_max);
436     setsize(self.tur_head, '0 0 0', '0 0 0');
437
438     if(self.turret_type == TID_EWHEEL)
439         setattachment(self.tur_head, self, "");
440     else
441         setattachment(self.tur_head, self, "tag_head");
442
443     self.tur_head.classname     = "turret_head";
444     self.tur_head.owner         = self;
445     self.tur_head.move_movetype = MOVETYPE_NOCLIP;
446     self.move_movetype          = MOVETYPE_NOCLIP;
447     self.tur_head.angles        = self.angles;
448     self.health                 = 255;
449     self.solid                  = SOLID_BBOX;
450     self.tur_head.solid         = SOLID_NOT;
451     self.movetype               = MOVETYPE_NOCLIP;
452     self.tur_head.movetype      = MOVETYPE_NOCLIP;
453     self.draw                   = turret_draw;
454     self.entremove              = turret_remove;
455     self.drawmask               = MASK_NORMAL;
456     self.tur_head.drawmask      = MASK_NORMAL;
457     self.anim_start_time        = 0;
458     self.draw2d = turret_draw2d;
459     self.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
460     self.teamradar_color = '1 0 0';
461     self.alpha = 1;
462
463     if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
464     {
465         self.gravity            = 1;
466         self.movetype           = MOVETYPE_BOUNCE;
467         self.move_movetype      = MOVETYPE_BOUNCE;
468         self.move_origin        = self.origin;
469         self.move_time          = time;
470         switch(self.turret_type)
471         {
472             case TID_EWHEEL:
473                 self.draw               = turret_ewheel_draw;
474                 break;
475             case TID_WALKER:
476                 self.draw               = turret_walker_draw;
477                 break;
478
479         }
480     }
481 }
482
483 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
484 void turret_gibboom();
485 void turret_gib_draw()
486 {
487     Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
488
489     self.drawmask = MASK_NORMAL;
490
491         if(self.cnt)
492         {
493             if(time >= self.nextthink)
494             {
495             turret_gibboom();
496             remove(self);
497             }
498         }
499         else
500         {
501         self.alpha = bound(0, self.nextthink - time, 1);
502         if(self.alpha < ALPHA_MIN_VISIBLE)
503             remove(self);
504         }
505 }
506
507 void turret_gibboom()
508 {
509     float i;
510
511     sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
512     pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
513
514     for (i = 1; i < 5; i = i + 1)
515         turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', false);
516 }
517
518 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
519 {
520     entity gib;
521
522     traceline(_from, _to, MOVE_NOMONSTERS, world);
523     if(trace_startsolid)
524         return world;
525
526     gib = spawn();
527     setorigin(gib, _from);
528     setmodel(gib, _model);
529     gib.colormod    = _cmod;
530         gib.solid       = SOLID_CORPSE;
531     gib.draw        = turret_gib_draw;
532     gib.cnt         = _explode;
533     setsize(gib, '-1 -1 -1', '1 1 1');
534     if(_explode)
535     {
536         gib.nextthink = time + 0.2 * (autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15));
537         gib.effects = EF_FLAME;
538     }
539     else
540         gib.nextthink = time + autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15);
541
542     gib.gravity         = 1;
543         gib.move_movetype   = MOVETYPE_BOUNCE;
544         gib.move_origin     = _from;
545         setorigin(gib,        _from);
546         gib.move_velocity   = _to;
547         gib.move_avelocity  = prandomvec() * 32;
548         gib.move_time       = time;
549         gib.damageforcescale = 1;
550         gib.classname = "turret_gib";
551
552         return gib;
553 }
554
555 void turret_die()
556 {
557
558     sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
559     pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
560     turret_tid2info(self.turret_type);
561     if (!autocvar_cl_nogibs)
562     {
563         // Base
564         if(self.turret_type == TID_EWHEEL)
565             turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
566         else if (self.turret_type == TID_WALKER)
567             turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
568         else if (self.turret_type == TID_TESLA)
569             turret_gibtoss(tid2info_base, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
570         else
571         {
572             if (random() > 0.5)
573             {
574                 turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
575                 turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
576                 turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
577             }
578             else
579                 turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true);
580
581             entity headgib = turret_gibtoss(tid2info_head, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
582             if(headgib)
583             {
584                 headgib.angles = headgib.move_angles = self.tur_head.angles;
585                 headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45;
586                 headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity.y * 5;
587                 headgib.gravity = 0.5;
588             }
589         }
590     }
591
592     setmodel(self, "null");
593     setmodel(self.tur_head, "null");
594 }
595
596 void ent_turret()
597 {
598     int sf = ReadByte();
599
600         if(sf & TNSF_SETUP)
601         {
602             self.turret_type = ReadByte();
603
604             self.origin_x = ReadCoord();
605             self.origin_y = ReadCoord();
606             self.origin_z = ReadCoord();
607             setorigin(self, self.origin);
608
609             self.angles_x = ReadAngle();
610             self.angles_y = ReadAngle();
611
612             turret_precache(self.turret_type);
613             turret_construct();
614             self.colormap = 1024;
615             self.glowmod = '0 1 1';
616             self.tur_head.colormap = self.colormap;
617             self.tur_head.glowmod = self.glowmod;
618     }
619
620     if(sf & TNSF_ANG)
621     {
622         if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
623             self.tur_head = spawn();
624
625         self.tur_head.move_angles_x = ReadShort();
626         self.tur_head.move_angles_y = ReadShort();
627         //self.tur_head.angles = self.angles + self.tur_head.move_angles;
628         self.tur_head.angles = self.tur_head.move_angles;
629     }
630
631     if(sf & TNSF_AVEL)
632     {
633         if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
634             self.tur_head = spawn();
635
636         self.tur_head.move_avelocity_x = ReadShort();
637         self.tur_head.move_avelocity_y = ReadShort();
638     }
639
640     if(sf & TNSF_MOVE)
641     {
642         self.origin_x = ReadShort();
643         self.origin_y = ReadShort();
644         self.origin_z = ReadShort();
645         setorigin(self, self.origin);
646
647         self.velocity_x = ReadShort();
648         self.velocity_y = ReadShort();
649         self.velocity_z = ReadShort();
650
651         self.move_angles_y = ReadShort();
652
653         self.move_time     = time;
654         self.move_velocity = self.velocity;
655         self.move_origin   = self.origin;
656     }
657
658     if(sf & TNSF_ANIM)
659     {
660         self.frame1time = ReadCoord();
661         self.frame      = ReadByte();
662     }
663
664     if(sf & TNSF_STATUS)
665     {
666         float _tmp;
667         _tmp = ReadByte();
668         if(_tmp != self.team)
669         {
670             self.team = _tmp;
671             turret_changeteam();
672         }
673
674         _tmp = ReadByte();
675         if(_tmp == 0 && self.health != 0)
676             turret_die();
677         else if(self.health && self.health != _tmp)
678             self.helpme = servertime + 10;
679
680         self.health = _tmp;
681     }
682     //self.enemy.health = self.health / 255;
683 }