1 #include "dialog_multiplayer_create_mapinfo.qh"
2 #ifndef DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
3 #define DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
5 CLASS(XonoticMapInfoDialog, XonoticDialog)
6 METHOD(XonoticMapInfoDialog, fill, void(entity));
7 METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
8 ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
9 ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
10 ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
11 ATTRIB(XonoticMapInfoDialog, rows, float, 11)
12 ATTRIB(XonoticMapInfoDialog, columns, float, 10)
14 ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
15 ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
16 ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
17 ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
18 ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
20 ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
22 ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
23 ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
24 ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
25 ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
26 ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
27 ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
28 ENDCLASS(XonoticMapInfoDialog)
32 void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
34 me.currentMapIndex = i;
35 me.startButton.onClickEntity = mlb;
38 if(me.currentMapBSPName)
40 strunzone(me.currentMapBSPName);
41 strunzone(me.currentMapTitle);
42 strunzone(me.currentMapAuthor);
43 strunzone(me.currentMapDescription);
44 strunzone(me.currentMapPreviewImage);
46 me.currentMapBSPName = strzone(MapInfo_Map_bspname);
47 me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
48 me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
49 me.currentMapDescription = strzone(MapInfo_Map_description);
50 me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
52 me.frame.setText(me.frame, me.currentMapBSPName);
53 me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
54 me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
55 me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
56 if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0')
57 me.previewImage.src = "nopreview_map";
59 me.previewImage.src = me.currentMapPreviewImage;
61 for(i = 0; i < GameType_GetCount(); ++i)
64 e = me.(typeLabels[i]);
65 e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i));
70 void XonoticMapInfoDialog_fill(entity me)
77 me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
79 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
80 w = me.columns - me.currentColumn;
81 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
82 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
83 e.colorL = SKINCOLOR_MAPLIST_TITLE;
87 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
88 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
89 e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
93 me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
95 n = ceil(GameType_GetCount() / (me.rows - 6));
97 for(i = 0; i < GameType_GetCount(); ++i)
104 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
105 me.(typeLabels[i]) = e;
108 me.gotoRC(me, me.rows - 2, 0);
109 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
111 me.descriptionLabel = e;
113 me.gotoRC(me, me.rows - 1, 0);
116 me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
117 e.onClick = Dialog_Close;
118 e.onClickEntity = me;
119 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
120 me.startButton.onClick = MapList_LoadMap;
121 me.startButton.onClickEntity = NULL; // filled later