]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c
rename the OK button to Close in the map info dialog
[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         ATTRIB(NexuizMapInfoDialog, typeRaceLabel, entity, NULL)
28         ATTRIB(NexuizMapInfoDialog, typeCTSLabel, entity, NULL)
29         ATTRIB(NexuizMapInfoDialog, typeNexballLabel, entity, NULL)
30
31         ATTRIB(NexuizMapInfoDialog, currentMapIndex, float, 0)
32         ATTRIB(NexuizMapInfoDialog, currentMapBSPName, string, string_null)
33         ATTRIB(NexuizMapInfoDialog, currentMapTitle, string, string_null)
34         ATTRIB(NexuizMapInfoDialog, currentMapAuthor, string, string_null)
35         ATTRIB(NexuizMapInfoDialog, currentMapDescription, string, string_null)
36         ATTRIB(NexuizMapInfoDialog, currentMapPreviewImage, string, string_null)
37         ATTRIB(NexuizMapInfoDialog, currentMapFeaturesText, string, string_null)
38 ENDCLASS(NexuizMapInfoDialog)
39 #endif
40
41 #ifdef IMPLEMENTATION
42 void loadMapInfoNexuizMapInfoDialog(entity me, float i, entity mlb)
43 {
44         me.currentMapIndex = i;
45         me.startButton.onClickEntity = mlb;
46         MapInfo_Get_ByID(i);
47
48         if(me.currentMapBSPName)
49         {
50                 strunzone(me.currentMapBSPName);
51                 strunzone(me.currentMapTitle);
52                 strunzone(me.currentMapAuthor);
53                 strunzone(me.currentMapDescription);
54                 strunzone(me.currentMapPreviewImage);
55                 strunzone(me.currentMapFeaturesText);
56         }
57         me.currentMapBSPName = strzone(MapInfo_Map_bspname);
58         me.currentMapTitle = strzone(MapInfo_Map_title);
59         me.currentMapAuthor = strzone(MapInfo_Map_author);
60         me.currentMapDescription = strzone(MapInfo_Map_description);
61         me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
62         me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
63
64         me.frame.setText(me.frame, me.currentMapBSPName);
65         me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
66         me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
67         me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
68         me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
69         me.previewImage.src = me.currentMapPreviewImage;
70
71         me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
72         me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
73         me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
74         me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
75         me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
76         me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
77         me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
78         me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
79         me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
80         me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
81         me.typeRaceLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE);
82         me.typeCTSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTS);
83         me.typeNexballLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_NEXBALL);
84
85         MapInfo_ClearTemps();
86 }
87 void fillNexuizMapInfoDialog(entity me)
88 {
89         entity e;
90         float w, wgt;
91         me.TR(me);
92                 me.TDempty(me, 0.2);
93                 me.TD(me, me.rows - 2, 3, e = makeNexuizImage(string_null, 4.0/3.0));
94                 me.previewImage = e;
95         me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
96         w = me.columns - me.currentColumn;
97                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Title:"));
98                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
99                         e.colorL = SKINCOLOR_MAPLIST_TITLE;
100                         e.allowCut = 1;
101                         me.titleLabel = e;
102         me.TR(me);
103                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Author:"));
104                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
105                         e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
106                         e.allowCut = 1;
107                         me.authorLabel = e;
108         me.TR(me);
109                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Features:"));
110                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
111                         e.allowCut = 1;
112                         me.featuresLabel = e;
113         me.TR(me);
114                 me.TD(me, 1, w, e = makeNexuizTextLabel(0, "Game types:"));
115         me.TR(me); wgt = (w-0.2)/5;
116                 me.TDempty(me, 0.2);
117                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "DM"));
118                         me.typeDeathmatchLabel = e;
119                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "TDM"));
120                         me.typeTDMLabel = e;
121                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "LMS"));
122                         me.typeLMSLabel = e;
123                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Arena"));
124                         me.typeArenaLabel = e;
125                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Rune"));
126                         me.typeRuneLabel = e;
127         me.TR(me);
128                 me.TDempty(me, 0.2);
129                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Domination"));
130                         me.typeDominationLabel = e;
131                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Key Hunt"));
132                         me.typeKeyHuntLabel = e;
133                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "CTF"));
134                         me.typeCTFLabel = e;
135                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Assault"));
136                         me.typeAssaultLabel = e;
137                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Onslaught"));
138                         me.typeOnslaughtLabel = e;
139         me.TR(me);
140                 me.TDempty(me, 0.2);
141                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Race"));
142                         me.typeRaceLabel = e;
143                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "CTS"));
144                         me.typeCTSLabel = e;
145                 me.TD(me, 1, wgt, e = makeNexuizTextLabel(0, "Nexball"));
146                         me.typeNexballLabel = e;
147
148         me.gotoRC(me, me.rows - 2, 0);
149                 me.TD(me, 1, me.columns, e = makeNexuizTextLabel(0.5, ""));
150                         e.allowCut = 1;
151                         me.descriptionLabel = e;
152
153         me.gotoRC(me, me.rows - 1, 0);
154                 me.TDempty(me, 0.5);
155
156                 me.TD(me, 1, me.columns - 5.5, e = makeNexuizButton("Close", '0 0 0'));
157                         e.onClick = Dialog_Close;
158                         e.onClickEntity = me;
159                 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeNexuizButton("Play", '0 0 0'));
160                         me.startButton.onClick = MapList_LoadMap;
161                         me.startButton.onClickEntity = NULL; // filled later
162                 me.TDempty(me, 0.5);
163 }
164 #endif