From: terencehill Date: Sat, 15 Jul 2023 15:24:05 +0000 (+0200) Subject: Allow customizing the amount of saturation of the color applied on top of waypoint... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96b535709b766cd966df001a1704c93d7294071d;p=xonotic%2Fxonotic-data.pk3dir.git Allow customizing the amount of saturation of the color applied on top of waypoint icons --- diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 97c26f360..f19fc059e 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -683,8 +683,8 @@ void Draw_WaypointSprite(entity this) } vector sz; - vector txt_color; - string txt = string_null; + vector col = rgb; + string txt = string_null; // it will contain either the text or the icon path if (is_text) { txt = spritelookuptext(this, spriteimage); @@ -692,14 +692,19 @@ void Draw_WaypointSprite(entity this) txt = sprintf(_("%s needing help!"), txt); if (autocvar_g_waypointsprite_uppercase) txt = strtoupper(txt); - txt_color = rgb; sz = waypointsprite_fontsize * '1 1 0'; } else { - // for convenience icon path and color are saved to txt and txt_color - txt = pic; - txt_color = ((autocvar_g_waypointsprite_iconcolor) ? '1 1 1' : rgb); + txt = pic; // icon path + if (autocvar_g_waypointsprite_iconcolor == 0) + col = '1 1 1'; + else if (autocvar_g_waypointsprite_iconcolor > 0 && autocvar_g_waypointsprite_iconcolor != 1) + { + col = rgb_to_hsv(col); + col.y *= autocvar_g_waypointsprite_iconcolor; // scale saturation + col = hsv_to_rgb(col); + } sz = autocvar_g_waypointsprite_iconsize * '1 1 0'; } @@ -717,7 +722,7 @@ void Draw_WaypointSprite(entity this) marg = SPRITE_HEALTHBAR_MARGIN * t + 0.5 * sz.y; float minwidth = (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t; - o = drawsprite_TextOrIcon(is_text, o, ang, minwidth, txt_color, a, sz, txt); + o = drawsprite_TextOrIcon(is_text, o, ang, minwidth, col, a, sz, txt); drawhealthbar( o, 0, @@ -738,7 +743,7 @@ void Draw_WaypointSprite(entity this) } else { - drawsprite_TextOrIcon(is_text, o, ang, 0, txt_color, a, sz, txt); + drawsprite_TextOrIcon(is_text, o, ang, 0, col, a, sz, txt); } draw_endBoldFont(); diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 691ab3a97..2bf20d557 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -426,7 +426,7 @@ seta g_waypointsprite_turrets_onlyhurt 0 "only show the turret waypoint for a sh 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 -seta g_waypointsprite_iconcolor 0 "Show the icon at natural color rather than the waypoint's color" +seta g_waypointsprite_iconcolor 0 "saturation of the waypoint's color applied on top of the waypoint's icon, from 0 (natural icon's color) to 1" alias "g_waypointsprite_personal" "impulse 30" alias "g_waypointsprite_personal_p" "impulse 31"