]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Continue applying hud_colorset_* on the hud
authorotta8634 <k9wolf@pm.me>
Wed, 11 Sep 2024 09:05:58 +0000 (17:05 +0800)
committerotta8634 <k9wolf@pm.me>
Wed, 11 Sep 2024 09:05:58 +0000 (17:05 +0800)
Not yet done for colors which blend (like healtharmor white blending with red/green)
Some huds still untouched: ammo, engineinfo, quickmenu, minigames
Still some white text being rendered using '1 1 1' vector instead of ^BG

qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/pickup.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/timer.qc
qcsrc/client/hud/panel/timer.qh
qcsrc/client/hud/panel/vote.qc
qcsrc/client/hud/panel/weapons.qc

index cf539848101b2450583980f6f0b3c21605200446..5f5518dafc97b0949c83bd7070434af338a80e76 100644 (file)
@@ -203,12 +203,12 @@ void HUD_CenterPrint()
                                else if (r > 0.55)
                                        centerprint_Add(0, sprintf(CCR(_("^F4Multiline message at time %s that\n^BOLDlasts longer than normal")), seconds_tostring(time)), 20, 0);
                                else
-                                       centerprint_AddStandard(sprintf(_("Message at time %s"), seconds_tostring(time)));
+                                       centerprint_AddStandard(sprintf(CCR(_("^BGMessage at time %s")), seconds_tostring(time)));
                                hud_configure_cp_generation_time = time + 1 + random()*4;
                        }
                        else
                        {
-                               centerprint_Add(0, _("Generic message"), 10, 0);
+                               centerprint_Add(0, CCR(_("^BGGeneric message")), 10, 0);
                                hud_configure_cp_generation_time = time + 10 - random()*3;
                        }
                }
