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)
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)
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));
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, ""));
#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;
}
}
}
+
+// 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;
+}
+