]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c
Show if a map has Onslaught support in mapinfo dialog (not only if developer 1)
[divverent/nexuiz.git] / data / qcsrc / menu / nexuiz / dialog_multiplayer_create_mapinfo.c
1 #ifdef INTERFACE
2 CLASS(NexuizMapInfoDialog) EXTENDS(NexuizDialog)
3         METHOD(NexuizMapInfoDialog, fill, void(entity))
4         METHOD(NexuizMapInfoDialog, loadMapInfo, void(entity, float, entity))
5         ATTRIB(NexuizMapInfoDialog, title, string, "Map Information")
6         ATTRIB(NexuizMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
7         ATTRIB(NexuizMapInfoDialog, intendedWidth, float, 0.85)
8         ATTRIB(NexuizMapInfoDialog, rows, float, 9)
9         ATTRIB(NexuizMapInfoDialog, columns, float, 10)
10
11         ATTRIB(NexuizMapInfoDialog, previewImage, entity, NULL)
12         ATTRIB(NexuizMapInfoDialog, titleLabel, entity, NULL)
13         ATTRIB(NexuizMapInfoDialog, authorLabel, entity, NULL)
14         ATTRIB(NexuizMapInfoDialog, descriptionLabel, entity, NULL)
15         ATTRIB(NexuizMapInfoDialog, featuresLabel, entity, NULL)
16
17         ATTRIB(NexuizMapInfoDialog, typeDeathmatchLabel, entity, NULL)
18         ATTRIB(NexuizMapInfoDialog, typeTDMLabel, entity, NULL)
19         ATTRIB(NexuizMapInfoDialog, typeLMSLabel, entity, NULL)
20         ATTRIB(NexuizMapInfoDialog, typeArenaLabel, entity, NULL)
21         ATTRIB(NexuizMapInfoDialog, typeRuneLabel, entity, NULL)
22         ATTRIB(NexuizMapInfoDialog, typeDominationLabel, entity, NULL)
23         ATTRIB(NexuizMapInfoDialog, typeKeyHuntLabel, entity, NULL)
24         ATTRIB(NexuizMapInfoDialog, typeCTFLabel, entity, NULL)
25         ATTRIB(NexuizMapInfoDialog, typeAssaultLabel, entity, NULL)
26         ATTRIB(NexuizMapInfoDialog, typeOnslaughtLabel, entity, NULL)
27
28         ATTRIB(NexuizMapInfoDialog, currentMapIndex, float, 0)
29         ATTRIB(NexuizMapInfoDialog, currentMapBSPName, string, string_null)
30         ATTRIB(NexuizMapInfoDialog, currentMapTitle, string, string_null)
31         ATTRIB(NexuizMapInfoDialog, currentMapAuthor, string, string_null)
32         ATTRIB(NexuizMapInfoDialog, currentMapDescription, string, string_null)
33         ATTRIB(NexuizMapInfoDialog, currentMapPreviewImage, string, string_null)
34         ATTRIB(NexuizMapInfoDialog, currentMapFeaturesText, string, string_null)
35 ENDCLASS(NexuizMapInfoDialog)
36 #endif
37
38 #ifdef IMPLEMENTATION
39 void loadMapInfoNexuizMapInfoDialog(entity me, float i, entity mlb)
40 {
41         me.currentMapIndex = i;
42         me.startButton.onClickEntity = mlb;
43         MapInfo_Get_ByID(i);
44
45         if(me.currentMapBSPName)
46         {
47                 strunzone(me.currentMapBSPName);
48                 strunzone(me.currentMapTitle);
49                 strunzone(me.currentMapAuthor);
50                 strunzone(me.currentMapDescription);
51                 strunzone(me.currentMapPreviewImage);
52                 strunzone(me.currentMapFeaturesText);
53         }
54         me.currentMapBSPName = strzone(MapInfo_Map_bspname);
55         me.currentMapTitle = strzone(MapInfo_Map_title);
56         me.currentMapAuthor = strzone(MapInfo_Map_author);
57         me.currentMapDescription = strzone(MapInfo_Map_description);
58         me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
59         me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
60
61         me.frame.setText(me.frame, me.currentMapBSPName);
62         me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
63         me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
64         me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
65         me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
66         me.previewImage.src = me.currentMapPreviewImage;
67
68         me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
69         me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
70         me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
71         me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
72         me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
73         me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
74         me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
75         me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
76         if(me.typeAssaultLabel)
77                 me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
78         if(me.typeOnslaughtLabel)
79                 me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
80
81         MapInfo_ClearTemps();
82 }
83 void fillNexuizMapInfoDialog(entity me)
84 {
85         entity e;
86         float w;
87         me.TR(me);
88                 me.TD(me, me.rows - 2, 3, e = makeNexuizImage(string_null, 4.0/3.0));
89                 me.previewImage = e;
90         me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
91         w = me.columns - me.currentColumn;
92                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Title:"));
93                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
94                         e.alpha = 1;
95                         e.colorL = SKINCOLOR_MAPLIST_TITLE;
96                         e.allowCut = 1;
97                         me.titleLabel = e;
98         me.TR(me);
99                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Author:"));
100                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
101                         e.alpha = 1;
102                         e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
103                         e.allowCut = 1;
104                         me.authorLabel = e;
105         me.TR(me);
106                 me.TD(me, 1, w, e = makeNexuizTextLabel(0, ""));
107                         e.allowCut = 1;
108                         me.featuresLabel = e;
109         me.TR(me);
110                 me.TD(me, 1, w, e = makeNexuizTextLabel(0, "Game types:"));
111         me.TR(me);
112                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Deathmatch"));
113                         me.typeDeathmatchLabel = e;
114                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "TDM"));
115                         me.typeTDMLabel = e;
116                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "LMS"));
117                         me.typeLMSLabel = e;
118                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Arena"));
119                         me.typeArenaLabel = e;
120         me.TR(me);
121                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Rune"));
122                         me.typeRuneLabel = e;
123                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Domination"));
124                         me.typeDominationLabel = e;
125                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Key Hunt"));
126                         me.typeKeyHuntLabel = e;
127                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "CTF"));
128                         me.typeCTFLabel = e;
129         me.TR(me);
130                 if(cvar("developer"))
131                 {
132                         me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Assault"));
133                                 me.typeAssaultLabel = e;
134                 }
135                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Onslaught"));
136                         me.typeOnslaughtLabel = e;
137
138         me.gotoRC(me, me.rows - 2, 0);
139                 me.TD(me, 1, me.columns, e = makeNexuizTextLabel(0.5, ""));
140                         e.allowCut = 1;
141                         me.descriptionLabel = e;
142
143         me.gotoRC(me, me.rows - 1, 0);
144                 me.TDempty(me, 0.5);
145
146                 me.TD(me, 1, me.columns - 5.5, e = makeNexuizButton("OK", '0 0 0'));
147                         e.onClick = Dialog_Close;
148                         e.onClickEntity = me;
149                 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeNexuizButton("Play", '0 0 0'));
150                         me.startButton.onClick = MapList_LoadMap;
151                         me.startButton.onClickEntity = NULL; // filled later
152                 me.TDempty(me, 0.5);
153 }
154 #endif