]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/cl_turrets.qc
Merge branch 'master' into terencehill/glowmod_color_fix
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / cl_turrets.qc
index f9374497c8114f35346cedc0e13a46a47817ce45..5c309ece8012806f50245ee1583f6d991c880cbe 100644 (file)
@@ -1,4 +1,5 @@
 #include "cl_turrets.qh"
+
 void turret_remove(entity this)
 {
        delete(this.tur_head);
@@ -9,7 +10,7 @@ void turret_remove(entity this)
 .vector glowmod;
 void turret_changeteam(entity this)
 {
-       this.glowmod = Team_ColorRGB(this.team - 1) * 2;
+       this.glowmod = Team_ColorRGB(this.team - 1);
        this.teamradar_color = Team_ColorRGB(this.team - 1);
 
        if(this.team)
@@ -175,28 +176,37 @@ void turret_draw2d(entity this)
                t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
        }
 
-       o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
-       if(autocvar_g_waypointsprite_turrets_text)
+       bool draw_healthbar = ((this.helpme && time < this.helpme) || !autocvar_g_waypointsprite_turrets_onlyhurt || hud != HUD_NORMAL);
+       bool draw_text = autocvar_g_waypointsprite_turrets_text;
+
+       if(draw_healthbar || draw_text) // make sure it's actually being drawn
+       {
+               o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
+       }
+       if(draw_text)
        {
                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,
-                       GetResource(this, RES_HEALTH) / 255,
-                       '0 0 0',
-                       '0 0 0',
-                       0.5 * SPRITE_HEALTHBAR_WIDTH * t,
-                       0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
-                       SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
-                       SPRITE_HEALTHBAR_BORDER * t,
-                       0,
-                       rgb,
-                       a * SPRITE_HEALTHBAR_BORDERALPHA,
-                       rgb,
-                       a * SPRITE_HEALTHBAR_HEALTHALPHA,
-                       DRAWFLAG_NORMAL
-                       );
+       if(draw_healthbar)
+       {
+               drawhealthbar(
+                               o,
+                               0,
+                               GetResource(this, RES_HEALTH) / 255,
+                               '0 0 0',
+                               '0 0 0',
+                               0.5 * SPRITE_HEALTHBAR_WIDTH * t,
+                               0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
+                               SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
+                               SPRITE_HEALTHBAR_BORDER * t,
+                               0,
+                               rgb,
+                               a * SPRITE_HEALTHBAR_BORDERALPHA,
+                               rgb,
+                               a * SPRITE_HEALTHBAR_HEALTHALPHA,
+                               DRAWFLAG_NORMAL
+                               );
+       }
 }
 
 void turret_construct(entity this, bool isnew)
@@ -367,8 +377,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
                this.origin = ReadVector();
                setorigin(this, this.origin);
 
-               this.angles_x = ReadAngle();
-               this.angles_y = ReadAngle();
+               this.angles = ReadAngleVector2D();
 
                turret_construct(this, isnew);
                this.colormap = 1024;