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
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;
}
}
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)
//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)
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);
}
}
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;
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();
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;
}
}
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);
}
}
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);
}
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;
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();
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,
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;
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;
//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) {
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;
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;
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;
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);
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;
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);
}
// 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)
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
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;
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();
}
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);
}
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"));
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))
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
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