+#include "cl_turrets.qh"
void turret_remove(entity this)
{
- remove(this.tur_head);
+ delete(this.tur_head);
//remove(this.enemy);
this.tur_head = NULL;
}
return;
float dist = vlen(this.origin - view_origin);
- float t = (entcs_GetTeam(player_localnum) + 1);
vector o;
string txt;
if(autocvar_cl_vehicles_hud_tactical)
- if(dist < 10240 && t != this.team)
+ if(dist < 10240 && (myteam + 1 != this.team))
{
// TODO: Vehicle tactical hud
o = project_3d_to_2d(this.origin + '0 0 32');
else
txt = spritelookuptext(this, spriteimage);
- if(time - floor(time) > 0.5 && t == this.team)
+ if(time - floor(time) > 0.5 && (myteam + 1 == this.team))
{
if(this.helpme && time < this.helpme)
{
o_z = 0;
- float edgedistance_min, crosshairdistance;
- edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
+ float edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)),
(o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
(vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
(vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
- float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
+ float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
- crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
-
- t = waypointsprite_scale * vidscale;
+ float t = waypointsprite_scale;
a *= waypointsprite_alpha;
{
);
}
-void turret_construct(entity this)
+void turret_construct(entity this, bool isnew)
{
entity tur = get_turretinfo(this.m_id);
this.tur_head.drawmask = MASK_NORMAL;
this.anim_start_time = 0;
this.draw2d = turret_draw2d;
- IL_PUSH(g_drawables_2d, this);
this.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
this.teamradar_color = '1 0 0';
this.alpha = 1;
+ if(isnew)
+ {
+ IL_PUSH(g_drawables, this);
+ IL_PUSH(g_drawables_2d, this);
+ }
+
tur.tr_setup(tur, this);
}
if(time >= this.nextthink)
{
turret_gibboom(this);
- remove(this);
+ delete(this);
}
}
else
{
this.alpha = bound(0, this.nextthink - time, 1);
if(this.alpha < ALPHA_MIN_VISIBLE)
- remove(this);
+ delete(this);
}
}
this.angles_x = ReadAngle();
this.angles_y = ReadAngle();
- turret_construct(this);
+ turret_construct(this, isnew);
this.colormap = 1024;
this.glowmod = '0 1 1';
this.tur_head.colormap = this.colormap;