]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Merge remote-tracking branch 'origin/zykure/playerstats' into samual/combined_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.c
1 #ifdef INTERFACE
2 CLASS(MainWindow) EXTENDS(ModalController)
3         METHOD(MainWindow, configureMainWindow, void(entity))
4         METHOD(MainWindow, draw, void(entity))
5         ATTRIB(MainWindow, firstRunDialog, entity, NULL)
6         ATTRIB(MainWindow, advancedDialog, entity, NULL)
7         ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
8         ATTRIB(MainWindow, weaponsDialog, 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, modelDialog, entity, NULL)
17         ATTRIB(MainWindow, crosshairDialog, entity, NULL)
18         ATTRIB(MainWindow, hudDialog, entity, NULL)
19         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
20         ATTRIB(MainWindow, mainNexposee, entity, NULL)
21         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
22         ATTRIB(MainWindow, dialogToShow, entity, NULL)
23         ATTRIB(MainWindow, notificationDialog, 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 = spawnXonoticFirstRunDialog();
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 = spawnXonoticHUDExitDialog();
59         i.configureDialog(i);
60         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
61         
62         i = spawnXonoticHUDNotificationDialog();
63         i.configureDialog(i);
64         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
65         
66         i = spawnXonoticHUDAmmoDialog();
67         i.configureDialog(i);
68         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
69         
70         i = spawnXonoticHUDHealthArmorDialog();
71         i.configureDialog(i);
72         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
73         
74         i = spawnXonoticHUDChatDialog();
75         i.configureDialog(i);
76         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
77         
78         i = spawnXonoticHUDModIconsDialog();
79         i.configureDialog(i);
80         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
81         
82         i = spawnXonoticHUDPowerupsDialog();
83         i.configureDialog(i);
84         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
85         
86         i = spawnXonoticHUDPressedKeysDialog();
87         i.configureDialog(i);
88         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
89         
90         i = spawnXonoticHUDRaceTimerDialog();
91         i.configureDialog(i);
92         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93         
94         i = spawnXonoticHUDRadarDialog();
95         i.configureDialog(i);
96         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
97         
98         i = spawnXonoticHUDScoreDialog();
99         i.configureDialog(i);
100         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
101         
102         i = spawnXonoticHUDTimerDialog();
103         i.configureDialog(i);
104         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
105         
106         i = spawnXonoticHUDVoteDialog();
107         i.configureDialog(i);
108         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
109         
110         i = spawnXonoticHUDWeaponsDialog();
111         i.configureDialog(i);
112         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
113
114         i = spawnXonoticHUDEngineInfoDialog();
115         i.configureDialog(i);
116         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
117
118         i = spawnXonoticHUDInfoMessagesDialog();
119         i.configureDialog(i);
120         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
121         
122         i = spawnXonoticHUDPhysicsDialog();
123         i.configureDialog(i);
124         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
125         
126         me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
127         i.configureDialog(i);
128         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129
130         i = spawnXonoticHUDCenterprintDialog();
131         i.configureDialog(i);
132         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133         
134         
135         // dialogs used by settings
136         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
137         i.configureDialog(i);
138         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
139         
140         me.cvarsDialog = i = spawnXonoticCvarsDialog();
141         i.configureDialog(i);
142         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143         
144         
145         // dialog used by singleplayer
146         me.winnerDialog = i = spawnXonoticWinnerDialog();
147         i.configureDialog(i);
148         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149         
150         
151         // dialog used by multiplayer/join
152         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
153         i.configureDialog(i);
154         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155         
156         
157         // dialogs used by multiplayer/create
158         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
159         i.configureDialog(i);
160         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
161         
162         me.advancedDialog = i = spawnXonoticAdvancedDialog();
163         i.configureDialog(i);
164         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
165
166         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
167         i.configureDialog(i);
168         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169         
170
171         // dialogs used by multiplayer/player setup
172         me.crosshairDialog = i = spawnXonoticCrosshairDialog();
173         i.configureDialog(i);
174         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175         
176         me.hudDialog = i = spawnXonoticHUDDialog();
177         i.configureDialog(i);
178         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
179
180         me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
181         i.configureDialog(i);
182         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
183         
184         me.modelDialog = i = spawnXonoticModelDialog();
185         i.configureDialog(i);
186         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
187         
188         me.viewDialog = i = spawnXonoticViewDialog();
189         i.configureDialog(i);
190         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
191         
192         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
193         i.configureDialog(i);
194         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
195         
196         me.notificationDialog = i = spawnXonoticNotificationDialog();
197         i.configureDialog(i);
198         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
199
200         // mutator dialogs
201         i = spawnXonoticSandboxToolsDialog();
202         i.configureDialog(i);
203         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
204         
205         
206         // miscellaneous dialogs
207         i = spawnXonoticTeamSelectDialog();
208         i.configureDialog(i);
209         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
210         
211         
212         // main dialogs/windows
213         me.mainNexposee = n = spawnXonoticNexposee();
214         /*
215                 if(checkextension("DP_GECKO_SUPPORT"))
216                 {
217                         i = spawnXonoticNewsDialog();
218                         i.configureDialog(i);
219                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
220                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
221                 }
222         */
223                 i = spawnXonoticSingleplayerDialog();
224                 i.configureDialog(i);
225                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
226                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
227                 
228                 i = spawnXonoticMultiplayerDialog();
229                 i.configureDialog(i);
230                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
231                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
232
233                 i = spawnXonoticSettingsDialog();
234                 i.configureDialog(i);
235                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
236                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
237
238                 i = spawnXonoticCreditsDialog();
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
242                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
243
244                 i = spawnXonoticQuitDialog();
245                 i.configureDialog(i);
246                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
247                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
248                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
249                 
250         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
251         me.moveItemAfter(me, n, NULL);
252
253         me.initializeDialog(me, n);
254
255         if(cvar_string("_cl_name") == "Player")
256                 me.dialogToShow = me.firstRunDialog;
257 }
258 #endif
259
260 /* Click. The c-word is here so you can grep for it :-) */