]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Merge remote-tracking branch 'origin/master' 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, mapInfoDialog, entity, NULL)
9         ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
10         ATTRIB(MainWindow, winnerDialog, entity, NULL)
11         ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
12         ATTRIB(MainWindow, cvarsDialog, entity, NULL)
13         ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
14         ATTRIB(MainWindow, viewDialog, entity, NULL)
15         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
16         ATTRIB(MainWindow, mainNexposee, entity, NULL)
17         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
18         ATTRIB(MainWindow, dialogToShow, entity, NULL)
19         ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
20         ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
21 ENDCLASS(MainWindow)
22 #endif
23
24 #ifdef IMPLEMENTATION
25 void MainWindow_draw(entity me)
26 {
27         SUPER(MainWindow).draw(me);
28
29         if(me.dialogToShow)
30         {
31                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
32                 me.dialogToShow = NULL;
33         }
34 }
35
36 void DemoButton_Click(entity me, entity other)
37 {
38         if(me.text == _("Do not press this button again!"))
39                 DialogOpenButton_Click(me, other);
40         else
41                 me.setText(me, _("Do not press this button again!"));
42 }
43
44 void MainWindow_configureMainWindow(entity me)
45 {
46         entity n, i;
47
48         // dialog run upon startup
49         me.firstRunDialog = i = spawnXonoticFirstRunDialog();
50         i.configureDialog(i);
51         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
52
53
54         // hud_configure dialogs
55         i = spawnXonoticHUDExitDialog();
56         i.configureDialog(i);
57         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
58
59         i = spawnXonoticHUDNotificationDialog();
60         i.configureDialog(i);
61         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
62
63         i = spawnXonoticHUDAmmoDialog();
64         i.configureDialog(i);
65         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
66
67         i = spawnXonoticHUDHealthArmorDialog();
68         i.configureDialog(i);
69         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
70
71         i = spawnXonoticHUDChatDialog();
72         i.configureDialog(i);
73         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
74
75         i = spawnXonoticHUDModIconsDialog();
76         i.configureDialog(i);
77         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
78
79         i = spawnXonoticHUDPowerupsDialog();
80         i.configureDialog(i);
81         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
82
83         i = spawnXonoticHUDPressedKeysDialog();
84         i.configureDialog(i);
85         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
86
87         i = spawnXonoticHUDRaceTimerDialog();
88         i.configureDialog(i);
89         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
90
91         i = spawnXonoticHUDRadarDialog();
92         i.configureDialog(i);
93         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
94
95         i = spawnXonoticHUDScoreDialog();
96         i.configureDialog(i);
97         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
98
99         i = spawnXonoticHUDTimerDialog();
100         i.configureDialog(i);
101         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
102
103         i = spawnXonoticHUDVoteDialog();
104         i.configureDialog(i);
105         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
106
107         i = spawnXonoticHUDWeaponsDialog();
108         i.configureDialog(i);
109         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
110
111         i = spawnXonoticHUDEngineInfoDialog();
112         i.configureDialog(i);
113         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
114
115         i = spawnXonoticHUDInfoMessagesDialog();
116         i.configureDialog(i);
117         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
118         
119         i = spawnXonoticHUDPhysicsDialog();
120         i.configureDialog(i);
121         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
122         
123         me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
124         i.configureDialog(i);
125         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
126
127         i = spawnXonoticHUDCenterprintDialog();
128         i.configureDialog(i);
129         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
130
131
132         // dialogs used by settings
133         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
134         i.configureDialog(i);
135         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
136
137         me.cvarsDialog = i = spawnXonoticCvarsDialog();
138         i.configureDialog(i);
139         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
140
141         me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
142         i.configureDialog(i);
143         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
144
145
146         // dialog used by singleplayer
147         me.winnerDialog = i = spawnXonoticWinnerDialog();
148         i.configureDialog(i);
149         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
150
151
152         // dialog used by multiplayer/join
153         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
154         i.configureDialog(i);
155         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
156         
157         me.demostartconfirmDialog = i = spawnXonoticDemoStartConfirmDialog();
158         i.configureDialog(i);
159         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
160
161         me.demotimeconfirmDialog = i = spawnXonoticDemoTimeConfirmDialog();
162         i.configureDialog(i);
163         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
164
165
166         // dialogs used by multiplayer/create
167         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
168         i.configureDialog(i);
169         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
170
171         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
172         i.configureDialog(i);
173         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
174
175         // mutator dialogs
176         i = spawnXonoticSandboxToolsDialog();
177         i.configureDialog(i);
178         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
179
180
181         // miscellaneous dialogs
182         i = spawnXonoticTeamSelectDialog();
183         i.configureDialog(i);
184         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185
186         i = spawnXonoticMonsterToolsDialog();
187         i.configureDialog(i);
188         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
189
190
191         // main dialogs/windows
192         me.mainNexposee = n = spawnXonoticNexposee();
193         /*
194                 if(checkextension("DP_GECKO_SUPPORT"))
195                 {
196                         i = spawnXonoticNewsDialog();
197                         i.configureDialog(i);
198                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
199                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
200                 }
201         */
202                 i = spawnXonoticSingleplayerDialog();
203                 i.configureDialog(i);
204                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
205                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
206
207                 i = spawnXonoticMultiplayerDialog();
208                 i.configureDialog(i);
209                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
210                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
211
212                 i = spawnXonoticSettingsDialog();
213                 i.configureDialog(i);
214                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
215                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
216
217                 i = spawnXonoticCreditsDialog();
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
221                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
222
223                 i = spawnXonoticQuitDialog();
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_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
227                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
228
229         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
230         me.moveItemAfter(me, n, NULL);
231
232         me.initializeDialog(me, n);
233
234         if(cvar_string("_cl_name") == "Player")
235                 me.dialogToShow = me.firstRunDialog;
236 }
237 #endif
238
239 /* Click. The c-word is here so you can grep for it :-) */