From 4171288dac629a28a32476e3b54a00491bd4fd6e Mon Sep 17 00:00:00 2001 From: otta8634 Date: Wed, 11 Sep 2024 14:58:40 +0800 Subject: [PATCH] Use hud_colorset_* for most color-coded hud text So far this only replaced e.g. ^2 with the relevant hud_colorset color cvar Consequently added hud_colorset_grey_* Also added hud_colorset_compare_* for cts/race and votes Also added hud_colorset_relative_* for cts/race speed-splits. Not in use currently, but will be by !1351 --- _hud_common.cfg | 12 +++++- qcsrc/client/hud/panel/centerprint.qc | 4 +- qcsrc/client/hud/panel/infomessages.qc | 57 +++++++++++++------------- qcsrc/client/hud/panel/racetimer.qc | 37 +++++++++-------- qcsrc/client/hud/panel/scoreboard.qc | 32 +++++++-------- qcsrc/client/hud/panel/vote.qc | 8 ++-- qcsrc/lib/string.qh | 46 +++++++++++++++++---- 7 files changed, 120 insertions(+), 76 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index 954ffbd80..03d5ddc41 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -14,11 +14,21 @@ seta hud_width 560 "2D virtual width for the hud" seta hud_colorset_foreground_1 "2" "primary priority (important names, etc)" seta hud_colorset_foreground_2 "3" "secondary priority (items, locations, numbers, etc)" seta hud_colorset_foreground_3 "4" "tertiary priority or relatively inconsequential text" -seta hud_colorset_foreground_4 "1" "notice/attention grabbing texting" +seta hud_colorset_foreground_4 "1" "notice/attention grabbing text" +seta hud_colorset_foreground_5 "5" "secondary attention grabbing text" seta hud_colorset_kill_1 "1" "'bad' or 'dangerous' text (death messages against you, kill notifications, etc)" seta hud_colorset_kill_2 "3" "similar to above, but less important... OR, a highlight out of above message type" seta hud_colorset_kill_3 "4" "'good' or 'beneficial' text (you fragging someone, etc)" +seta hud_colorset_compare_1 "1" "'bad'/'no' in terms of some comparison (slower time in race, vote no, etc)" +seta hud_colorset_compare_2 "3" "'neutral' in terms of some comparison (same time in race, etc)" +seta hud_colorset_compare_3 "2" "'good'/'yes' in terms of some comparison (faster time in race, vote yes, etc)" +seta hud_colorset_relative_1 "5" "'better' in terms of another comparison (faster speed in race, etc)" +seta hud_colorset_relative_2 "3" "'neutral' in terms of another comparison (same speed in race, etc)" +seta hud_colorset_relative_3 "6" "'worse' in terms of another comparison (slower speed in race, etc)" seta hud_colorset_background "7" "neutral/unimportant text" +seta hud_colorset_grey_1 "8" "light grey text (less important text, etc)" +seta hud_colorset_grey_2 "9" "grey text" +seta hud_colorset_grey_3 "0" "dark grey text" seta hud_speed_unit "1" "speed unit (1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots)" diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index d627139a3..cf5398481 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -199,9 +199,9 @@ void HUD_CenterPrint() float r; r = random(); if (r > 0.8) - centerprint_Add(floor(r*1000), sprintf(_("^3Countdown message at time %s, seconds left: ^COUNT"), seconds_tostring(time)), 1, 10); + centerprint_Add(floor(r*1000), sprintf(CCR(_("^F2Countdown message at time %s, seconds left: ^COUNT")), seconds_tostring(time)), 1, 10); else if (r > 0.55) - centerprint_Add(0, sprintf(_("^1Multiline message at time %s that\n^BOLDlasts longer than normal"), seconds_tostring(time)), 20, 0); + 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))); hud_configure_cp_generation_time = time + 1 + random()*4; diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 5866271ef..84ad9110c 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -91,9 +91,9 @@ void HUD_InfoMessages() if(spectatee_status) { if(spectatee_status == -1) - s = _("^1Observing"); + s = CCR(_("^F4Observing")); else - s = sprintf(_("^1Spectating: ^7%s"), entcs_GetName(current_player)); + s = sprintf(CCR(_("^F4Spectating: ^BG%s")), entcs_GetName(current_player)); InfoMessage(s); if(autocvar_hud_panel_infomessages_group0) @@ -104,20 +104,20 @@ void HUD_InfoMessages() default: case 0: if(spectatee_status == -1) - s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey(_("primary fire"), "+fire")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 to spectate")), getcommandkey(_("primary fire"), "+fire")); else - s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 or ^F2%s^F4 for next or previous player")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); break; case 1: if(spectatee_status == -1) - s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(CCR(_("^F4Use ^F2%s^F4 or ^F2%s^F4 to change the speed")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); else if(!observe_blocked) - s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 to observe, ^F2%s^F4 to change camera mode")), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); else - s = sprintf(_("^1Press ^3%s^1 to change camera mode"), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 to change camera mode")), getcommandkey(_("drop weapon"), "dropweapon")); break; case 2: - s = sprintf(_("^1Press ^3%s^1 for gamemode info"), getcommandkey(_("server info"), "+show_info")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 for gamemode info")), getcommandkey(_("server info"), "+show_info")); break; } InfoMessage(s); @@ -133,12 +133,12 @@ void HUD_InfoMessages() if(tm > 0) { tm = Team_IndexToTeam(tm); - s = sprintf(_("^2You're queued to join the %s%s^2 team"), Team_ColorCode(tm), Team_ColorName(tm)); + s = sprintf(CCR(_("^F1You're queued to join the %s%s^F1 team")), Team_ColorCode(tm), Team_ColorName(tm)); } else if (tm < 0) - s = sprintf(_("^2You're queued to join any available team")); + s = sprintf(CCR(_("^F1You're queued to join any available team"))); else - s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump")); + s = sprintf(CCR(_("^F4Press ^F2%s^F4 to join")), getcommandkey(_("jump"), "+jump")); InfoMessage(s); } } @@ -147,19 +147,20 @@ void HUD_InfoMessages() { //we need to ceil, otherwise the countdown would be off by .5 when using round() float countdown = ceil(STAT(GAMESTARTTIME) - time); - s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown); + s = sprintf(CCR(_("^F4Game starts in ^F2%d^F4 seconds")), countdown); InfoMessage(s); } string blinkcolor; if(time % 1 >= 0.5) - blinkcolor = "^1"; + blinkcolor = "^F4"; else - blinkcolor = "^3"; + blinkcolor = "^F2"; + blinkcolor = CCR(blinkcolor); if(warmup_stage) { - InfoMessage(_("^2Currently in ^1warmup^2 stage!")); + InfoMessage(CCR(_("^F1Currently in ^F4warmup^F1 stage!"))); int players_needed = 0; Scoreboard_UpdatePlayerTeams(); // ensure numplayers, ts_min, ts_max are current @@ -169,9 +170,9 @@ void HUD_InfoMessages() if(players_needed > 0) { if(players_needed == 1) - s = _("^31^2 more player is needed for the match to start."); + s = CCR(_("^F21^F1 more player is needed for the match to start.")); else - s = sprintf(_("^3%d^2 more players are needed for the match to start."), players_needed); + s = sprintf(CCR(_("^F2%d^F1 more players are needed for the match to start.")), players_needed); InfoMessage(s); } else if(teamnagger && (ts_max - ts_min) >= teamnagger) @@ -184,12 +185,12 @@ void HUD_InfoMessages() if(ready_waiting) { if(ready_waiting_for_me) - s = sprintf(_("%sPress ^3%s%s to end warmup"), blinkcolor, getcommandkey(_("ready"), "ready"), blinkcolor); + s = sprintf(CCR(_("%sPress ^F2%s%s to end warmup")), blinkcolor, getcommandkey(_("ready"), "ready"), blinkcolor); else - s = _("^2Waiting for others to ready up to end warmup..."); + s = CCR(_("^F1Waiting for others to ready up to end warmup...")); } else - s = sprintf(_("^2Press ^3%s^2 to end warmup"), getcommandkey(_("ready"), "ready")); + s = sprintf(CCR(_("^F1Press ^F2%s^F1 to end warmup")), getcommandkey(_("ready"), "ready")); InfoMessage(s); } } @@ -204,7 +205,7 @@ void HUD_InfoMessages() s = strcat(blinkcolor, _("Teams are unbalanced!")); entity tm = GetTeam(myteam, false); if (tm && tm.team != NUM_SPECTATOR && tm.team_size == ts_max) - s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey(_("team selection"), "team_selection_show"), blinkcolor)); + s = strcat(s, sprintf(CCR(_(" Press ^F2%s%s to adjust")), getcommandkey(_("team selection"), "team_selection_show"), blinkcolor)); fontsize *= 1.125; // perfect float draw_beginBoldFont(); InfoMessage(s); @@ -217,16 +218,16 @@ void HUD_InfoMessages() if(num_spectators) //if(spectatee_status != -1) { - s = ((spectatee_status) ? _("^1Spectating this player:") : _("^1Spectating you:")); + s = CCR((spectatee_status) ? _("^F4Spectating this player:") : _("^F4Spectating you:")); // InfoMessage(s) int limit = min(num_spectators, MAX_SPECTATORS); for(int i = 0; i < limit; ++i) { float slot = spectatorlist[i]; if(i == 0) - s = strcat(s, " ^7", entcs_GetName(slot)); + s = strcat(s, CCR(" ^BG"), entcs_GetName(slot)); else - s = strcat("^7", entcs_GetName(slot)); + s = strcat(CCR("^BG"), entcs_GetName(slot)); InfoMessage(s); } } @@ -264,9 +265,9 @@ void HUD_InfoMessages() } else { - InfoMessage(_("^7Press ^3ESC ^7to show HUD options.")); - InfoMessage(_("^3Doubleclick ^7a panel for panel-specific options.")); - InfoMessage(_("^3CTRL ^7to disable collision testing, ^3SHIFT ^7and")); - InfoMessage(_("^3ALT ^7+ ^3ARROW KEYS ^7for fine adjustments.")); + InfoMessage(CCR(_("^BGPress ^F2ESC ^BGto show HUD options."))); + InfoMessage(CCR(_("^F2Doubleclick ^BGa panel for panel-specific options."))); + InfoMessage(CCR(_("^F2CTRL ^BGto disable collision testing, ^F2SHIFT ^BGand"))); + InfoMessage(CCR(_("^F2ALT ^BG+ ^F2ARROW KEYS ^BGfor fine adjustments."))); } } diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index 4a76dbbd5..3ea57d720 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -20,7 +20,7 @@ void HUD_RaceTimer_Export(int fh) string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname) { TC(int, cp); - string cpname, lapstr = "", timestr = "", col = "^7", othercol = "^7", othertimestr = ""; + string cpname, lapstr = "", timestr = "", col = "^BG", othercol = "^BG", othertimestr = ""; if(theirname == "" || !autocvar_cl_race_cptimes_showself) othertime = 0; // don't count personal time @@ -29,44 +29,44 @@ string MakeRaceString(int cp, float mytime, float theirtime, float othertime, fl if(mytime > 0) { timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS)); - col = "^1"; + col = "^C1"; } else if(mytime == 0) { timestr = "+0.0"; - col = "^3"; + col = "^C2"; } else { timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS)); - col = "^2"; + col = "^C3"; } if(othertime > 0) { othertimestr = strcat("+", ftos_decimals(+othertime, TIME_DECIMALS)); - othercol = "^1"; + othercol = "^C1"; } else if(othertime == 0) { othertimestr = "+0.0"; - othercol = "^3"; + othercol = "^C2"; } else { othertimestr = strcat("-", ftos_decimals(-othertime, TIME_DECIMALS)); - othercol = "^2"; + othercol = "^C3"; } if(lapdelta > 0) { lapstr = sprintf(_(" (-%dL)"), lapdelta); - col = "^2"; + col = "^C3"; } else if(lapdelta < 0) { lapstr = sprintf(_(" (+%dL)"), -lapdelta); - col = "^1"; + col = "^C1"; } } else if(theirtime > 0) // anticipation @@ -75,14 +75,17 @@ string MakeRaceString(int cp, float mytime, float theirtime, float othertime, fl timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS)); else timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime), false); - col = "^3"; + col = "^C2"; if(mytime >= othertime) othertimestr = strcat("+", ftos_decimals(mytime - othertime, TIME_DECIMALS)); else othertimestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(othertime), false); - othercol = "^7"; + othercol = "^BG"; } + col = CCR(col); + othercol = CCR(othercol); + if(cp == 254) cpname = _("Start line"); else if(cp == 255) @@ -192,11 +195,11 @@ void HUD_RaceTimer () 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); draw_endBoldFont(); - s = strcat("^1", sprintf(_("Intermediate %d"), 1), " (+15.42)"); + 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("^1", s); + s = strcat(CCR("^C1"), s); 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); } @@ -261,7 +264,7 @@ void HUD_RaceTimer () if(a > 0) { s = sprintf(_("PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason); - s = strcat("^1", s); + s = strcat(CCR("^C1"), s); 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 * a, DRAWFLAG_NORMAL); } @@ -317,15 +320,15 @@ void HUD_RaceTimer () if(time < t) { t = (t - time) * 0.1; - col = "^1"; + col = "^C1"; } else { t = 0; - col = "^2"; + col = "^C3"; } s = sprintf(_("PENALTY: %.1f (%s)"), t, race_penaltyreason); - s = strcat(col, s); + s = strcat(CCR(col), s); 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 * a, DRAWFLAG_NORMAL); } diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 49a5fac1e..3890c7489 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -2327,7 +2327,7 @@ string Scoreboard_Fraglimit_Draw(float limit, bool is_leadlimit) { string s_label = (teamplay) ? teamscores_label(ts_primary) : scores_label(ps_primary); int s_flags = (teamplay) ? teamscores_flags(ts_primary) : scores_flags(ps_primary); - return sprintf((is_leadlimit ? _("^2+%s %s") : _("^5%s %s")), ScoreString(s_flags, limit, 0), + return sprintf(CCR(is_leadlimit ? _("^F1+%s %s") : _("^F5%s %s")), ScoreString(s_flags, limit, 0), (s_label == "score") ? CTX(_("SCO^points")) : (s_label == "fastest") ? "" : TranslateScoresLabel(s_label)); } @@ -2442,7 +2442,7 @@ void Scoreboard_Draw() if (GET_NEXTMAP() != "") { // NOTE: nextmap is drawn before title to avoid covering title in case of long map name - str = strcat("^7", _("Next map:"), " ^9", GET_NEXTMAP()); + str = strcat(CCR("^BG"), _("Next map:"), CCR(" ^G2"), GET_NEXTMAP()); drawcolorcodedstring(pos + vec2(hud_fontsize.x * 0.5, sb_gameinfo_type_fontsize.y - hud_fontsize.y * 1.25), str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); } @@ -2463,13 +2463,13 @@ void Scoreboard_Draw() if (scoreboard_ui_enabled == 2) { if (scoreboard_selected_team) - str = sprintf(_("^7Press ^3%s^7 to join the selected team"), translate_key("SPACE")); + str = sprintf(CCR(_("^BGPress ^F2%s^BG to join the selected team")), translate_key("SPACE")); else - str = sprintf(_("^7Press ^3%s^7 to auto-select a team and join"), translate_key("SPACE")); + str = sprintf(CCR(_("^BGPress ^F2%s^BG to auto-select a team and join")), translate_key("SPACE")); drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); pos.y += sb_gameinfo_detail_fontsize.y + hud_fontsize.y * 0.3; - str = sprintf(_("^7Press ^3%s ^7to select a specific team"), translate_key("TAB")); + str = sprintf(CCR(_("^BGPress ^F2%s ^BGto select a specific team")), translate_key("TAB")); drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); } else @@ -2480,13 +2480,13 @@ void Scoreboard_Draw() float ll_and_fl = STAT(LEADLIMIT_AND_FRAGLIMIT); str = ""; if(tl > 0) - str = strcat(str, sprintf(_("^3%1.0f minutes"), tl)); + str = strcat(str, sprintf(CCR(_("^F2%1.0f minutes")), tl)); if(!gametype.m_hidelimits) { if(fl > 0) { if(tl > 0) - str = strcat(str, "^7 / "); // delimiter + str = strcat(str, CCR("^BG / ")); // delimiter str = strcat(str, Scoreboard_Fraglimit_Draw(fl, false)); } if(ll > 0) @@ -2495,9 +2495,9 @@ void Scoreboard_Draw() { // delimiter if (ll_and_fl && fl > 0) - str = strcat(str, "^7 & "); + str = strcat(str, CCR("^BG & ")); else - str = strcat(str, "^7 / "); + str = strcat(str, CCR("^BG / ")); } str = strcat(str, Scoreboard_Fraglimit_Draw(ll, true)); } @@ -2507,8 +2507,8 @@ void Scoreboard_Draw() if (campaign) str = ""; else - str = sprintf(_("^5%d^7/^5%d ^7players"), numplayers, srv_maxplayers ? srv_maxplayers : maxclients); - str = strcat("^7", _("Map:"), " ^2", mi_shortname, " ", str); // reusing "Map:" translatable string + str = sprintf(CCR(_("^F5%d^BG/^F5%d ^BGplayers")), numplayers, srv_maxplayers ? srv_maxplayers : maxclients); + str = strcat(CCR("^BG"), _("Map:"), CCR(" ^F1"), mi_shortname, " ", str); // reusing "Map:" translatable string drawcolorcodedstring(pos, str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); // align left } // End of Game Info Section @@ -2675,11 +2675,11 @@ void Scoreboard_Draw() if(race_speedaward) { name = textShortenToWidth(ColorTranslateRGB(race_speedaward_holder), namesize, hud_fontsize, stringwidth_colors); - str = sprintf(_("Speed award: %d%s ^7(%s^7)"), race_speedaward * conversion_factor, unit, name); + str = sprintf(CCR(_("Speed award: %d%s ^BG(%s^BG)")), race_speedaward * conversion_factor, unit, name); str = strcat(str, " / "); } name = textShortenToWidth(ColorTranslateRGB(race_speedaward_alltimebest_holder), namesize, hud_fontsize, stringwidth_colors); - str = strcat(str, sprintf(_("All-time fastest: %d%s ^7(%s^7)"), race_speedaward_alltimebest * conversion_factor, unit, name)); + str = strcat(str, sprintf(CCR(_("All-time fastest: %d%s ^BG(%s^BG)")), race_speedaward_alltimebest * conversion_factor, unit, name)); drawcolorcodedstring(pos, str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); pos.y += 1.25 * hud_fontsize.y; // line height + line spacing } @@ -2713,7 +2713,7 @@ void Scoreboard_Draw() if(respawn_time < time) // it happens for a few frames when server is respawning the player str = ""; // draw an empty string to not change suddenly scoreboard_bottom else - str = sprintf(_("^1Respawning in ^3%s^1..."), + str = sprintf(CCR(_("^F4Respawning in ^F2%s^F4...")), (autocvar_hud_panel_scoreboard_respawntime_decimals ? count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals) : @@ -2723,7 +2723,7 @@ void Scoreboard_Draw() } else if(time < respawn_time) { - str = sprintf(_("You are dead, wait ^3%s^7 before respawning"), + str = sprintf(CCR(_("You are dead, wait ^F2%s^BG before respawning")), (autocvar_hud_panel_scoreboard_respawntime_decimals ? count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals) : @@ -2732,7 +2732,7 @@ void Scoreboard_Draw() ); } else if(time >= respawn_time) - str = sprintf(_("You are dead, press ^2%s^7 to respawn"), getcommandkey("jump", "+jump")); + str = sprintf(CCR(_("You are dead, press ^F1%s^BG to respawn")), getcommandkey("jump", "+jump")); pos.y += 1.2 * hud_fontsize.y; drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, hud_fontsize)), str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 79fea584a..7579ca72e 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -30,7 +30,7 @@ void HUD_Vote() LOG_INFO(_("^1You must answer before entering hud configure mode")); cvar_set("_hud_configure", "0"); } - strcpy(vote_called_vote, _("^2Name ^7instead of \"^1Anonymous player^7\" in stats")); + strcpy(vote_called_vote, CCR(_("^F1Name ^BGinstead of \"^F4Anonymous player^BG\" in stats"))); uid2name_dialog = 1; } @@ -124,13 +124,13 @@ void HUD_Vote() drawstring_aspect(pos, s, vec2(mySize.x, (2/8) * mySize.y), '1 1 1', 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 = _("^1Configure the HUD"); + s = CCR(_("^F4Configure the HUD")); drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, vec2(mySize.x, (1.75/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL); // print the yes/no counts - s = sprintf("^2%s ^7(%d)", getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount); + s = sprintf(CCR("^C3%s ^BG(%d)"), getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount); drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, vec2(0.5 * mySize.x, (1.5/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL); - s = sprintf("^1%s ^7(%d)", getcommandkey_forcename(_("No"), "vno"), vote_nocount); + s = sprintf(CCR("^C1%s ^BG(%d)"), getcommandkey_forcename(_("No"), "vno"), vote_nocount); drawcolorcodedstring_aspect(pos + vec2(0.5 * mySize.x, (4/8) * mySize.y), s, vec2(0.5 * mySize.x, (1.5/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL); pos.y += (5/8) * mySize.y; diff --git a/qcsrc/lib/string.qh b/qcsrc/lib/string.qh index 6c542c8fc..5d0a827f2 100644 --- a/qcsrc/lib/string.qh +++ b/qcsrc/lib/string.qh @@ -201,16 +201,29 @@ string ColorTranslateRGB(string s) #ifdef GAMEQC // color code replace, place inside of sprintf and parse the string... defaults described as constants // foreground/normal colors -string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green // primary priority (important names, etc) -string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc) -string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue // tertiary priority or relatively inconsequential text -string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red // notice/attention grabbing texting +string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green // primary priority (important names, etc) +string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc) +string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue // tertiary priority or relatively inconsequential text +string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red // notice/attention grabbing text +string autocvar_hud_colorset_foreground_5 = "5"; // F4 - Light Blue // secondary attention grabbing text // "kill" colors -string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red // "bad" or "dangerous" text (death messages against you, kill notifications, etc) -string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type -string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue // "good" or "beneficial" text (you fragging someone, etc) +string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red // "bad" or "dangerous" text (death messages against you, kill notifications, etc) +string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type +string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue // "good" or "beneficial" text (you fragging someone, etc) +// comparison colors +string autocvar_hud_colorset_compare_1 = "1"; // C1 - Red // "bad"/"no" in terms of some comparison (slower time in race, vote no, etc) +string autocvar_hud_colorset_compare_2 = "3"; // C2 - Yellow // "neutral" in terms of some comparison (same time in race, etc) +string autocvar_hud_colorset_compare_3 = "2"; // C3 - Green // "good"/"yes" in terms of some comparison (faster time in race, vote yes, etc) +// relativity colors (alternatives to comparison colors) +string autocvar_hud_colorset_relative_1 = "5"; // R1 - Light Blue // "better" in terms of another comparison (faster speed in race, etc) +string autocvar_hud_colorset_relative_2 = "3"; // R2 - Yellow // "neutral" in terms of another comparison (same speed in race, etc) +string autocvar_hud_colorset_relative_3 = "6"; // R3 - Pink // "worse" in terms of another comparison (slower speed in race, etc) // background color -string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text +string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text +// grey shades +string autocvar_hud_colorset_grey_1 = "8"; // G1 - Light Grey // light grey text (less important text, etc) +string autocvar_hud_colorset_grey_2 = "9"; // G2 - Grey // grey text +string autocvar_hud_colorset_grey_3 = "0"; // G3 - Dark Grey // dark grey text /** color code replace, place inside of sprintf and parse the string */ string CCR(string input) @@ -220,15 +233,32 @@ string CCR(string input) input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input); input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input); input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input); + input = strreplace("^F5", strcat("^", autocvar_hud_colorset_foreground_5), input); // "kill" colors input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input); input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input); input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input); + // comparison colors + input = strreplace("^C1", strcat("^", autocvar_hud_colorset_compare_1), input); + input = strreplace("^C2", strcat("^", autocvar_hud_colorset_compare_2), input); + input = strreplace("^C3", strcat("^", autocvar_hud_colorset_compare_3), input); + + // relativity colors + input = strreplace("^R1", strcat("^", autocvar_hud_colorset_relative_1), input); + input = strreplace("^R2", strcat("^", autocvar_hud_colorset_relative_2), input); + input = strreplace("^R3", strcat("^", autocvar_hud_colorset_relative_3), input); + // background colors input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input); input = strreplace("^N", "^7", input); // "none"-- reset to white... + + // grey shades + input = strreplace("^G1", strcat("^", autocvar_hud_colorset_grey_1), input); + input = strreplace("^G2", strcat("^", autocvar_hud_colorset_grey_2), input); + input = strreplace("^G3", strcat("^", autocvar_hud_colorset_grey_3), input); + return input; } #endif -- 2.39.2