1 #ifndef DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
2 #define DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
4 CLASS(XonoticMapInfoDialog, XonoticDialog)
5 METHOD(XonoticMapInfoDialog, fill, void(entity));
6 METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
7 ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
8 ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
9 ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
10 ATTRIB(XonoticMapInfoDialog, rows, float, 11)
11 ATTRIB(XonoticMapInfoDialog, columns, float, 10)
13 ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
14 ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
15 ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
16 ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
17 ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
19 ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
21 ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
22 ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
23 ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
24 ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
25 ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
26 ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
27 ENDCLASS(XonoticMapInfoDialog)
31 void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
33 me.currentMapIndex = i;
34 me.startButton.onClickEntity = mlb;
37 if(me.currentMapBSPName)
39 strunzone(me.currentMapBSPName);
40 strunzone(me.currentMapTitle);
41 strunzone(me.currentMapAuthor);
42 strunzone(me.currentMapDescription);
43 strunzone(me.currentMapPreviewImage);
45 me.currentMapBSPName = strzone(MapInfo_Map_bspname);
46 me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
47 me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
48 me.currentMapDescription = strzone(MapInfo_Map_description);
49 me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
51 me.frame.setText(me.frame, me.currentMapBSPName);
52 me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
53 me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
54 me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
55 if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0')
56 me.previewImage.src = "nopreview_map";
58 me.previewImage.src = me.currentMapPreviewImage;
60 for(i = 0; i < GameType_GetCount(); ++i)
63 e = me.(typeLabels[i]);
64 e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i));
69 void XonoticMapInfoDialog_fill(entity me)
76 me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
78 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
79 w = me.columns - me.currentColumn;
80 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
81 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
82 e.colorL = SKINCOLOR_MAPLIST_TITLE;
86 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
87 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
88 e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
92 me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
94 n = ceil(GameType_GetCount() / (me.rows - 6));
96 for(i = 0; i < GameType_GetCount(); ++i)
103 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
104 me.(typeLabels[i]) = e;
107 me.gotoRC(me, me.rows - 2, 0);
108 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
110 me.descriptionLabel = e;
112 me.gotoRC(me, me.rows - 1, 0);
115 me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
116 e.onClick = Dialog_Close;
117 e.onClickEntity = me;
118 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
119 me.startButton.onClick = MapList_LoadMap;
120 me.startButton.onClickEntity = NULL; // filled later