]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/cl_turrets.qc
Draw the text instead of the image path
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / cl_turrets.qc
index 48c6a8798981269b18d83e41c1351f0b23d41640..d3ee5cb652c58a9f4f48f3bfb88d6a62ac3559c1 100644 (file)
@@ -67,12 +67,13 @@ 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 && (myteam + 1 != this.team))
+       if(dist < 10240 && t != this.team)
        {
                // TODO: Vehicle tactical hud
                o = project_3d_to_2d(this.origin + '0 0 32');
@@ -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;
@@ -120,7 +121,7 @@ void turret_draw2d(entity this)
        else
                txt = spritelookuptext(this, spriteimage);
 
-       if(time - floor(time) > 0.5 && (myteam + 1 == this.team))
+       if(time - floor(time) > 0.5 && t == this.team)
        {
                if(this.helpme && time < this.helpme)
                {
@@ -160,9 +161,9 @@ void turret_draw2d(entity this)
        (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
        (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
 
-       float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
+       float crosshairdistance = sqrt( ((o.x - vid_conwidth/2) ** 2) + ((o.y - vid_conheight/2) ** 2) );
 
-       float t = waypointsprite_scale;
+       t = waypointsprite_scale;
        a *= waypointsprite_alpha;
 
        {
@@ -179,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,
@@ -211,7 +212,7 @@ void turret_construct(entity this, bool isnew)
        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)