]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Merge remote-tracking branch 'remotes/origin/Mario/weapons' into Mario/weapons
[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, viewDialog, entity, NULL)
15         ATTRIB(MainWindow, modelDialog, entity, NULL)
16         ATTRIB(MainWindow, crosshairDialog, entity, NULL)
17         ATTRIB(MainWindow, hudDialog, entity, NULL)
18         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
19         ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
20         ATTRIB(MainWindow, mainNexposee, entity, NULL)
21         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
22         ATTRIB(MainWindow, dialogToShow, entity, NULL)
23 ENDCLASS(MainWindow)
24 #endif
25
26 #ifdef IMPLEMENTATION
27 void MainWindow_draw(entity me)
28 {
29         SUPER(MainWindow).draw(me);
30
31         if(me.dialogToShow)
32         {
33                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
34                 me.dialogToShow = NULL;
35         }
36 }
37
38 void DemoButton_Click(entity me, entity other)
39 {
40         if(me.text == _("Do not press this button again!"))
41                 DialogOpenButton_Click(me, other);
42         else
43                 me.setText(me, _("Do not press this button again!"));
44 }
45
46 void MainWindow_configureMainWindow(entity me)
47 {
48         entity n, i;
49
50         // dialog run upon startup
51         me.firstRunDialog = i = spawnXonoticFirstRunDialog();
52         i.configureDialog(i);
53         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
54
55
56         // hud_configure dialogs
57         i = spawnXonoticHUDExitDialog();
58         i.configureDialog(i);
59         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
60
61         i = spawnXonoticHUDNotificationDialog();
62         i.configureDialog(i);
63         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
64
65         i = spawnXonoticHUDAmmoDialog();
66         i.configureDialog(i);
67         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
68
69         i = spawnXonoticHUDHealthArmorDialog();
70         i.configureDialog(i);
71         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
72
73         i = spawnXonoticHUDChatDialog();
74         i.configureDialog(i);
75         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
76
77         i = spawnXonoticHUDModIconsDialog();
78         i.configureDialog(i);
79         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
80
81         i = spawnXonoticHUDPowerupsDialog();
82         i.configureDialog(i);
83         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
84
85         i = spawnXonoticHUDPressedKeysDialog();
86         i.configureDialog(i);
87         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
88
89         i = spawnXonoticHUDRaceTimerDialog();
90         i.configureDialog(i);
91         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
92
93         i = spawnXonoticHUDRadarDialog();
94         i.configureDialog(i);
95         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
96
97         i = spawnXonoticHUDScoreDialog();
98         i.configureDialog(i);
99         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
100
101         i = spawnXonoticHUDTimerDialog();
102         i.configureDialog(i);
103         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
104
105         i = spawnXonoticHUDVoteDialog();
106         i.configureDialog(i);
107         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
108
109         i = spawnXonoticHUDWeaponsDialog();
110         i.configureDialog(i);
111         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
112
113         i = spawnXonoticHUDEngineInfoDialog();
114         i.configureDialog(i);
115         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
116
117         i = spawnXonoticHUDInfoMessagesDialog();
118         i.configureDialog(i);
119         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
120
121         i = spawnXonoticHUDPhysicsDialog();
122         i.configureDialog(i);
123         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
124
125         i = spawnXonoticHUDCenterprintDialog();
126         i.configureDialog(i);
127         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
128
129
130         // dialogs used by settings
131         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
132         i.configureDialog(i);
133         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
134
135         me.cvarsDialog = i = spawnXonoticCvarsDialog();
136         i.configureDialog(i);
137         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
138
139         me.languageWarningDialog = i = spawnXonoticLanguageWarningDialog();
140         i.configureDialog(i);
141         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
142
143
144         // dialog used by singleplayer
145         me.winnerDialog = i = spawnXonoticWinnerDialog();
146         i.configureDialog(i);
147         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
148
149
150         // dialog used by multiplayer/join
151         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
152         i.configureDialog(i);
153         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
154
155
156         // dialogs used by multiplayer/create
157         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
158         i.configureDialog(i);
159         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
160
161         me.advancedDialog = i = spawnXonoticAdvancedDialog();
162         i.configureDialog(i);
163         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
164
165         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
166         i.configureDialog(i);
167         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
168
169
170         // dialogs used by multiplayer/player setup
171         me.crosshairDialog = i = spawnXonoticCrosshairDialog();
172         i.configureDialog(i);
173         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
174
175         me.hudDialog = i = spawnXonoticHUDDialog();
176         i.configureDialog(i);
177         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
178
179         me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
180         i.configureDialog(i);
181         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
182
183         me.modelDialog = i = spawnXonoticModelDialog();
184         i.configureDialog(i);
185         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
186
187         me.viewDialog = i = spawnXonoticViewDialog();
188         i.configureDialog(i);
189         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
190
191         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
192         i.configureDialog(i);
193         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
194
195
196         // mutator dialogs
197         i = spawnXonoticSandboxToolsDialog();
198         i.configureDialog(i);
199         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
200
201
202         // miscellaneous dialogs
203         i = spawnXonoticTeamSelectDialog();
204         i.configureDialog(i);
205         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
206
207         i = spawnXonoticMonsterToolsDialog();
208         i.configureDialog(i);
209         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
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 :-) */