X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fcl_turrets.qc;h=d3ee5cb652c58a9f4f48f3bfb88d6a62ac3559c1;hb=9bce1b76574731019d36203e7704870957c4273b;hp=79f1f216fff93bcf18ad7ded7fae17cb5c9ced43;hpb=0a980f57412cf2253cfd73c8c01a26fb04c87189;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index 79f1f216ff..d3ee5cb652 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -1,3 +1,4 @@ +#include "cl_turrets.qh" void turret_remove(entity this) { delete(this.tur_head); @@ -104,14 +105,14 @@ void turret_draw2d(entity this) if(this.maxdistance > waypointsprite_normdistance) - a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent); + a *= (bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent); else if(this.maxdistance > 0) - a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha; + a *= (bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha; if(rgb == '0 0 0') { this.teamradar_color = '1 0 1'; - LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage); + LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage); } txt = this.netname; @@ -155,17 +156,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( ((o.x - vid_conwidth/2) ** 2) + ((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; + t = waypointsprite_scale; a *= waypointsprite_alpha; { @@ -182,7 +180,7 @@ void turret_draw2d(entity this) } o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t); - o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt); + o = drawsprite_TextOrIcon(true, o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt, ""); drawhealthbar( o, 0, @@ -202,7 +200,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); @@ -214,7 +212,7 @@ void turret_construct(entity this) setorigin(this, this.origin); _setmodel(this, tur.model); _setmodel(this.tur_head, tur.head_model); - setsize(this, tur.mins, tur.maxs); + setsize(this, tur.m_mins, tur.m_maxs); setsize(this.tur_head, '0 0 0', '0 0 0'); if(this.m_id == TUR_EWHEEL.m_id) @@ -238,11 +236,16 @@ void turret_construct(entity this) 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); } @@ -370,7 +373,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;