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)
31 ATTRIB(XonoticMapInfoDialog, typeFreezetagLabel, entity, NULL)
32 ATTRIB(XonoticMapInfoDialog, typeKeepawayLabel, entity, NULL)
34 ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
35 ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
36 ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
37 ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
38 ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
39 ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
40 ATTRIB(XonoticMapInfoDialog, currentMapFeaturesText, string, string_null)
41 ENDCLASS(XonoticMapInfoDialog)
45 void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
47 me.currentMapIndex = i;
48 me.startButton.onClickEntity = mlb;
51 if(me.currentMapBSPName)
53 strunzone(me.currentMapBSPName);
54 strunzone(me.currentMapTitle);
55 strunzone(me.currentMapAuthor);
56 strunzone(me.currentMapDescription);
57 strunzone(me.currentMapPreviewImage);
58 strunzone(me.currentMapFeaturesText);
60 me.currentMapBSPName = strzone(MapInfo_Map_bspname);
61 me.currentMapTitle = strzone(MapInfo_Map_title);
62 me.currentMapAuthor = strzone(MapInfo_Map_author);
63 me.currentMapDescription = strzone(MapInfo_Map_description);
64 me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
65 me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
67 me.frame.setText(me.frame, me.currentMapBSPName);
68 me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
69 me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
70 me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
71 me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
72 me.previewImage.src = me.currentMapPreviewImage;
74 me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
75 me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
76 me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
77 me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
78 me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
79 me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
80 me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
81 me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
82 me.typeCALabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CA);
83 me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
84 me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
85 me.typeRaceLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE);
86 me.typeCTSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTS);
87 me.typeNexballLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_NEXBALL);
88 me.typeFreezetagLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_FREEZETAG);
89 me.typeKeepawayLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY);
93 void XonoticMapInfoDialog_fill(entity me)
99 me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
101 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
102 w = me.columns - me.currentColumn;
103 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Title:"));
104 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
105 e.colorL = SKINCOLOR_MAPLIST_TITLE;
109 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Author:"));
110 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
111 e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
115 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Features:"));
116 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
118 me.featuresLabel = e;
120 me.TD(me, 1, w, e = makeXonoticTextLabel(0, "Game types:"));
121 me.TR(me); wgt = (w-0.2)/5;
123 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "DM"));
124 me.typeDeathmatchLabel = e;
125 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "TDM"));
127 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "LMS"));
129 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Arena"));
130 me.typeArenaLabel = e;
131 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Domination"));
132 me.typeDominationLabel = e;
135 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Key Hunt"));
136 me.typeKeyHuntLabel = e;
137 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTF"));
139 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CA"));
141 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Assault"));
142 me.typeAssaultLabel = e;
143 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Onslaught"));
144 me.typeOnslaughtLabel = e;
147 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Race"));
148 me.typeRaceLabel = e;
149 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "CTS"));
151 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Nexball"));
152 me.typeNexballLabel = e;
153 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Freezetag"));
154 me.typeFreezetagLabel = e;
155 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, "Keepaway"));
156 me.typeKeepawayLabel = e;
158 me.gotoRC(me, me.rows - 2, 0);
159 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
161 me.descriptionLabel = e;
163 me.gotoRC(me, me.rows - 1, 0);
166 me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton("Close", '0 0 0'));
167 e.onClick = Dialog_Close;
168 e.onClickEntity = me;
169 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton("Play", '0 0 0'));
170 me.startButton.onClick = MapList_LoadMap;
171 me.startButton.onClickEntity = NULL; // filled later