X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fcl_turrets.qc;h=48c6a8798981269b18d83e41c1351f0b23d41640;hp=e2deb39803ab05b66b8f3f24d65134338f3ca585;hb=8802dc71a56bfe87db766c6dab331046575f7eb9;hpb=83aad9e1a69d8e924df17cdbad05b015c6c6f0fc diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index e2deb3980..48c6a8798 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -1,6 +1,7 @@ +#include "cl_turrets.qh" void turret_remove(entity this) { - remove(this.tur_head); + delete(this.tur_head); //remove(this.enemy); this.tur_head = NULL; } @@ -66,13 +67,12 @@ void turret_draw2d(entity this) 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'); @@ -120,7 +120,7 @@ void turret_draw2d(entity this) 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) { @@ -155,17 +155,14 @@ void turret_draw2d(entity this) 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; { @@ -202,7 +199,7 @@ void turret_draw2d(entity this) ); } -void turret_construct(entity this) +void turret_construct(entity this, bool isnew) { entity tur = get_turretinfo(this.m_id); @@ -242,6 +239,12 @@ void turret_construct(entity this) 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); } @@ -258,14 +261,14 @@ void turret_gib_draw(entity 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); } } @@ -369,7 +372,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) 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;