2 CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
3 METHOD(XonoticMapInfoDialog, fill, void(entity))
4 METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity))
5 ATTRIB(XonoticMapInfoDialog, title, string, "Map Information")
6 ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
7 ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 0.85)
8 ATTRIB(XonoticMapInfoDialog, rows, float, 9)
9 ATTRIB(XonoticMapInfoDialog, columns, float, 10)
11 ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
12 ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
13 ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
14 ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
15 ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
17 ATTRIB(XonoticMapInfoDialog, typeDeathmatchLabel, entity, NULL)
18 ATTRIB(XonoticMapInfoDialog, typeTDMLabel, entity, NULL)
19 ATTRIB(XonoticMapInfoDialog, typeLMSLabel, entity, NULL)
20 ATTRIB(XonoticMapInfoDialog, typeArenaLabel, entity, NULL)
21 ATTRIB(XonoticMapInfoDialog, typeRuneLabel, entity, NULL)
22 ATTRIB(XonoticMapInfoDialog, typeDominationLabel, entity, NULL)
23 ATTRIB(XonoticMapInfoDialog, typeKeyHuntLabel, entity, NULL)
24 ATTRIB(XonoticMapInfoDialog, typeCTFLabel, entity, NULL)
25 ATTRIB(XonoticMapInfoDialog, typeCALabel, entity, NULL)
26 ATTRIB(XonoticMapInfoDialog, typeAssaultLabel, entity, NULL)
27 ATTRIB(XonoticMapInfoDialog, typeOnslaughtLabel, entity, NULL)
28 ATTRIB(XonoticMapInfoDialog, typeRaceLabel, entity, NULL)
29 ATTRIB(XonoticMapInfoDialog, typeCTSLabel, entity, NULL)
30 ATTRIB(XonoticMapInfoDialog, typeNexballLabel, entity, NULL)
32 ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
33 ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
34 ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
35 ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
36 ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
37 ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
38 ATTRIB(XonoticMapInfoDialog, currentMapFeaturesText, string, string_null)
39 ENDCLASS(XonoticMapInfoDialog)
43 void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
45 me.currentMapIndex = i;
46 me.startButton.onClickEntity = mlb;
49 if(me.currentMapBSPName)
51 strunzone(me.currentMapBSPName);
52 strunzone(me.currentMapTitle);
53 strunzone(me.currentMapAuthor);
54 strunzone(me.currentMapDescription);
55 strunzone(me.currentMapPreviewImage);
56 strunzone(me.currentMapFeaturesText);
58 me.currentMapBSPName = strzone(MapInfo_Map_bspname);
59 me.currentMapTitle = strzone(MapInfo_Map_title);
60 me.currentMapAuthor = strzone(MapInfo_Map_author);
61 me.currentMapDescription = strzone(MapInfo_Map_description);
62 me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
63 me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
65 me.frame.setText(me.frame, me.currentMapBSPName);
66 me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
67 me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
68 me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
69 me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
70 me.previewImage.src = me.currentMapPreviewImage;
72 me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
73 me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
74 me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
75 me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
76 me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
77 me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
78 me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
79 me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
80 me.typeCALabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CA);
81 me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
82 me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
83 me.typeRaceLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE);
84 me.typeCTSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTS);
85 me.typeNexballLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_NEXBALL);
89 void XonoticMapInfoDialog_fill(entity me)
95 me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
97 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
98 w = me.columns - me.currentColumn;
99 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Title:"));
100 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
101 e.colorL = SKINCOLOR_MAPLIST_TITLE;
105 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Author:"));
106 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
107 e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
111 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Features:"));
112 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
114 me.featuresLabel = e;
116 me.TD(me, 1, w, e = makeXonoticTextLabel(0, "Game types:"));
117 me.TR(me); wgt = (w-0.2)/5;
119 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "DM"));
120 me.typeDeathmatchLabel = e;
121 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "TDM"));
123 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "LMS"));
125 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Arena"));
126 me.typeArenaLabel = e;
127 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Domination"));
128 me.typeDominationLabel = e;
131 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Key Hunt"));
132 me.typeKeyHuntLabel = e;
133 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTF"));
135 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CA"));
137 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Assault"));
138 me.typeAssaultLabel = e;
139 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Onslaught"));
140 me.typeOnslaughtLabel = e;
143 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Race"));
144 me.typeRaceLabel = e;
145 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTS"));
147 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Nexball"));
148 me.typeNexballLabel = e;
150 me.gotoRC(me, me.rows - 2, 0);
151 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
153 me.descriptionLabel = e;
155 me.gotoRC(me, me.rows - 1, 0);
158 me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton("Close", '0 0 0'));
159 e.onClick = Dialog_Close;
160 e.onClickEntity = me;
161 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton("Play", '0 0 0'));
162 me.startButton.onClick = MapList_LoadMap;
163 me.startButton.onClickEntity = NULL; // filled later