From: Mario Date: Sun, 11 Aug 2019 07:29:04 +0000 (+1000) Subject: Add an option to only show turret waypoints for a short period after the turret has... X-Git-Tag: xonotic-v0.8.5~1410 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2191099dc287299937cecab026bc238af9c757de;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to only show turret waypoints for a short period after the turret has been hurt (disabled by default) --- diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index e2190b66a..f08e2ecee 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -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; diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index f9374497c..df20e1ad2 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -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) diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 61651320a..c9a49f924 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -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