@@ -300,7 +300,7 @@ void HUD_CenterPrint()
                        drawcolorcodedstring(pos, centerprint_title_left, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        pos.x = duel_title_pos.x + max_rl_width + padding * 3;
-                       drawstring(pos, _("vs"), fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos, CCR(_("^BGvs")), fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        pos.x = duel_title_pos.x + width - padding - max_rl_width;
                        if (left_width >= right_width)
index efbf045cd5d5908d4c3defa10eb7f4c0700121a8..1067daaa91d0c27578e51f8267de104879ad0043 100644 (file)
@@ -164,7 +164,7 @@ void HUD_Physics()
                //else
                        //tmp_offset_x = 0;
                tmp_offset.y = (panel_size.y - tmp_size.y) / 2;
-               drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(discrete_speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^BG"), ftos(discrete_speed)), tmp_size, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                //draw speed unit
                if (speed_baralign)
@@ -178,7 +178,7 @@ void HUD_Physics()
                        tmp_size.y = panel_size.y * 0.4 * text_scale;
                        tmp_offset.y = (panel_size.y * 0.4 - tmp_size.y) / 2;
                        string unit = GetSpeedUnit(autocvar_hud_speed_unit);
-                       drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^BG"), unit), tmp_size, panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
 
@@ -237,7 +237,7 @@ void HUD_Physics()
                        tmp_size.x = panel_size.x * (1 - 0.75);
                        tmp_size.y = (panel_size.y - tmp_offset.y) * text_scale;
                        tmp_offset.y += (panel_size.y - tmp_offset.y - tmp_size.y) / 2;
-                       drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(top_speed), tmp_size, '1 0 0', f * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^F4"), ftos(top_speed)), tmp_size, f * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                else
                        top_speed = 0;
@@ -285,7 +285,7 @@ void HUD_Physics()
                tmp_offset.x = 0;
                tmp_offset.y = (panel_size.y - tmp_size.y) / 2;
 
-               drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(discrete_acceleration, acc_decimals), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(CCR("^BG"), ftos_decimals(discrete_acceleration, acc_decimals), "g"), tmp_size, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        draw_endBoldFont();
index 185893138c5de234bfd32a2ddae8d552930ab5f4..b9e9fe0188bb47567616eb599246fe059208cac8 100644 (file)
@@ -92,7 +92,8 @@ void HUD_Pickup()
                                        str_timer = "13:02";
                                else
                                        str_timer = seconds_tostring(HUD_Pickup_Time(last_pickup_time));
-                               drawstring(pos, str_timer, fontsize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                               str_timer = strcat(CCR("^BG"), str_timer);
+                               drawcolorcodedstring(pos, str_timer, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                                pos.x += stringwidth(str_timer, false, fontsize) + fontsize.x * 0.25;
                        }
                }
@@ -100,6 +101,7 @@ void HUD_Pickup()
                drawpic(pos - eY * ((iconsize.y - fontsize.y) / 2), icon, sz2, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
                pos.x += sz2.x + fontsize.x * 0.25;
                str_name = textShortenToWidth(str_name, mySize.x - (pos.x - panel_pos.x), fontsize, stringwidth_nocolors);
-               drawstring(pos, str_name, fontsize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+               str_name = strcat(CCR("^BG"), str_name);
+               drawcolorcodedstring(pos, str_name, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
        }
 }
index 3ea57d720dd214a0a785f4a0d31f5d7f8e30e069..fe546e9d5e67fed1fe5f206009a3c04190035038 100644 (file)
@@ -190,16 +190,15 @@ void HUD_RaceTimer ()
 
        if(autocvar__hud_configure)
        {
-               s = "0:13:37";
+               s = CCR("^BG0:13:37");
                draw_beginBoldFont();
                str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '1 1 0' * 0.6 * mySize.y));
-               drawstring(str_pos, s, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(str_pos, s, '1 1 0' * 0.6 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
                draw_endBoldFont();
                s = strcat(CCR("^C1"), sprintf(_("Intermediate %d"), 1), " (+15.42)");
                str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
                drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
-               s = sprintf(_("PENALTY: %.1f (%s)"), 2, _("missing a checkpoint"));
-               s = strcat(CCR("^C1"), s);
+               s = strcat(CCR("^C1"), sprintf(_("PENALTY: %.1f (%s)"), 2, _("missing a checkpoint")));
                str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
                drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
@@ -274,9 +273,10 @@ void HUD_RaceTimer ()
 
                if(forcetime != "")
                {
+                       forcetime = strcat(CCR("^BG"), forcetime);
                        a = bound(0, (time - race_checkpointtime) / 0.5, 1);
                        str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(forcetime, false, '1 1 0' * 0.6 * mySize.y));
-                       drawstring_expanding(str_pos, forcetime, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, 0, a);
+                       drawcolorcodedstring_expanding(str_pos, forcetime, '1 1 0' * 0.6 * mySize.y, panel_fg_alpha, 0, a);
                }
                else
                        a = 1;
@@ -284,8 +284,9 @@ void HUD_RaceTimer ()
                if(race_laptime && race_checkpoint != 255)
                {
                        s = TIME_ENCODED_TOSTRING(TIME_ENCODE(time + TIME_DECODE(race_penaltyaccumulator) - race_laptime), false);
+                       s = strcat(CCR("^BG"), s);
                        str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '0.6 0.6 0' * mySize.y));
-                       drawstring(str_pos, s, '0.6 0.6 0' * mySize.y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(str_pos, s, '0.6 0.6 0' * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
                draw_endBoldFont();
index a5b17d75eec767e5004252d53dc5818b293d1f93..4753de515d0929145f3545d50c8493f29d851a4c 100644 (file)
@@ -336,11 +336,11 @@ void HUD_Radar()
 
        if ( hud_panel_radar_mouse )
        {
-               string message = _("Click to select teleport destination");
+               string message = CCR(_("^BGClick to select teleport destination"));
 
                if ( STAT(HEALTH) <= 0 )
                {
-                       message = _("Click to select spawn location");
+                       message = CCR(_("^BGClick to select spawn location"));
                }
 
                drawcolorcodedstring(pos + '0.5 0 0' * (mySize_x - stringwidth(message, true, hud_fontsize)) - '0 1 0' * hud_fontsize_y * 2,
index 3890c7489d891a1e0c0a785c060f4875bfa9f2ca..8ad47d4f8ec9dbe00e0e4157c3ee939c784e148b 100644 (file)
@@ -1790,7 +1790,7 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size)
        float weapon_height = hud_fontsize.y * 2.3 / aspect;
        float height = weapon_height + hud_fontsize.y;
 
-       drawstring(pos + eX * panel_bg_padding, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', panel_fg_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos + eX * panel_bg_padding, sprintf(CCR(_("^BGAccuracy stats (average %d%%)")), average_accuracy), hud_fontsize, panel_fg_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
@@ -1947,7 +1947,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size)
        float item_height = hud_fontsize.y * 2.3;
        float height = item_height + hud_fontsize.y;
 
-       drawstring(pos + eX * panel_bg_padding, _("Item stats"), hud_fontsize, '1 1 1', panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos + eX * panel_bg_padding, CCR(_("^BGItem stats")), hud_fontsize, panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
@@ -2003,9 +2003,9 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size)
                //n = 1 + floor(i * 3 + 4.8) % 7; // debug: display a value for each item
                if (n <= 0) continue;
                drawpic_aspect_skin(tmpos, it.m_icon, eX * item_width + eY * item_height, '1 1 1', panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL);
-               string s = ftos(n);
+               string s = strcat(CCR("^BG"), ftos(n));
                float padding = (item_width - stringwidth(s, false, hud_fontsize)) / 2;
-               drawstring(tmpos + vec2(padding, item_height), s, hud_fontsize, '1 1 1', panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(tmpos + vec2(padding, item_height), s, hud_fontsize, panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL);
                tmpos.x += item_width * rows;
                pos.x += item_width * rows;
                if (rows == 2 && column == columns - 1) {
@@ -2024,9 +2024,9 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size)
 vector MapStats_DrawKeyValue(vector pos, string key, string value) {
        float px = pos.x;
        pos.x += hud_fontsize.x * 0.25;
-       drawstring(pos, key, hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos, strcat(CCR("^BG"), key), hud_fontsize, sbt_fg_alpha, DRAWFLAG_NORMAL);
        pos.x = panel_pos.x + panel_size.x - stringwidth(value, false, hud_fontsize) - hud_fontsize.x * 0.25;
-       drawstring(pos, value, hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos, strcat(CCR("^BG"), value), hud_fontsize, sbt_fg_alpha, DRAWFLAG_NORMAL);
        pos.x = px;
        pos.y += hud_fontsize.y;
 
@@ -2058,7 +2058,7 @@ vector Scoreboard_MapStats_Draw(vector pos, vector rgb, vector bg_size) {
                return pos;
 
        //  draw table header
-       drawstring(pos + eX * panel_bg_padding, _("Map stats:"), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos + eX * panel_bg_padding, CCR(_("^BGMap stats:")), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
@@ -2117,7 +2117,7 @@ vector Scoreboard_Rankings_Draw(vector pos, string ranktitle, entity pl, vector
 
        vector scoreboard_selected_hl_pos = pos;
 
-       drawstring(pos + eX * panel_bg_padding, ranktitle, hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR("^BG"), ranktitle), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
@@ -2195,9 +2195,9 @@ vector Scoreboard_Rankings_Draw(vector pos, string ranktitle, entity pl, vector
                else if(!((j + rankings_start_column + column) & 1) && sbt_highlight)
                        drawfill(pos, columnsize, hl_rgb, sbt_highlight_alpha, DRAWFLAG_NORMAL);
 
-               str = count_ordinal(i+1);
-               drawstring(pos + text_ofs, str, hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring(pos + text_ofs + eX * ranksize, TIME_ENCODED_TOSTRING(t, true), hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL);
+               str = strcat(CCR("^BG"), count_ordinal(i+1));
+               drawcolorcodedstring(pos + text_ofs, str, hud_fontsize, sbt_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + text_ofs + eX * ranksize, strcat(CCR("^BG"), TIME_ENCODED_TOSTRING(t, true)), hud_fontsize, sbt_fg_alpha, DRAWFLAG_NORMAL);
                str = ColorTranslateRGB(grecordholder[i]);
                if(cut)
                        str = textShortenToWidth(str, namesize, hud_fontsize, stringwidth_colors);
@@ -2305,9 +2305,9 @@ vector Scoreboard_Spectators_Draw(vector pos) {
                        for(tm = teams.sort_next; tm; tm = tm.sort_next)
                                if(tm.team == NUM_SPECTATOR)
                                        break;
-                       str = sprintf("%s (%d)", _("Spectators"), tm.team_size);
+                       str = sprintf(CCR("^BG%s (%d)"), _("Spectators"), tm.team_size);
                        draw_beginBoldFont();
-                       drawstring(pos, str, hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos, str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        draw_endBoldFont();
                        pos.y += 1.25 * hud_fontsize.y;
 
@@ -2601,7 +2601,7 @@ void Scoreboard_Draw()
                                drawstring(str_pos, str, hud_fontsize * 1.5, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
                                str_pos += eX * stringwidth(str, true, hud_fontsize * 1.5) + eY * hud_fontsize.y * .5;
                                str = sprintf("/%d", team_size_total);
-                               drawstring(str_pos, str, hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(str_pos, strcat(CCR("^BG"), str), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
 
 
index ae796fbdd3a89a626542d1d3d257d362dff9a454..2ead2c9c3999072f0814ea68d419ed8cf48e301f 100644 (file)
@@ -11,14 +11,14 @@ void HUD_Timer_Export(int fh)
        // allow saving cvars that aesthetically change the panel into hud skin files
 }
 
-vector HUD_Timer_Color(float timeleft)
+string HUD_Timer_Color(float timeleft)
 {
        if(timeleft <= 60)
-               return '1 0 0'; // red
+               return "^C1"; // red
        else if(timeleft <= 300)
-               return '1 1 0'; // yellow
+               return "^C2"; // yellow
        else
-               return '1 1 1'; // white
+               return "^BG"; // white
 }
 
 float HUD_Timer_TimeElapsed(float curtime, float starttime)
@@ -67,8 +67,8 @@ void HUD_Timer()
        string subtext = string_null;
        float curtime, timelimit, timeleft;
        vector timer_size, subtext_size, subtimer_size;
-       vector timer_color = '1 1 1';
-       vector subtimer_color = '1 1 1';
+       string timer_color = "^BG";
+       string subtimer_color = "^BG";
        bool swap = (autocvar_hud_panel_timer_secondary == 2 && STAT(ROUNDSTARTTIME));
 
        // Use real or frozen time and get the time limit
@@ -94,7 +94,7 @@ void HUD_Timer()
                if(STAT(ROUNDSTARTTIME) == -1) {
                        // Round can't start
                        subtimer_str = "--:--";
-                       subtimer_color = '1 0 0';
+                       subtimer_color = "^C1";
                } else {
                        float round_curtime, round_timelimit, round_timeleft;
 
@@ -155,17 +155,19 @@ void HUD_Timer()
        if(subtimer_str) {
                float subtimer_padding = subtimer_size.y / 5;
                timer_size.x -= subtimer_size.x;
-               drawstring_aspect(pos + eX * timer_size.x + eY * subtimer_padding,
-                       (swap ? timer_str : subtimer_str), subtimer_size - eY * 2 * subtimer_padding,
-                       (swap ? timer_color : subtimer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring_aspect(pos + eX * timer_size.x + eY * subtimer_padding,
+                       strcat(CCR(swap ? timer_color : subtimer_color), swap ? timer_str : subtimer_str),
+                       subtimer_size - eY * 2 * subtimer_padding, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
-       drawstring_aspect(pos,
-               (swap ? subtimer_str : timer_str), timer_size,
-               (swap ? subtimer_color : timer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos,
+               strcat(CCR(swap ? subtimer_color : timer_color), swap ? subtimer_str : timer_str),
+               timer_size, panel_fg_alpha, DRAWFLAG_NORMAL);
 
        if(subtext)
-               drawstring_aspect(pos + eY * timer_size.y, subtext, subtext_size, '0 1 0', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring_aspect(pos + eY * timer_size.y,
+                       strcat(CCR("^F1"), subtext),
+                       subtext_size, panel_fg_alpha, DRAWFLAG_NORMAL);
 
        draw_endBoldFont();
 }
index 3790f477708accf11c062186355477a102761359..7494d43c9d619a216855a67d8e50c4a29cf0aacf 100644 (file)
@@ -7,6 +7,6 @@ bool autocvar_hud_panel_timer_increment;
 int autocvar_hud_panel_timer_secondary = 1;
 bool autocvar_hud_panel_timer_unbound;
 
-vector HUD_Timer_Color(float timeleft);
+string HUD_Timer_Color(float timeleft);
 float HUD_Timer_TimeElapsed(float curtime, float starttime);
 float HUD_Timer_TimeLeft(float curtime, float starttime, float timelimit);
index 7579ca72edb36f406b1a02ade0ccae6f1020a94c..0c98616487e205ad021160de81eeab87cd2b599d 100644 (file)
@@ -118,10 +118,10 @@ void HUD_Vote()
        }
        mySize = newSize;
 
-       s = _("A vote has been called for:");
+       s = CCR(_("^BGA vote has been called for:"));
        if(uid2name_dialog)
-               s = _("Allow servers to store and display your name?");
-       drawstring_aspect(pos, s, vec2(mySize.x, (2/8) * mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               s = CCR(_("^BGAllow servers to store and display your name?"));
+       drawcolorcodedstring_aspect(pos, s, vec2(mySize.x, (2/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL);
        s = textShortenToWidth(ColorTranslateRGB(vote_called_vote), mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = CCR(_("^F4Configure the HUD"));
index 2863f62d9fe160f50797762a34120c37c2b803a5..71fb150a0e41d39d6b02ebc7da22ff2258cdfc84 100644 (file)
@@ -553,23 +553,26 @@ void HUD_Weapons()
                        drawpic_aspect_skin(weapon_pos_real, it.model2, weapon_size_real, '1 1 1', weapon_alpha_real, DRAWFLAG_NORMAL);
 
                        // draw weapon label string
+                       string label_str = "";
                        switch(autocvar_hud_panel_weapons_label)
                        {
                                case 1: // weapon number
-                                       drawstring(weapon_pos, ftos(weapon_id), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       label_str = strcat(CCR("^BG"), ftos(weapon_id));
                                        break;
 
                                case 2: // bind
-                                       drawstring(weapon_pos, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id))), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       label_str = strcat(CCR("^BG"), getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id))));
                                        break;
 
                                case 3: // weapon name
-                                       drawstring(weapon_pos, strtolower(it.m_name), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       label_str = strcat(CCR("^BG"), strtolower(it.m_name));
                                        break;
 
                                default: // nothing
                                        break;
                        }
+                       if(label_str != "")
+                               drawcolorcodedstring(weapon_pos, label_str, label_size, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        // draw ammo status bar
                        if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RES_NONE))
@@ -637,9 +640,10 @@ void HUD_Weapons()
                                s = _("Unavailable");
                                color = stov(autocvar_hud_panel_weapons_complainbubble_color_unavailable);
                        }
+                       s = strcat(CCR("^BG"), s);
                        float padding = autocvar_hud_panel_weapons_complainbubble_padding;
                        drawpic_aspect_skin(weapon_pos + '1 1 0' * padding, "weapon_complainbubble", weapon_size - '2 2 0' * padding, color, a * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       drawstring_aspect(weapon_pos + '1 1 0' * padding, s, weapon_size - '2 2 0' * padding, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring_aspect(weapon_pos + '1 1 0' * padding, s, weapon_size - '2 2 0' * padding, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
                #if 0
@@ -647,7 +651,7 @@ void HUD_Weapons()
                if(!autocvar_hud_panel_weapons_onlyowned)
                {
                        drawfill(weapon_pos + '1 1 0', weapon_size - '2 2 0', '1 1 1', panel_fg_alpha * 0.2, DRAWFLAG_NORMAL);
-                       drawstring(weapon_pos, ftos(i + 1), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(weapon_pos, strcat(CCR("^BG"), ftos(i + 1)), label_size, panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                #endif