]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'DefaultUser/gametype_votescreen' into 'master'
authorMario <zacjardine@y7mail.com>
Thu, 1 Sep 2016 11:10:05 +0000 (11:10 +0000)
committerMario <zacjardine@y7mail.com>
Thu, 1 Sep 2016 11:10:05 +0000 (11:10 +0000)
Gametype Votescreen: Fix icons for custom gamemodes and add option for custom icons

See merge request !359

qcsrc/client/mapvoting.qc
qcsrc/server/mapvoting.qc

index b497b56bc6e2d6730f4e1079b9537b870250914c..7b07b680057196bb325bda90f4d4dd03fd8866a3 100644 (file)
@@ -608,12 +608,7 @@ void GameTypeVote_ReadOption(int i)
        mv_maps[i] = gt;
        mv_flags[i] = ReadByte();
 
-       string mv_picpath = sprintf("gfx/menu/%s/gametype_%s", autocvar_menu_skin, gt);
-       if(precache_pic(mv_picpath) == "")
-               mv_picpath = strcat("gfx/menu/default/gametype_", gt);
-       string pic = strzone(mv_picpath);
-       mv_pics[i] = pic;
-       mv_preview[i] = PreviewExists(pic);
+       string basetype = "";
 
        if ( mv_flags[i] & GTV_CUSTOM )
        {
@@ -622,6 +617,7 @@ void GameTypeVote_ReadOption(int i)
                        name = gt;
                mv_pk3[i] = strzone(name);
                mv_desc[i] = strzone(ReadString());
+               basetype = strzone(ReadString());
        }
        else
        {
@@ -629,6 +625,23 @@ void GameTypeVote_ReadOption(int i)
                mv_pk3[i] = strzone(MapInfo_Type_ToText(type));
                mv_desc[i] = MapInfo_Type_Description(type);
        }
+
+       string mv_picpath = sprintf("gfx/menu/%s/gametype_%s", autocvar_menu_skin, gt);
+       if(precache_pic(mv_picpath) == "")
+       {
+               mv_picpath = strcat("gfx/menu/default/gametype_", gt);
+               if(precache_pic(mv_picpath) == "")
+               {
+                       mv_picpath = sprintf("gfx/menu/%s/gametype_%s", autocvar_menu_skin, basetype);
+                       if(precache_pic(mv_picpath) == "")
+                       {
+                               mv_picpath = strcat("gfx/menu/default/gametype_", basetype);
+                       }
+               }
+       }
+       string pic = strzone(mv_picpath);
+       mv_pics[i] = pic;
+       mv_preview[i] = PreviewExists(pic);
 }
 
 void MapVote_Init()
index 7ffe4b934fbfa389bcac17b021855f97411d772c..9a1ed5c040fd6e8d55cc0c44df8204a1dbc78936 100644 (file)
@@ -336,6 +336,8 @@ void GameTypeVote_SendOption(int i)
                                strcat("sv_vote_gametype_",type_name,"_name")));
                        WriteString(MSG_ENTITY, cvar_string(
                                strcat("sv_vote_gametype_",type_name,"_description")));
+                       WriteString(MSG_ENTITY, cvar_string(
+                               strcat("sv_vote_gametype_",type_name,"_type")));
                }
        }
 }