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