From 297a8c4a5b3580f26234fb70333c742088cfc069 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 21 Mar 2024 18:32:47 +0100 Subject: [PATCH] Fix custom gametype name not correctly displayed as scoreboard title and as gametype winner in the map vote --- qcsrc/client/hud/panel/scoreboard.qc | 2 ++ qcsrc/client/main.qc | 3 +++ qcsrc/client/main.qh | 1 + qcsrc/server/mapvoting.qc | 7 ++++++- qcsrc/server/scores.qc | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 35227ffab..de5a0d809 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -2326,6 +2326,8 @@ void Scoreboard_Draw() // Game Info: Game Type if (scoreboard_ui_enabled == 2) str = _("Team Selection"); + else if (gametype_custom_name != "") + str = gametype_custom_name; else str = MapInfo_Type_ToText(gametype); draw_beginBoldFont(); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 90917341a..4bc3d8007 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -198,6 +198,8 @@ void Shutdown() localcmd("\n-button12\n"); + strfree(gametype_custom_name); + deactivate_minigame(); HUD_MinigameMenu_Close(NULL, NULL, NULL); @@ -1089,6 +1091,7 @@ NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew) { make_pure(this); gametype = ReadRegistered(Gametypes); + strcpy(gametype_custom_name, ReadString()); teamplay = _MapInfo_GetTeamPlayBool(gametype); HUD_ModIcons_SetFunc(); FOREACH(Scores, true, { diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 7929a450e..34c8fc63b 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -30,6 +30,7 @@ string minimapname; bool postinit; entity gametype; +string gametype_custom_name; // temporary hack #define ISGAMETYPE(NAME) (gametype == MAPINFO_TYPE_##NAME) diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index 995fd6002..f10dcae58 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -399,7 +399,12 @@ bool MapVote_SendEntity(entity this, entity to, int sf) { // map vote but gametype has been chosen via voting screen WriteByte(MSG_ENTITY, BIT(1)); // gametypevote_flags - WriteString(MSG_ENTITY, MapInfo_Type_ToText(voted_gametype)); + string voted_gametype_name; + if (voted_gametype_string == MapInfo_Type_ToString(voted_gametype)) + voted_gametype_name = MapInfo_Type_ToText(voted_gametype); + else + voted_gametype_name = cvar_string(strcat("sv_vote_gametype_", voted_gametype_string, "_name")); + WriteString(MSG_ENTITY, voted_gametype_name); } else WriteByte(MSG_ENTITY, 0); // map vote diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 5e1c8d9db..2bdb8cdf0 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -208,6 +208,10 @@ bool ScoreInfo_SendEntity(entity this, entity to, int sf) float i; WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO); WriteRegistered(Gametypes, MSG_ENTITY, MapInfo_LoadedGametype); + string gt_name = ""; + if (gametype_custom_string != "") + gt_name = cvar_string(strcat("sv_vote_gametype_", gametype_custom_string, "_name")); + WriteString(MSG_ENTITY, gt_name); FOREACH(Scores, true, { WriteString(MSG_ENTITY, scores_label(it)); WriteByte(MSG_ENTITY, scores_flags(it)); -- 2.39.2