]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix custom gametype name not correctly displayed as scoreboard title and as gametype...
authorterencehill <piuntn@gmail.com>
Thu, 21 Mar 2024 17:32:47 +0000 (18:32 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 21 Mar 2024 17:32:47 +0000 (18:32 +0100)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/server/mapvoting.qc
qcsrc/server/scores.qc

index 35227ffab524c63bb077dfb624b4005f19ed4032..de5a0d80956e638bd3913546414c03471efe8bc9 100644 (file)
@@ -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();
index 90917341a29a67bbc69e9f0cc74a05328015cd0c..4bc3d8007f334b51f65b58f5364584ef82cb7435 100644 (file)
@@ -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, {
index 7929a450e078d0a9bc339b3f583858e7aae3ab6d..34c8fc63be8bc5f08459b62e043275e0eccf6cc5 100644 (file)
@@ -30,6 +30,7 @@ string minimapname;
 
 bool postinit;
 entity gametype;
+string gametype_custom_name;
 // temporary hack
 #define ISGAMETYPE(NAME) (gametype == MAPINFO_TYPE_##NAME)
 
index 995fd60029afdaf7a524a9ad0f28b74825aee91c..f10dcae583f2fd0b2413f481acc80db65de481c0 100644 (file)
@@ -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
index 5e1c8d9db567b67fd8f3635803cd6dd4266fbd25..2bdb8cdf056dc21f9a6e78a36188853bc85d6a69 100644 (file)
@@ -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));