X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fdialog_multiplayer_create_mapinfo.c;h=8e4bc5a23cb153c815da6a06a48477b154229a06;hb=c5c6f773d18a9d4c103f27a41f66e92a81d6bb27;hp=f3f620d7318bad17a6b00edc8ae5cac4e20f8c0f;hpb=e78d58310d82e6cbd9543b1d06c1fd6ee8f195cd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c index f3f620d73..8e4bc5a23 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c @@ -2,10 +2,10 @@ CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog) METHOD(XonoticMapInfoDialog, fill, void(entity)) METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity)) - ATTRIB(XonoticMapInfoDialog, title, string, "Map Information") + 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) @@ -58,10 +43,10 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb) strunzone(me.currentMapFeaturesText); } me.currentMapBSPName = strzone(MapInfo_Map_bspname); - me.currentMapTitle = strzone(MapInfo_Map_title); - me.currentMapAuthor = strzone(MapInfo_Map_author); + me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title)); + me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author)); me.currentMapDescription = strzone(MapInfo_Map_description); - me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only"); + me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? _("Full item placement") : _("MinstaGib only")); me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname)); me.frame.setText(me.frame, me.currentMapBSPName); @@ -69,91 +54,61 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb) me.authorLabel.setText(me.authorLabel, me.currentMapAuthor); me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription); me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText); - me.previewImage.src = me.currentMapPreviewImage; + if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0') + me.previewImage.src = "nopreview_map"; + else + 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.previewImage = e; me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn); w = me.columns - me.currentColumn; - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Title:")); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:"))); me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, "")); e.colorL = SKINCOLOR_MAPLIST_TITLE; e.allowCut = 1; me.titleLabel = e; me.TR(me); - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Author:")); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:"))); me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, "")); e.colorL = SKINCOLOR_MAPLIST_AUTHOR; e.allowCut = 1; me.authorLabel = e; me.TR(me); - me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Features:")); + me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Features:"))); me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, "")); e.allowCut = 1; 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; + me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:"))); + + 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, MapInfo_Type_ToText(GameType_GetID(i)))); + me.(typeLabels[i]) = e; + } me.gotoRC(me, me.rows - 2, 0); me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, "")); @@ -163,10 +118,10 @@ void XonoticMapInfoDialog_fill(entity me) me.gotoRC(me, me.rows - 1, 0); me.TDempty(me, 0.5); - me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton("Close", '0 0 0')); + me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0')); e.onClick = Dialog_Close; e.onClickEntity = me; - me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton("Play", '0 0 0')); + me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0')); me.startButton.onClick = MapList_LoadMap; me.startButton.onClickEntity = NULL; // filled later }