]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.qc
Sort menu classes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.qc
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 CLASS(MainWindow, ModalController)
4         METHOD(MainWindow, configureMainWindow, void(entity))
5         METHOD(MainWindow, draw, void(entity))
6         ATTRIB(MainWindow, firstRunDialog, entity, NULL)
7         ATTRIB(MainWindow, advancedDialog, entity, NULL)
8         ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
9         ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
10         ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
11         ATTRIB(MainWindow, winnerDialog, entity, NULL)
12         ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
13         ATTRIB(MainWindow, cvarsDialog, entity, NULL)
14         ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
15         ATTRIB(MainWindow, viewDialog, entity, NULL)
16         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
17         ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
18         ATTRIB(MainWindow, mainNexposee, entity, NULL)
19         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
20         ATTRIB(MainWindow, dialogToShow, entity, NULL)
21         ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
22         ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
23         ATTRIB(MainWindow, resetDialog, entity, NULL)
24 ENDCLASS(MainWindow)
25 #endif
26
27 #ifdef IMPLEMENTATION
28 void MainWindow_draw(entity me)
29 {
30         SUPER(MainWindow).draw(me);
31
32         if(me.dialogToShow)
33         {
34                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
35                 me.dialogToShow = NULL;
36         }
37 }
38
39 void DemoButton_Click(entity me, entity other)
40 {
41         if(me.text == _("Do not press this button again!"))
42                 DialogOpenButton_Click(me, other);
43         else
44                 me.setText(me, _("Do not press this button again!"));
45 }
46
47 void MainWindow_configureMainWindow(entity me)
48 {
49         entity n, i;
50
51         // dialog run upon startup
52         me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
53         i.configureDialog(i);
54         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
55
56
57         // hud_configure dialogs
58         i = NEW(XonoticHUDExitDialog);
59         i.configureDialog(i);
60         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
61
62         i = NEW(XonoticHUDNotificationDialog);
63         i.configureDialog(i);
64         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
65
66         i = NEW(XonoticHUDAmmoDialog);
67         i.configureDialog(i);
68         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
69
70         i = NEW(XonoticHUDHealthArmorDialog);
71         i.configureDialog(i);
72         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
73
74         i = NEW(XonoticHUDChatDialog);
75         i.configureDialog(i);
76         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
77
78         i = NEW(XonoticHUDModIconsDialog);
79         i.configureDialog(i);
80         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
81
82         i = NEW(XonoticHUDPowerupsDialog);
83         i.configureDialog(i);
84         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
85
86         i = NEW(XonoticHUDPressedKeysDialog);
87         i.configureDialog(i);
88         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
89
90         i = NEW(XonoticHUDRaceTimerDialog);
91         i.configureDialog(i);
92         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93
94         i = NEW(XonoticHUDRadarDialog);
95         i.configureDialog(i);
96         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
97
98         i = NEW(XonoticHUDScoreDialog);
99         i.configureDialog(i);
100         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
101
102         i = NEW(XonoticHUDTimerDialog);
103         i.configureDialog(i);
104         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
105
106         i = NEW(XonoticHUDVoteDialog);
107         i.configureDialog(i);
108         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
109
110         i = NEW(XonoticHUDWeaponsDialog);
111         i.configureDialog(i);
112         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
113
114         i = NEW(XonoticHUDEngineInfoDialog);
115         i.configureDialog(i);
116         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
117
118         i = NEW(XonoticHUDInfoMessagesDialog);
119         i.configureDialog(i);
120         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
121
122         i = NEW(XonoticHUDPhysicsDialog);
123         i.configureDialog(i);
124         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
125
126         me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
127         i.configureDialog(i);
128         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129
130         i = NEW(XonoticHUDCenterprintDialog);
131         i.configureDialog(i);
132         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133
134         i = NEW(XonoticHUDBuffsDialog);
135         i.configureDialog(i);
136         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137
138
139         // dialogs used by settings
140         me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
141         i.configureDialog(i);
142         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143
144         me.cvarsDialog = i = NEW(XonoticCvarsDialog);
145         i.configureDialog(i);
146         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
147
148         me.resetDialog = i = NEW(XonoticResetDialog);
149         i.configureDialog(i);
150         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
151
152         me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
153         i.configureDialog(i);
154         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155
156         me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
157         i.configureDialog(i);
158         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
159
160
161         // dialog used by singleplayer
162         me.winnerDialog = i = NEW(XonoticWinnerDialog);
163         i.configureDialog(i);
164         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
165
166
167         // dialog used by multiplayer/join
168         me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
169         i.configureDialog(i);
170         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
171
172         me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
173         i.configureDialog(i);
174         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175
176         me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
177         i.configureDialog(i);
178         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
179
180
181         // dialogs used by multiplayer/create
182         me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
183         i.configureDialog(i);
184         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185
186         me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
187         i.configureDialog(i);
188         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
189
190         // mutator dialogs
191         i = NEW(XonoticSandboxToolsDialog);
192         i.configureDialog(i);
193         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
194
195
196         // miscellaneous dialogs
197         i = NEW(XonoticTeamSelectDialog);
198         i.configureDialog(i);
199         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
200
201         i = NEW(XonoticMonsterToolsDialog);
202         i.configureDialog(i);
203         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
204
205
206         // main dialogs/windows
207         me.mainNexposee = n = NEW(XonoticNexposee);
208         /*
209                 if(checkextension("DP_GECKO_SUPPORT"))
210                 {
211                         i = spawnXonoticNewsDialog();
212                         i.configureDialog(i);
213                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
214                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
215                 }
216         */
217                 i = NEW(XonoticSingleplayerDialog);
218                 i.configureDialog(i);
219                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
220                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
221
222                 i = NEW(XonoticMultiplayerDialog);
223                 i.configureDialog(i);
224                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
225                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
226
227                 i = NEW(XonoticSettingsDialog);
228                 i.configureDialog(i);
229                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
230                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
231
232                 i = NEW(XonoticCreditsDialog);
233                 i.configureDialog(i);
234                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
235                 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
236                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
237
238                 i = NEW(XonoticQuitDialog);
239                 i.configureDialog(i);
240                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
241                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
242                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
243
244         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
245         me.moveItemAfter(me, n, NULL);
246
247         me.initializeDialog(me, n);
248
249         if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
250                 me.dialogToShow = me.firstRunDialog;
251 }
252 #endif
253
254 /* Click. The c-word is here so you can grep for it :-) */