From f132ca2f801014f656285e88b079803821029d7a Mon Sep 17 00:00:00 2001 From: otta8634 Date: Thu, 12 Sep 2024 12:05:31 +0800 Subject: [PATCH] Reduce usage of CCR function Added CCR_F1 etc. macros to minimize CCR usage Consequently some transifex strings were simplified, removing color-codes Still many cases where CCR is required Didn't change notifications system yet --- qcsrc/client/hud/panel/centerprint.qc | 10 ++--- qcsrc/client/hud/panel/infomessages.qc | 56 ++++++++++++------------ qcsrc/client/hud/panel/physics.qc | 8 ++-- qcsrc/client/hud/panel/pickup.qc | 4 +- qcsrc/client/hud/panel/racetimer.qc | 45 +++++++++----------- qcsrc/client/hud/panel/radar.qc | 2 +- qcsrc/client/hud/panel/scoreboard.qc | 46 ++++++++++---------- qcsrc/client/hud/panel/timer.qc | 18 ++++---- qcsrc/client/hud/panel/vote.qc | 12 +++--- qcsrc/client/hud/panel/weapons.qc | 10 ++--- qcsrc/lib/string.qh | 59 +++++++++++++++++--------- 11 files changed, 144 insertions(+), 126 deletions(-) diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index b9ebd3a91..4a190a17d 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -199,16 +199,16 @@ void HUD_CenterPrint() float r; r = random(); if (r > 0.8) - centerprint_Add(floor(r*1000), sprintf(CCR(_("^F2Countdown message at time %s, seconds left: ^COUNT")), seconds_tostring(time)), 1, 10); + centerprint_Add(floor(r*1000), strcat(CCR_F2, sprintf(_("Countdown message at time %s, seconds left: ^COUNT"), seconds_tostring(time))), 1, 10); 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); + centerprint_Add(0, strcat(CCR_F4, sprintf(_("Multiline message at time %s that\n^BOLDlasts longer than normal"), seconds_tostring(time))), 20, 0); else - centerprint_AddStandard(sprintf(CCR(_("^BGMessage at time %s")), seconds_tostring(time))); + centerprint_AddStandard(strcat(CCR_BG, sprintf(_("Message at time %s"), seconds_tostring(time)))); hud_configure_cp_generation_time = time + 1 + random()*4; } else { - centerprint_Add(0, strcat(CCR("^BG"), _("Generic message")), 10, 0); + centerprint_Add(0, strcat(CCR_BG, _("Generic 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; - drawcolorcodedstring(pos, strcat(CCR("^BG"), _("vs")), fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos, strcat(CCR_BG, _("vs")), fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); pos.x = duel_title_pos.x + width - padding - max_rl_width; if (left_width >= right_width) diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 84ad9110c..a14336faf 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -91,9 +91,10 @@ void HUD_InfoMessages() if(spectatee_status) { if(spectatee_status == -1) - s = CCR(_("^F4Observing")); + s = _("Observing"); else - s = sprintf(CCR(_("^F4Spectating: ^BG%s")), entcs_GetName(current_player)); + s = sprintf(CCR(_("Spectating: ^BG%s")), entcs_GetName(current_player)); + s = strcat(CCR_F4, s); InfoMessage(s); if(autocvar_hud_panel_infomessages_group0) @@ -104,22 +105,23 @@ void HUD_InfoMessages() default: case 0: if(spectatee_status == -1) - s = sprintf(CCR(_("^F4Press ^F2%s^F4 to spectate")), getcommandkey(_("primary fire"), "+fire")); + s = sprintf(CCR(_("Press ^F2%s^F4 to spectate")), getcommandkey(_("primary fire"), "+fire")); else - s = sprintf(CCR(_("^F4Press ^F2%s^F4 or ^F2%s^F4 for next or previous player")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(CCR(_("Press ^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(CCR(_("^F4Use ^F2%s^F4 or ^F2%s^F4 to change the speed")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(CCR(_("Use ^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(CCR(_("^F4Press ^F2%s^F4 to observe, ^F2%s^F4 to change camera mode")), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(CCR(_("Press ^F2%s^F4 to observe, ^F2%s^F4 to change camera mode")), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); else - s = sprintf(CCR(_("^F4Press ^F2%s^F4 to change camera mode")), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(CCR(_("Press ^F2%s^F4 to change camera mode")), getcommandkey(_("drop weapon"), "dropweapon")); break; case 2: - s = sprintf(CCR(_("^F4Press ^F2%s^F4 for gamemode info")), getcommandkey(_("server info"), "+show_info")); + s = sprintf(CCR(_("Press ^F2%s^F4 for gamemode info")), getcommandkey(_("server info"), "+show_info")); break; } + s = strcat(CCR_F4, s); InfoMessage(s); } @@ -133,12 +135,12 @@ void HUD_InfoMessages() if(tm > 0) { tm = Team_IndexToTeam(tm); - s = sprintf(CCR(_("^F1You're queued to join the %s%s^F1 team")), Team_ColorCode(tm), Team_ColorName(tm)); + s = strcat(CCR_F1, sprintf(CCR(_("You're queued to join the %s%s^F1 team")), Team_ColorCode(tm), Team_ColorName(tm))); } else if (tm < 0) - s = sprintf(CCR(_("^F1You're queued to join any available team"))); + s = strcat(CCR_F1, sprintf(_("You're queued to join any available team"))); else - s = sprintf(CCR(_("^F4Press ^F2%s^F4 to join")), getcommandkey(_("jump"), "+jump")); + s = strcat(CCR_F4, sprintf(CCR(_("Press ^F2%s^F4 to join")), getcommandkey(_("jump"), "+jump"))); InfoMessage(s); } } @@ -147,20 +149,19 @@ 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(CCR(_("^F4Game starts in ^F2%d^F4 seconds")), countdown); + s = strcat(CCR_F4, sprintf(CCR(_("Game starts in ^F2%d^F4 seconds")), countdown)); InfoMessage(s); } string blinkcolor; if(time % 1 >= 0.5) - blinkcolor = "^F4"; + blinkcolor = CCR_F4; else - blinkcolor = "^F2"; - blinkcolor = CCR(blinkcolor); + blinkcolor = CCR_F2; if(warmup_stage) { - InfoMessage(CCR(_("^F1Currently in ^F4warmup^F1 stage!"))); + InfoMessage(strcat(CCR_F1, CCR(_("Currently in ^F4warmup^F1 stage!")))); int players_needed = 0; Scoreboard_UpdatePlayerTeams(); // ensure numplayers, ts_min, ts_max are current @@ -170,9 +171,10 @@ void HUD_InfoMessages() if(players_needed > 0) { if(players_needed == 1) - s = CCR(_("^F21^F1 more player is needed for the match to start.")); + s = CCR(_("1^F1 more player is needed for the match to start.")); else - s = sprintf(CCR(_("^F2%d^F1 more players are needed for the match to start.")), players_needed); + s = sprintf(CCR(_("%d^F1 more players are needed for the match to start.")), players_needed); + s = strcat(CCR_F2, s); InfoMessage(s); } else if(teamnagger && (ts_max - ts_min) >= teamnagger) @@ -187,10 +189,10 @@ void HUD_InfoMessages() if(ready_waiting_for_me) s = sprintf(CCR(_("%sPress ^F2%s%s to end warmup")), blinkcolor, getcommandkey(_("ready"), "ready"), blinkcolor); else - s = CCR(_("^F1Waiting for others to ready up to end warmup...")); + s = strcat(CCR_F1, _("Waiting for others to ready up to end warmup...")); } else - s = sprintf(CCR(_("^F1Press ^F2%s^F1 to end warmup")), getcommandkey(_("ready"), "ready")); + s = strcat(CCR_F1, sprintf(CCR(_("Press ^F2%s^F1 to end warmup")), getcommandkey(_("ready"), "ready"))); InfoMessage(s); } } @@ -218,16 +220,16 @@ void HUD_InfoMessages() if(num_spectators) //if(spectatee_status != -1) { - s = CCR((spectatee_status) ? _("^F4Spectating this player:") : _("^F4Spectating you:")); + s = strcat(CCR_F4, (spectatee_status) ? _("Spectating this player:") : _("Spectating 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, CCR(" ^BG"), entcs_GetName(slot)); + s = strcat(s, " ", CCR_BG, entcs_GetName(slot)); else - s = strcat(CCR("^BG"), entcs_GetName(slot)); + s = strcat(CCR_BG, entcs_GetName(slot)); InfoMessage(s); } } @@ -265,9 +267,9 @@ void HUD_InfoMessages() } else { - 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."))); + InfoMessage(strcat(CCR_BG, CCR(_("Press ^F2ESC ^BGto show HUD options.")))); + InfoMessage(strcat(CCR_F2, CCR(_("Doubleclick ^BGa panel for panel-specific options.")))); + InfoMessage(strcat(CCR_F2, CCR(_("CTRL ^BGto disable collision testing, ^F2SHIFT ^BGand")))); + InfoMessage(strcat(CCR_F2, CCR(_("ALT ^BG+ ^F2ARROW KEYS ^BGfor fine adjustments.")))); } } diff --git a/qcsrc/client/hud/panel/physics.qc b/qcsrc/client/hud/panel/physics.qc index 1067daaa9..24710ff93 100644 --- a/qcsrc/client/hud/panel/physics.qc +++ b/qcsrc/client/hud/panel/physics.qc @@ -164,7 +164,7 @@ void HUD_Physics() //else //tmp_offset_x = 0; tmp_offset.y = (panel_size.y - tmp_size.y) / 2; - drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^BG"), ftos(discrete_speed)), tmp_size, 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); - drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^BG"), unit), tmp_size, 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; - drawcolorcodedstring_aspect(panel_pos + speed_offset + tmp_offset, strcat(CCR("^F4"), ftos(top_speed)), tmp_size, 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; - 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); + 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(); diff --git a/qcsrc/client/hud/panel/pickup.qc b/qcsrc/client/hud/panel/pickup.qc index 46162fd33..c6323d94c 100644 --- a/qcsrc/client/hud/panel/pickup.qc +++ b/qcsrc/client/hud/panel/pickup.qc @@ -92,7 +92,7 @@ void HUD_Pickup() str_timer = "13:02"; else str_timer = seconds_tostring(HUD_Pickup_Time(last_pickup_time)); - str_timer = strcat(CCR("^BG"), str_timer); + str_timer = strcat(CCR_BG, str_timer); drawcolorcodedstring(pos, str_timer, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL); pos.x += stringwidth(str_timer, true, fontsize) + fontsize.x * 0.25; } @@ -100,7 +100,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 = strcat(CCR("^BG"), str_name); + str_name = strcat(CCR_BG, str_name); str_name = textShortenToWidth(str_name, mySize.x - (pos.x - panel_pos.x), fontsize, stringwidth_colors); drawcolorcodedstring(pos, str_name, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL); } diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index 5b0a6d5d6..af97a08ed 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 = "^BG", othercol = "^BG", othertimestr = ""; + string cpname, lapstr = "", timestr = "", col = CCR_BG, othercol = CCR_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 = "^C1"; + col = CCR_C1; } else if(mytime == 0) { timestr = "+0.0"; - col = "^C2"; + col = CCR_C2; } else { timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS)); - col = "^C3"; + col = CCR_C3; } if(othertime > 0) { othertimestr = strcat("+", ftos_decimals(+othertime, TIME_DECIMALS)); - othercol = "^C1"; + othercol = CCR_C1; } else if(othertime == 0) { othertimestr = "+0.0"; - othercol = "^C2"; + othercol = CCR_C2; } else { othertimestr = strcat("-", ftos_decimals(-othertime, TIME_DECIMALS)); - othercol = "^C3"; + othercol = CCR_C3; } if(lapdelta > 0) { lapstr = sprintf(_(" (-%dL)"), lapdelta); - col = "^C3"; + col = CCR_C3; } else if(lapdelta < 0) { lapstr = sprintf(_(" (+%dL)"), -lapdelta); - col = "^C1"; + col = CCR_C1; } } else if(theirtime > 0) // anticipation @@ -75,17 +75,14 @@ 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 = "^C2"; + col = CCR_C2; if(mytime >= othertime) othertimestr = strcat("+", ftos_decimals(mytime - othertime, TIME_DECIMALS)); else othertimestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(othertime), false); - othercol = "^BG"; + othercol = CCR_BG; } - col = CCR(col); - othercol = CCR(othercol); - if(cp == 254) cpname = _("Start line"); else if(cp == 255) @@ -190,15 +187,15 @@ void HUD_RaceTimer () if(autocvar__hud_configure) { - s = CCR("^BG0:13:37"); + s = strcat(CCR_BG, "0:13:37"); draw_beginBoldFont(); str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.6 * mySize.y)); 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)"); + 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 = strcat(CCR("^C1"), sprintf(_("PENALTY: %.1f (%s)"), 2, _("missing a checkpoint"))); + 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); } @@ -262,8 +259,7 @@ void HUD_RaceTimer () a = bound(0, 2 - (time - race_penaltyeventtime), 1); if(a > 0) { - s = sprintf(_("PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason); - s = strcat(CCR("^C1"), s); + s = strcat(CCR_C1, sprintf(_("PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason)); 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); } @@ -273,7 +269,7 @@ void HUD_RaceTimer () if(forcetime != "") { - forcetime = strcat(CCR("^BG"), 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, true, '1 1 0' * 0.6 * mySize.y)); drawcolorcodedstring_expanding(str_pos, forcetime, '1 1 0' * 0.6 * mySize.y, panel_fg_alpha, 0, a); @@ -284,7 +280,7 @@ 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); + s = strcat(CCR_BG, s); str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, true, '0.6 0.6 0' * mySize.y)); drawcolorcodedstring(str_pos, s, '0.6 0.6 0' * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } @@ -321,15 +317,14 @@ void HUD_RaceTimer () if(time < t) { t = (t - time) * 0.1; - col = "^C1"; + col = CCR_C1; } else { t = 0; - col = "^C3"; + col = CCR_C3; } - s = sprintf(_("PENALTY: %.1f (%s)"), t, race_penaltyreason); - s = strcat(CCR(col), s); + s = strcat(col, sprintf(_("PENALTY: %.1f (%s)"), t, race_penaltyreason)); 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/radar.qc b/qcsrc/client/hud/panel/radar.qc index 5c9fe086c..79de7c444 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -343,7 +343,7 @@ void HUD_Radar() message = _("Click to select spawn location"); } - message = strcat(CCR("^BG"), message); + message = strcat(CCR_BG, message); drawcolorcodedstring(pos + '0.5 0 0' * (mySize_x - stringwidth(message, true, hud_fontsize)) - '0 1 0' * hud_fontsize_y * 2, message, hud_fontsize, hud_panel_radar_foreground_alpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 571898472..a09427203 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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; - drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR("^BG"), sprintf(_("Accuracy stats (average %d%%)"), average_accuracy)), hud_fontsize, panel_fg_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR_BG, sprintf(_("Accuracy 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; - drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR("^BG"), _("Item stats")), hud_fontsize, panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR_BG, _("Item 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,7 +2003,7 @@ 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 = strcat(CCR("^BG"), ftos(n)); + string s = strcat(CCR_BG, ftos(n)); float padding = (item_width - stringwidth(s, false, hud_fontsize)) / 2; drawcolorcodedstring(tmpos + vec2(padding, item_height), s, hud_fontsize, panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL); tmpos.x += item_width * rows; @@ -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; - drawcolorcodedstring(pos, strcat(CCR("^BG"), key), hud_fontsize, 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; - drawcolorcodedstring(pos, strcat(CCR("^BG"), value), hud_fontsize, 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 - drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR("^BG"), _("Map stats:")), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR_BG, _("Map 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; - drawcolorcodedstring(pos + eX * panel_bg_padding, strcat(CCR("^BG"), ranktitle), hud_fontsize, 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 = strcat(CCR("^BG"), count_ordinal(i+1)); + 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); + 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,7 +2305,7 @@ vector Scoreboard_Spectators_Draw(vector pos) { for(tm = teams.sort_next; tm; tm = tm.sort_next) if(tm.team == NUM_SPECTATOR) break; - str = sprintf(CCR("^BG%s (%d)"), _("Spectators"), tm.team_size); + str = strcat(CCR_BG, sprintf("%s (%d)", _("Spectators"), tm.team_size)); draw_beginBoldFont(); drawcolorcodedstring(pos, str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); @@ -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(CCR(is_leadlimit ? _("^F1+%s %s") : _("^F5%s %s")), ScoreString(s_flags, limit, 0), + return sprintf((is_leadlimit ? strcat(CCR_F1, _("+%s %s")) : strcat(CCR_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(CCR("^BG"), _("Next map:"), CCR(" ^G2"), 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(CCR(_("^BGPress ^F2%s^BG to join the selected team")), translate_key("SPACE")); + str = strcat(CCR_BG, sprintf(CCR(_("Press ^F2%s^BG to join the selected team")), translate_key("SPACE"))); else - str = sprintf(CCR(_("^BGPress ^F2%s^BG to auto-select a team and join")), translate_key("SPACE")); + str = strcat(CCR_BG, sprintf(CCR(_("Press ^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(CCR(_("^BGPress ^F2%s ^BGto select a specific team")), translate_key("TAB")); + str = strcat(CCR_BG, sprintf(CCR(_("Press ^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(CCR(_("^F2%1.0f minutes")), tl)); + str = strcat(str, CCR_F2, sprintf(_("%1.0f minutes"), tl)); if(!gametype.m_hidelimits) { if(fl > 0) { if(tl > 0) - str = strcat(str, CCR("^BG / ")); // 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, CCR("^BG & ")); + str = strcat(str, CCR_BG, " & "); else - str = strcat(str, CCR("^BG / ")); + str = strcat(str, CCR_BG, " / "); } str = strcat(str, Scoreboard_Fraglimit_Draw(ll, true)); } @@ -2508,7 +2508,7 @@ void Scoreboard_Draw() str = ""; else 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 + 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 @@ -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); - drawcolorcodedstring(str_pos, strcat(CCR("^BG"), str), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(str_pos, strcat(CCR_BG, str), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); } @@ -2713,13 +2713,13 @@ 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(CCR(_("^F4Respawning in ^F2%s^F4...")), + str = strcat(CCR_F4, sprintf(CCR(_("Respawning in ^F2%s^F4...")), (autocvar_hud_panel_scoreboard_respawntime_decimals ? count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals) : count_seconds(ceil(respawn_time - time)) ) - ); + )); } else if(time < respawn_time) { diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 2ead2c9c3..06fc9e014 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -14,11 +14,11 @@ void HUD_Timer_Export(int fh) string HUD_Timer_Color(float timeleft) { if(timeleft <= 60) - return "^C1"; // red + return CCR_C1; // red else if(timeleft <= 300) - return "^C2"; // yellow + return CCR_C2; // yellow else - return "^BG"; // white + return CCR_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; - string timer_color = "^BG"; - string subtimer_color = "^BG"; + string timer_color = CCR_BG; + string subtimer_color = CCR_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 = "^C1"; + subtimer_color = CCR_C1; } else { float round_curtime, round_timelimit, round_timeleft; @@ -156,17 +156,17 @@ void HUD_Timer() float subtimer_padding = subtimer_size.y / 5; timer_size.x -= subtimer_size.x; drawcolorcodedstring_aspect(pos + eX * timer_size.x + eY * subtimer_padding, - strcat(CCR(swap ? timer_color : subtimer_color), swap ? timer_str : subtimer_str), + strcat((swap ? timer_color : subtimer_color), swap ? timer_str : subtimer_str), subtimer_size - eY * 2 * subtimer_padding, panel_fg_alpha, DRAWFLAG_NORMAL); } drawcolorcodedstring_aspect(pos, - strcat(CCR(swap ? subtimer_color : timer_color), swap ? subtimer_str : timer_str), + strcat((swap ? subtimer_color : timer_color), swap ? subtimer_str : timer_str), timer_size, panel_fg_alpha, DRAWFLAG_NORMAL); if(subtext) drawcolorcodedstring_aspect(pos + eY * timer_size.y, - strcat(CCR("^F1"), subtext), + strcat(CCR_F1, subtext), subtext_size, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 5c141a1fa..dee1448dc 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, CCR(_("^F1Name ^BGinstead of \"^F4Anonymous player^BG\" in stats"))); + strcpy(vote_called_vote, strcat(CCR_F1, CCR(_("Name ^BGinstead of \"^F4Anonymous player^BG\" in stats")))); uid2name_dialog = 1; } @@ -118,19 +118,19 @@ void HUD_Vote() } mySize = newSize; - s = strcat(CCR("^BG"), _("A vote has been called for:")); + s = strcat(CCR_BG, _("A vote has been called for:")); if(uid2name_dialog) - s = strcat(CCR("^BG"), _("Allow servers to store and display your name?")); + s = strcat(CCR_BG, _("Allow 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")); + s = strcat(CCR_F4, _("Configure 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(CCR("^C3%s ^BG(%d)"), getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount); + s = strcat(CCR_C3, sprintf(CCR("%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(CCR("^C1%s ^BG(%d)"), getcommandkey_forcename(_("No"), "vno"), vote_nocount); + s = strcat(CCR_C1, sprintf(CCR("%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/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index 71fb150a0..a20652a6c 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -557,15 +557,15 @@ void HUD_Weapons() switch(autocvar_hud_panel_weapons_label) { case 1: // weapon number - label_str = strcat(CCR("^BG"), ftos(weapon_id)); + label_str = strcat(CCR_BG, ftos(weapon_id)); break; case 2: // bind - label_str = strcat(CCR("^BG"), getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id)))); + label_str = strcat(CCR_BG, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id)))); break; case 3: // weapon name - label_str = strcat(CCR("^BG"), strtolower(it.m_name)); + label_str = strcat(CCR_BG, strtolower(it.m_name)); break; default: // nothing @@ -640,7 +640,7 @@ void HUD_Weapons() s = _("Unavailable"); color = stov(autocvar_hud_panel_weapons_complainbubble_color_unavailable); } - s = strcat(CCR("^BG"), s); + 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); drawcolorcodedstring_aspect(weapon_pos + '1 1 0' * padding, s, weapon_size - '2 2 0' * padding, panel_fg_alpha * a, DRAWFLAG_NORMAL); @@ -651,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); - drawcolorcodedstring(weapon_pos, strcat(CCR("^BG"), ftos(i + 1)), label_size, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(weapon_pos, strcat(CCR_BG, ftos(i + 1)), label_size, panel_fg_alpha, DRAWFLAG_NORMAL); } #endif diff --git a/qcsrc/lib/string.qh b/qcsrc/lib/string.qh index 5d0a827f2..77e0c7f0b 100644 --- a/qcsrc/lib/string.qh +++ b/qcsrc/lib/string.qh @@ -225,39 +225,60 @@ string autocvar_hud_colorset_grey_1 = "8"; // G1 - Light Grey // light gre 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 macros for efficiency over the CCR function */ +#define CCR_F1 strcat("^", autocvar_hud_colorset_foreground_1) +#define CCR_F2 strcat("^", autocvar_hud_colorset_foreground_2) +#define CCR_F3 strcat("^", autocvar_hud_colorset_foreground_3) +#define CCR_F4 strcat("^", autocvar_hud_colorset_foreground_4) +#define CCR_F5 strcat("^", autocvar_hud_colorset_foreground_5) +#define CCR_K1 strcat("^", autocvar_hud_colorset_kill_1) +#define CCR_K2 strcat("^", autocvar_hud_colorset_kill_2) +#define CCR_K3 strcat("^", autocvar_hud_colorset_kill_3) +#define CCR_C1 strcat("^", autocvar_hud_colorset_compare_1) +#define CCR_C2 strcat("^", autocvar_hud_colorset_compare_2) +#define CCR_C3 strcat("^", autocvar_hud_colorset_compare_3) +#define CCR_R1 strcat("^", autocvar_hud_colorset_relative_1) +#define CCR_R2 strcat("^", autocvar_hud_colorset_relative_2) +#define CCR_R3 strcat("^", autocvar_hud_colorset_relative_3) +#define CCR_BG strcat("^", autocvar_hud_colorset_background) +#define CCR_N "^7" +#define CCR_G1 strcat("^", autocvar_hud_colorset_grey_1) +#define CCR_G2 strcat("^", autocvar_hud_colorset_grey_2) +#define CCR_G3 strcat("^", autocvar_hud_colorset_grey_3) + /** color code replace, place inside of sprintf and parse the string */ string CCR(string input) { // foreground/normal colors - input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), 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); + input = strreplace("^F1", CCR_F1, input); + input = strreplace("^F2", CCR_F2, input); + input = strreplace("^F3", CCR_F3, input); + input = strreplace("^F4", CCR_F4, input); + input = strreplace("^F5", CCR_F5, 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); + input = strreplace("^K1", CCR_K1, input); + input = strreplace("^K2", CCR_K2, input); + input = strreplace("^K3", CCR_K3, 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); + input = strreplace("^C1", CCR_C1, input); + input = strreplace("^C2", CCR_C2, input); + input = strreplace("^C3", CCR_C3, 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); + input = strreplace("^R1", CCR_R1, input); + input = strreplace("^R2", CCR_R2, input); + input = strreplace("^R3", CCR_R3, input); // background colors - input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input); - input = strreplace("^N", "^7", input); // "none"-- reset to white... + input = strreplace("^BG", CCR_BG, input); + input = strreplace("^N", CCR_N, 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); + input = strreplace("^G1", CCR_G1, input); + input = strreplace("^G2", CCR_G2, input); + input = strreplace("^G3", CCR_G3, input); return input; } -- 2.39.2