]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to only show turret waypoints for a short period after the turret has...
authorMario <mario@smbclan.net>
Sun, 11 Aug 2019 07:29:04 +0000 (17:29 +1000)
committerMario <mario@smbclan.net>
Sun, 11 Aug 2019 07:29:04 +0000 (17:29 +1000)
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/common/turrets/cl_turrets.qc
xonotic-client.cfg

index e2190b66a26a9cef1c0efb477c51d53c7276422c..f08e2eceee3642b17f12d76ebd256e7d1869dcaf 100644 (file)
@@ -53,6 +53,7 @@ float autocvar_g_waypointsprite_timealphaexponent;
 bool autocvar_g_waypointsprite_turrets = true;
 float autocvar_g_waypointsprite_turrets_maxdist = 5000;
 bool autocvar_g_waypointsprite_turrets_text = false;
+bool autocvar_g_waypointsprite_turrets_onlyhurt = false;
 bool autocvar_g_waypointsprite_uppercase;
 bool autocvar_g_waypointsprite_text;
 float autocvar_g_waypointsprite_iconsize = 32;
index f9374497c8114f35346cedc0e13a46a47817ce45..df20e1ad2f2d8371638de205f191a458be3db41e 100644 (file)
@@ -175,28 +175,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)
index 61651320af290c4d91acda0ec9afc7c3a7691b24..c9a49f924a330b15c327e566d9617ecad3247eeb 100644 (file)
@@ -396,6 +396,7 @@ set g_waypointsprite_timealphaexponent 1
 seta g_waypointsprite_turrets 1 "disable turret waypoints"
 seta g_waypointsprite_turrets_maxdist 5000 "max distance for turret waypoints"
 seta g_waypointsprite_turrets_text 0 "show the turret's name in the waypoint"
+seta g_waypointsprite_turrets_onlyhurt 0 "only show the turret waypoint for a short period after being hurt"
 seta g_waypointsprite_uppercase 1
 seta g_waypointsprite_text 0 "Always show text instead of icons, setting this to 0 will still use text if the icon is unavailable"
 seta g_waypointsprite_iconsize 32