]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
show ALL game types in the menu
authorRudolf Polzer <divverent@alientrap.org>
Wed, 12 Jan 2011 18:40:22 +0000 (19:40 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 12 Jan 2011 18:46:19 +0000 (19:46 +0100)
qcsrc/menu/xonotic/dialog_multiplayer_create.c
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c
qcsrc/menu/xonotic/gametypelist.c
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh

index fbe927b2f4ce492e7c2be7ffe11190fa46ab930a..03ef9f77fdd850e5d80f1acede34037d22a5e5d4 100644 (file)
@@ -109,14 +109,14 @@ void XonoticServerCreateTab_fill(entity me)
        me.TR(me);
                me.TD(me, me.rows - 4, 3, me.mapListBox);
        me.gotoRC(me, me.rows - 3, 3.5);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 1, e = makeXonoticButton("All", '0 0 0'));
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 1.125, e = makeXonoticButton("Select all", '0 0 0'));
                        e.onClick = MapList_All;
                        e.onClickEntity = me.mapListBox;
-               me.TD(me, 1, 1, e = makeXonoticButton("None", '0 0 0'));
+               me.TD(me, 1, 1.125, e = makeXonoticButton("Select none", '0 0 0'));
                        e.onClick = MapList_None;
                        e.onClickEntity = me.mapListBox;
-               me.TDempty(me, 0.5);
+               me.TDempty(me, 0.25);
 
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, e = makeXonoticButton("Start Multiplayer!", '0 0 0'));
index f3f620d7318bad17a6b00edc8ae5cac4e20f8c0f..2f2f5a2558c3a1c413b0e54dd4bcaa09d7344833 100644 (file)
@@ -4,8 +4,8 @@ CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
        METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity))
        ATTRIB(XonoticMapInfoDialog, title, string, "Map Information")
        ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
-       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 0.85)
-       ATTRIB(XonoticMapInfoDialog, rows, float, 9)
+       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
+       ATTRIB(XonoticMapInfoDialog, rows, float, 12)
        ATTRIB(XonoticMapInfoDialog, columns, float, 10)
 
        ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
@@ -14,22 +14,7 @@ CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
        ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
        ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
 
-       ATTRIB(XonoticMapInfoDialog, typeDeathmatchLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeTDMLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeLMSLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeArenaLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeRuneLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeDominationLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeKeyHuntLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeCTFLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeCALabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeAssaultLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeOnslaughtLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeRaceLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeCTSLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeNexballLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeFreezetagLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, typeKeepawayLabel, entity, NULL)
+       ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
 
        ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
        ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
@@ -71,29 +56,19 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
        me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
        me.previewImage.src = me.currentMapPreviewImage;
 
-       me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
-       me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
-       me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
-       me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
-       me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
-       me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
-       me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
-       me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
-       me.typeCALabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CA);
-       me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
-       me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
-       me.typeRaceLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE);
-       me.typeCTSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTS);
-       me.typeNexballLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_NEXBALL);
-       me.typeFreezetagLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_FREEZETAG);
-       me.typeKeepawayLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY);
+       for(i = 0; i < GameType_GetCount(); ++i)
+       {
+               entity e;
+               e = me.(typeLabels[i]);
+               e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i));
+       }
 
        MapInfo_ClearTemps();
 }
 void XonoticMapInfoDialog_fill(entity me)
 {
        entity e;
-       float w, wgt;
+       float w, wgt, i, n;
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
@@ -118,42 +93,20 @@ void XonoticMapInfoDialog_fill(entity me)
                        me.featuresLabel = e;
        me.TR(me);
                me.TD(me, 1, w, e = makeXonoticTextLabel(0, "Game types:"));
-       me.TR(me); wgt = (w-0.2)/5;
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "DM"));
-                       me.typeDeathmatchLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "TDM"));
-                       me.typeTDMLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "LMS"));
-                       me.typeLMSLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Arena"));
-                       me.typeArenaLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Domination"));
-                       me.typeDominationLabel = e;
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Key Hunt"));
-                       me.typeKeyHuntLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTF"));
-                       me.typeCTFLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CA"));
-                       me.typeCALabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Assault"));
-                       me.typeAssaultLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Onslaught"));
-                       me.typeOnslaughtLabel = e;
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Race"));
-                       me.typeRaceLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTS"));
-                       me.typeCTSLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Nexball"));
-                       me.typeNexballLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Freezetag"));
-                       me.typeFreezetagLabel = e;
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Keepaway"));
-                       me.typeKeepawayLabel = e;
+
+       
+       n = ceil(GameType_GetCount() / (me.rows - 6));
+       wgt = (w - 0.2) / n;
+       for(i = 0; i < GameType_GetCount(); ++i)
+       {
+               if(mod(i, n) == 0)
+               {
+                       me.TR(me);
+                       me.TDempty(me, 0.2);
+               }
+               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, GameType_GetName(i)));
+                       me.(typeLabels[i]) = e;
+       }
 
        me.gotoRC(me, me.rows - 2, 0);
                me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
index ca09a31e35b688e4840e1e0ea02d36fe624ff68e..ec21c65b97c4fd6b6be2466c96a922c5e89b3bef 100644 (file)
@@ -18,53 +18,6 @@ entity makeXonoticGametypeList();
 
 #ifdef IMPLEMENTATION
 
