]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c
gotoXY -> gotoRC (misnaming)
[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))
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)
40 {
41         me.currentMapIndex = i;
42         MapInfo_Get_ByID(i);
43
44         if(me.currentMapBSPName)
45         {
46                 strunzone(me.currentMapBSPName);
47                 strunzone(me.currentMapTitle);
48                 strunzone(me.currentMapAuthor);
49                 strunzone(me.currentMapDescription);
50                 strunzone(me.currentMapPreviewImage);
51                 strunzone(me.currentMapFeaturesText);
52         }
53         me.currentMapBSPName = strzone(MapInfo_Map_bspname);
54         me.currentMapTitle = strzone(MapInfo_Map_title);
55         me.currentMapAuthor = strzone(MapInfo_Map_author);
56         me.currentMapDescription = strzone(MapInfo_Map_description);
57         me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
58         me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
59
60         me.frame.setText(me.frame, me.currentMapBSPName);
61         me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
62         me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
63         me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
64         me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText);
65         me.previewImage.src = me.currentMapPreviewImage;
66
67         me.typeDeathmatchLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH);
68         me.typeTDMLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH);
69         me.typeLMSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS);
70         me.typeArenaLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA);
71         me.typeDominationLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DOMINATION);
72         me.typeRuneLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RUNEMATCH);
73         me.typeKeyHuntLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT);
74         me.typeCTFLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTF);
75         if(me.typeAssaultLabel)
76                 me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
77         if(me.typeOnslaughtLabel)
78                 me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
79 }
80 void fillNexuizMapInfoDialog(entity me)
81 {
82         entity e;
83         float w;
84         me.TR(me);
85                 me.TD(me, me.rows - 2, 3, e = makeNexuizImage(string_null, 4.0/3.0));
86                 me.previewImage = e;
87         me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
88         w = me.columns - me.currentColumn;
89                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Title:"));
90                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
91                         e.alpha = 1;
92                         e.colorL = SKINCOLOR_MAPLIST_TITLE;
93                         e.allowCut = 1;
94                         me.titleLabel = e;
95         me.TR(me);
96                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Author:"));
97                 me.TD(me, 1, w-1, e = makeNexuizTextLabel(0, ""));
98                         e.alpha = 1;
99                         e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
100                         e.allowCut = 1;
101                         me.authorLabel = e;
102         me.TR(me);
103                 me.TD(me, 1, w, e = makeNexuizTextLabel(0, ""));
104                         e.allowCut = 1;
105                         me.featuresLabel = e;
106         me.TR(me);
107                 me.TD(me, 1, w, e = makeNexuizTextLabel(0, "Game types:"));
108         me.TR(me);
109                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Deathmatch"));
110                         me.typeDeathmatchLabel = e;
111                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "TDM"));
112                         me.typeTDMLabel = e;
113                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "LMS"));
114                         me.typeLMSLabel = e;
115                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Arena"));
116                         me.typeArenaLabel = e;
117         me.TR(me);
118                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Rune"));
119                         me.typeRuneLabel = e;
120                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Domination"));
121                         me.typeDominationLabel = e;
122                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Key Hunt"));
123                         me.typeKeyHuntLabel = e;
124                 me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "CTF"));
125                         me.typeCTFLabel = e;
126         me.TR(me);
127                 if(cvar("developer"))
128                 {
129                         me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Assault"));
130                                 me.typeAssaultLabel = e;
131                         me.TD(me, 1, w/4, e = makeNexuizTextLabel(0, "Onslaught"));
132                                 me.typeOnslaughtLabel = e;
133                 }
134
135         me.gotoRC(me, me.rows - 2, 0);
136                 me.TD(me, 1, me.columns, e = makeNexuizTextLabel(0.5, ""));
137                         e.allowCut = 1;
138                         me.descriptionLabel = e;
139
140         me.gotoRC(me, me.rows - 1, 0);
141                 me.TD(me, 1, me.columns, e = makeNexuizButton("OK", '0 0 0'));
142                         e.onClick = Dialog_Close;
143                         e.onClickEntity = me;
144 }
145 #endif