From: otta8634 Date: Fri, 13 Sep 2024 06:59:34 +0000 (+0800) Subject: Removed all uses of CCR function in hud code X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=33c0ee2f8c7018de6e660dec7927ea66e50df84f;p=xonotic%2Fxonotic-data.pk3dir.git Removed all uses of CCR function in hud code Used terencehill's suggestion This also simplifies a lot of transifex strings These strings had to be replaced anyway, so no extra work created --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index cc85f31cc..2f1e03496 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -160,7 +160,7 @@ void Announcer_Gamestart() if (gametype.m_1v1) Announcer_Duel(); else - centerprint_SetTitle(strcat("^BG", MapInfo_Type_ToText(gametype))); // Show game type as title + centerprint_SetTitle(strcat(CCR_BG, MapInfo_Type_ToText(gametype))); // Show game type as title if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle Local_Notification(MSG_ANNCE, ANNCE_PREPARE); diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 4a190a17d..89418e8a7 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -161,7 +161,7 @@ void centerprint_SetDuelTitle(string left, string right) void centerprint_SetTitle(string title) { if(title != centerprint_title) - strcpy(centerprint_title, CCR(title)); + strcpy(centerprint_title, title); } void centerprint_ClearTitle() @@ -290,7 +290,8 @@ void HUD_CenterPrint() else max_rl_width = right_width; - width = max_rl_width * 2 + padding * 6 + stringwidth(_("vs"), false, fontsize); + string str_vs = strcat(CCR_BG, _("vs")); + width = max_rl_width * 2 + padding * 6 + stringwidth(str_vs, true, fontsize); pos.x += (panel_size.x - width) * align; duel_title_pos = pos; @@ -300,7 +301,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, str_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 a14336faf..12807fb23 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -93,7 +93,7 @@ void HUD_InfoMessages() if(spectatee_status == -1) s = _("Observing"); else - s = sprintf(CCR(_("Spectating: ^BG%s")), entcs_GetName(current_player)); + s = sprintf(_("Spectating: %s"), strcat(CCR_BG, entcs_GetName(current_player))); s = strcat(CCR_F4, s); InfoMessage(s); @@ -105,20 +105,20 @@ void HUD_InfoMessages() default: case 0: if(spectatee_status == -1) - s = sprintf(CCR(_("Press ^F2%s^F4 to spectate")), getcommandkey(_("primary fire"), "+fire")); + s = sprintf(_("Press %s to spectate"), strcat(CCR_F2, getcommandkey(_("primary fire"), "+fire"), CCR_F4)); else - s = sprintf(CCR(_("Press ^F2%s^F4 or ^F2%s^F4 for next or previous player")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(_("Press %s or %s for next or previous player"), strcat(CCR_F2, getcommandkey(_("next weapon"), "weapnext"), CCR_F4), strcat(CCR_F2, getcommandkey(_("previous weapon"), "weapprev"), CCR_F4)); break; case 1: if(spectatee_status == -1) - s = sprintf(CCR(_("Use ^F2%s^F4 or ^F2%s^F4 to change the speed")), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); + s = sprintf(_("Use %s or %s to change the speed"), strcat(CCR_F2, getcommandkey(_("next weapon"), "weapnext"), CCR_F4), strcat(CCR_F2, getcommandkey(_("previous weapon"), "weapprev"), CCR_F4)); else if(!observe_blocked) - s = sprintf(CCR(_("Press ^F2%s^F4 to observe, ^F2%s^F4 to change camera mode")), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(_("Press %s to observe, %s to change camera mode"), strcat(CCR_F2, getcommandkey(_("secondary fire"), "+fire2"), CCR_F4), strcat(CCR_F2, getcommandkey(_("drop weapon"), "dropweapon"), CCR_F4)); else - s = sprintf(CCR(_("Press ^F2%s^F4 to change camera mode")), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(_("Press %s to change camera mode"), strcat(CCR_F2, getcommandkey(_("drop weapon"), "dropweapon"), CCR_F4)); break; case 2: - s = sprintf(CCR(_("Press ^F2%s^F4 for gamemode info")), getcommandkey(_("server info"), "+show_info")); + s = sprintf(_("Press %s for gamemode info"), strcat(CCR_F2, getcommandkey(_("server info"), "+show_info"), CCR_F4)); break; } s = strcat(CCR_F4, s); @@ -135,12 +135,12 @@ void HUD_InfoMessages() if(tm > 0) { tm = Team_IndexToTeam(tm); - s = strcat(CCR_F1, sprintf(CCR(_("You're queued to join the %s%s^F1 team")), Team_ColorCode(tm), Team_ColorName(tm))); + s = strcat(CCR_F1, sprintf(_("You're queued to join the %s team"), strcat(Team_ColorCode(tm), Team_ColorName(tm), CCR_F1))); } else if (tm < 0) s = strcat(CCR_F1, sprintf(_("You're queued to join any available team"))); else - s = strcat(CCR_F4, sprintf(CCR(_("Press ^F2%s^F4 to join")), getcommandkey(_("jump"), "+jump"))); + s = strcat(CCR_F4, sprintf(_("Press %s to join"), strcat(CCR_F2, getcommandkey(_("jump"), "+jump"), CCR_F4))); InfoMessage(s); } } @@ -149,7 +149,7 @@ 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 = strcat(CCR_F4, sprintf(CCR(_("Game starts in ^F2%d^F4 seconds")), countdown)); + s = strcat(CCR_F4, sprintf(_("Game starts in %s seconds"), strcat(CCR_F2, ftos_decimals(countdown, 0), CCR_F4))); InfoMessage(s); } @@ -161,7 +161,7 @@ void HUD_InfoMessages() if(warmup_stage) { - InfoMessage(strcat(CCR_F1, CCR(_("Currently in ^F4warmup^F1 stage!")))); + InfoMessage(strcat(CCR_F1, sprintf(_("Currently in %s stage!"), strcat(CCR_F4, _("warmup"), CCR_F1)))); int players_needed = 0; Scoreboard_UpdatePlayerTeams(); // ensure numplayers, ts_min, ts_max are current @@ -171,10 +171,9 @@ void HUD_InfoMessages() if(players_needed > 0) { if(players_needed == 1) - s = CCR(_("1^F1 more player is needed for the match to start.")); + s = sprintf(_("%s more player is needed for the match to start."), strcat(CCR_F2, "1", CCR_F1)); else - s = sprintf(CCR(_("%d^F1 more players are needed for the match to start.")), players_needed); - s = strcat(CCR_F2, s); + s = sprintf(_("%s more players are needed for the match to start."), strcat(CCR_F2, ftos_decimals(players_needed, 0), CCR_F1)); InfoMessage(s); } else if(teamnagger && (ts_max - ts_min) >= teamnagger) @@ -187,12 +186,12 @@ void HUD_InfoMessages() if(ready_waiting) { if(ready_waiting_for_me) - s = sprintf(CCR(_("%sPress ^F2%s%s to end warmup")), blinkcolor, getcommandkey(_("ready"), "ready"), blinkcolor); + s = strcat(blinkcolor, sprintf(_("Press %s to end warmup"), strcat(CCR_F2, getcommandkey(_("ready"), "ready"), blinkcolor))); else s = strcat(CCR_F1, _("Waiting for others to ready up to end warmup...")); } else - s = strcat(CCR_F1, sprintf(CCR(_("Press ^F2%s^F1 to end warmup")), getcommandkey(_("ready"), "ready"))); + s = strcat(CCR_F1, sprintf(_("Press %s to end warmup"), strcat(CCR_F2, getcommandkey(_("ready"), "ready"), CCR_F1))); InfoMessage(s); } } @@ -207,7 +206,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(CCR(_(" Press ^F2%s%s to adjust")), getcommandkey(_("team selection"), "team_selection_show"), blinkcolor)); + s = strcat(s, sprintf(_(" Press %s to adjust"), strcat(CCR_F2, getcommandkey(_("team selection"), "team_selection_show"), blinkcolor))); fontsize *= 1.125; // perfect float draw_beginBoldFont(); InfoMessage(s); @@ -267,9 +266,9 @@ void HUD_InfoMessages() } else { - 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.")))); + InfoMessage(strcat(CCR_BG, sprintf(_("Press %s to show HUD options."), strcat(CCR_F2, "ESC", CCR_BG)))); + InfoMessage(sprintf(_("%s a panel for panel-specific options."), strcat(CCR_F2, "Doubleclick", CCR_BG))); + InfoMessage(sprintf(_("%s to disable collision testing, %s and"), strcat(CCR_F2, "CTRL", CCR_BG), strcat(CCR_F2, "SHIFT", CCR_BG))); + InfoMessage(sprintf(_("%s + %s for fine adjustments."), strcat(CCR_F2, "ALT", CCR_BG), strcat(CCR_F2, "ARROW KEYS", CCR_BG))); } } diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index a09427203..1db63558b 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -2463,13 +2463,13 @@ void Scoreboard_Draw() if (scoreboard_ui_enabled == 2) { if (scoreboard_selected_team) - str = strcat(CCR_BG, sprintf(CCR(_("Press ^F2%s^BG to join the selected team")), translate_key("SPACE"))); + str = strcat(CCR_BG, sprintf(_("Press %s to join the selected team"), strcat(CCR_F2, translate_key("SPACE"), CCR_BG))); else - str = strcat(CCR_BG, sprintf(CCR(_("Press ^F2%s^BG to auto-select a team and join")), translate_key("SPACE"))); + str = strcat(CCR_BG, sprintf(_("Press %s to auto-select a team and join"), strcat(CCR_F2, translate_key("SPACE"), CCR_BG))); 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 = strcat(CCR_BG, sprintf(CCR(_("Press ^F2%s ^BGto select a specific team")), translate_key("TAB"))); + str = strcat(CCR_BG, sprintf(_("Press %s to select a specific team"), strcat(CCR_F2, translate_key("TAB"), CCR_BG))); 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 @@ -2507,7 +2507,7 @@ void Scoreboard_Draw() if (campaign) str = ""; else - str = sprintf(CCR(_("^F5%d^BG/^F5%d ^BGplayers")), numplayers, srv_maxplayers ? srv_maxplayers : maxclients); + str = sprintf(_("%s/%s players"), strcat(CCR_F5, ftos_decimals(numplayers, 0), CCR_BG), strcat(CCR_F5, ftos_decimals((srv_maxplayers ? srv_maxplayers : maxclients), 0), CCR_BG)); 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 } @@ -2675,11 +2675,11 @@ void Scoreboard_Draw() if(race_speedaward) { name = textShortenToWidth(ColorTranslateRGB(race_speedaward_holder), namesize, hud_fontsize, stringwidth_colors); - str = sprintf(CCR(_("Speed award: %d%s ^BG(%s^BG)")), race_speedaward * conversion_factor, unit, name); - str = strcat(str, " / "); + str = sprintf(_("Speed award: %d%s %s"), race_speedaward * conversion_factor, unit, strcat(CCR_BG, "(", name, CCR_BG, ")")); + str = strcat(CCR_BG, str, " / "); } name = textShortenToWidth(ColorTranslateRGB(race_speedaward_alltimebest_holder), namesize, hud_fontsize, stringwidth_colors); - str = strcat(str, sprintf(CCR(_("All-time fastest: %d%s ^BG(%s^BG)")), race_speedaward_alltimebest * conversion_factor, unit, name)); + str = strcat(str, CCR_BG, sprintf(_("All-time fastest: %d%s %s"), race_speedaward_alltimebest * conversion_factor, unit, strcat(CCR_BG, "(", name, CCR_BG, ")"))); drawcolorcodedstring(pos, str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); pos.y += 1.25 * hud_fontsize.y; // line height + line spacing } @@ -2713,26 +2713,26 @@ 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 = strcat(CCR_F4, sprintf(CCR(_("Respawning in ^F2%s^F4...")), + str = strcat(CCR_F4, sprintf(_("Respawning in %s..."), strcat(CCR_F2, (autocvar_hud_panel_scoreboard_respawntime_decimals ? count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals) : count_seconds(ceil(respawn_time - time)) - ) + ), CCR_F4) )); } else if(time < respawn_time) { - str = sprintf(CCR(_("You are dead, wait ^F2%s^BG before respawning")), + str = strcat(CCR_BG, sprintf(_("You are dead, wait %s before respawning"), strcat(CCR_F2, (autocvar_hud_panel_scoreboard_respawntime_decimals ? count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals) : count_seconds(ceil(respawn_time - time)) - ) - ); + ), CCR_BG) + )); } else if(time >= respawn_time) - str = sprintf(CCR(_("You are dead, press ^F1%s^BG to respawn")), getcommandkey("jump", "+jump")); + str = strcat(CCR_BG, sprintf(_("You are dead, press %s to respawn"), strcat(CCR_F1, getcommandkey("jump", "+jump"), CCR_BG))); 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 dee1448dc..a53013fcc 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, strcat(CCR_F1, CCR(_("Name ^BGinstead of \"^F4Anonymous player^BG\" in stats")))); + strcpy(vote_called_vote, strcat(CCR_F1, sprintf(_("Name%s instead of \"%sAnonymous player%s\" in stats"), CCR_BG, CCR_F4, CCR_BG))); uid2name_dialog = 1; } @@ -118,9 +118,10 @@ void HUD_Vote() } mySize = newSize; - 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?")); + else + s = strcat(CCR_BG, _("A vote has been called for:")); 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) @@ -128,9 +129,9 @@ void HUD_Vote() 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 = strcat(CCR_C3, sprintf(CCR("%s ^BG(%d)"), getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount)); + s = sprintf("%s%s %s(%d)", CCR_C3, getcommandkey_forcename(_("Yes"), "vyes"), CCR_BG, 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 = strcat(CCR_C1, sprintf(CCR("%s ^BG(%d)"), getcommandkey_forcename(_("No"), "vno"), vote_nocount)); + s = sprintf("%s%s %s(%d)", CCR_C1, getcommandkey_forcename(_("No"), "vno"), CCR_BG, 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 a20652a6c..79bd162c3 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -557,22 +557,25 @@ void HUD_Weapons() switch(autocvar_hud_panel_weapons_label) { case 1: // weapon number - label_str = strcat(CCR_BG, ftos(weapon_id)); + label_str = ftos(weapon_id); break; case 2: // bind - label_str = strcat(CCR_BG, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id)))); + label_str = 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 = strtolower(it.m_name); break; default: // nothing break; } if(label_str != "") + { + label_str = strcat(CCR_BG, 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)) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c584a2892..f567f5a8f 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1426,7 +1426,7 @@ bool net_handle_ServerWelcome() string msg = strcat( CCR_F1, sprintf(_("Level %d:"), campaign_level), " ", CCR_BG, sprintf("%s\n\n", "_LEVEL_DESC"), - CCR_BG, sprintf(CCR(_("Press ^F2%s^BG to enter the game")), key)); + CCR_BG, sprintf(_("Press %s to enter the game"), strcat(CCR_F2, key, CCR_BG))); msg = MakeConsoleSafe(strreplace("\n", "\\n", msg)); string welcomedialog_args = strcat("CAMPAIGN ", itos(campaign_level), " \"", msg, "\"");