-#define GAMETYPES \
-       GAMETYPE(MAPINFO_TYPE_ARENA, "Arena") \
-       GAMETYPE(MAPINFO_TYPE_ASSAULT, "Assault") \
-       GAMETYPE(MAPINFO_TYPE_CTF, "Capture The Flag") \
-       GAMETYPE(MAPINFO_TYPE_CA, "Clan Arena") \
-       GAMETYPE(MAPINFO_TYPE_DEATHMATCH, "Deathmatch") \
-       GAMETYPE(MAPINFO_TYPE_DOMINATION, "Domination") \
-       GAMETYPE(MAPINFO_TYPE_FREEZETAG, "Freeze Tag") \
-       GAMETYPE(MAPINFO_TYPE_KEEPAWAY, "Keepaway") \
-       GAMETYPE(MAPINFO_TYPE_KEYHUNT, "Key Hunt") \
-       GAMETYPE(MAPINFO_TYPE_LMS, "Last Man Standing") \
-       GAMETYPE(MAPINFO_TYPE_NEXBALL, "Nexball") \
-       GAMETYPE(MAPINFO_TYPE_ONSLAUGHT, "Onslaught") \
-       GAMETYPE(MAPINFO_TYPE_RACE, "Race") \
-       GAMETYPE(MAPINFO_TYPE_CTS, "Race CTS") \
-       GAMETYPE(MAPINFO_TYPE_RUNEMATCH, "Runematch") \
-       GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH, "Team Deathmatch") \
-       /* nothing */
-
-float GameType_GetID(float cnt)
-{
-       float i;
-       i = 0;
-#define GAMETYPE(id,name) if(i++ == cnt) return id;
-       GAMETYPES
-#undef GAMETYPE
-       return 0;
-}
-string GameType_GetName(float cnt)
-{
-       float i;
-       i = 0;
-#define GAMETYPE(id,name) if(i++ == cnt) return name;
-       GAMETYPES
-#undef GAMETYPE
-       return "@!#%'n Tuba Throwing";
-}
-float GameType_GetCount()
-{
-       float i;
-       i = 0;
-#define GAMETYPE(id,name) ++i;
-       GAMETYPES
-#undef GAMETYPE
-       return i;
-}
-
 entity makeXonoticGametypeList(void)
 {
        entity me;
index f6ffa387c996624bb06acef3ea585a580423b803..91572fdf9d3904eccdcbfcb7de8d8f801ef250d2 100644 (file)
@@ -518,3 +518,52 @@ float updateCompression()
                }
        }
 }
+
+// note: include only those that should be in the menu!
+#define GAMETYPES \
+       GAMETYPE(MAPINFO_TYPE_ARENA, "Arena") \
+       GAMETYPE(MAPINFO_TYPE_ASSAULT, "Assault") \
+       GAMETYPE(MAPINFO_TYPE_CTF, "Capture The Flag") \
+       GAMETYPE(MAPINFO_TYPE_CA, "Clan Arena") \
+       GAMETYPE(MAPINFO_TYPE_DEATHMATCH, "Deathmatch") \
+       GAMETYPE(MAPINFO_TYPE_DOMINATION, "Domination") \
+       GAMETYPE(MAPINFO_TYPE_FREEZETAG, "Freeze Tag") \
+       GAMETYPE(MAPINFO_TYPE_KEEPAWAY, "Keepaway") \
+       GAMETYPE(MAPINFO_TYPE_KEYHUNT, "Key Hunt") \
+       GAMETYPE(MAPINFO_TYPE_LMS, "Last Man Standing") \
+       GAMETYPE(MAPINFO_TYPE_NEXBALL, "Nexball") \
+       GAMETYPE(MAPINFO_TYPE_ONSLAUGHT, "Onslaught") \
+       GAMETYPE(MAPINFO_TYPE_RACE, "Race") \
+       GAMETYPE(MAPINFO_TYPE_CTS, "Race CTS") \
+       GAMETYPE(MAPINFO_TYPE_RUNEMATCH, "Runematch") \
+       GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH, "Team Deathmatch") \
+       /* nothing */
+
+float GameType_GetID(float cnt)
+{
+       float i;
+       i = 0;
+#define GAMETYPE(id,name) if(i++ == cnt) return id;
+       GAMETYPES
+#undef GAMETYPE
+       return 0;
+}
+string GameType_GetName(float cnt)
+{
+       float i;
+       i = 0;
+#define GAMETYPE(id,name) if(i++ == cnt) return name;
+       GAMETYPES
+#undef GAMETYPE
+       return "@!#%'n Tuba Throwing";
+}
+float GameType_GetCount()
+{
+       float i;
+       i = 0;
+#define GAMETYPE(id,name) ++i;
+       GAMETYPES
+#undef GAMETYPE
+       return i;
+}
+
index 053c5073095f6c64a65f08166dbafd8ad2df46eb..99ede2a9b83167f187847f6a3880c11f986f2657 100644 (file)
@@ -34,3 +34,9 @@ float URI_GET_CURL_END = 9;
 void Curl_URI_Get_Callback(float id, float status, string data);
 
 void URI_Get_Callback(float id, float status, string data);
+
+// game type list box stuff (does not NEED to contain all game types, other
+// types stay available via console)
+float GameType_GetID(float cnt);
+string GameType_GetName(float cnt);
+float GameType_GetCount();