]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.qc
Merge branch 'TimePath/globalforces' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.qc
1 #include "mainwindow.qh"
2
3 #include "nexposee.qh"
4 #include "inputbox.qh"
5 #include "dialog_firstrun.qh"
6 #include "dialog_hudsetup_exit.qh"
7 #include "dialog_hudpanel_notification.qh"
8 #include "dialog_hudpanel_ammo.qh"
9 #include "dialog_hudpanel_healtharmor.qh"
10 #include "dialog_hudpanel_chat.qh"
11 #include "dialog_hudpanel_modicons.qh"
12 #include "dialog_hudpanel_powerups.qh"
13 #include "dialog_hudpanel_pressedkeys.qh"
14 #include "dialog_hudpanel_racetimer.qh"
15 #include "dialog_hudpanel_radar.qh"
16 #include "dialog_hudpanel_score.qh"
17 #include "dialog_hudpanel_timer.qh"
18 #include "dialog_hudpanel_vote.qh"
19 #include "dialog_hudpanel_weapons.qh"
20 #include "dialog_hudpanel_engineinfo.qh"
21 #include "dialog_hudpanel_infomessages.qh"
22 #include "dialog_hudpanel_physics.qh"
23 #include "dialog_hudpanel_centerprint.qh"
24 #include "dialog_hudpanel_itemstime.qh"
25 #include "dialog_hudpanel_quickmenu.qh"
26
27 #include "dialog_settings_input_userbind.qh"
28 #include "dialog_settings_misc_cvars.qh"
29 #include "dialog_settings_misc_reset.qh"
30 #include "dialog_settings_user_languagewarning.qh"
31 #include "dialog_settings_game_hudconfirm.qh"
32 #include "dialog_singleplayer_winner.qh"
33 #include "dialog_multiplayer_join_serverinfo.qh"
34 #include "dialog_multiplayer_media_demo_startconfirm.qh"
35 #include "dialog_multiplayer_media_demo_timeconfirm.qh"
36 #include "dialog_multiplayer_media_screenshot_viewer.qh"
37 #include "dialog_multiplayer_create_mapinfo.qh"
38 #include "dialog_multiplayer_create_mutators.qh"
39 #include "dialog_sandboxtools.qh"
40 #include "dialog_monstertools.qh"
41 #include "dialog_teamselect.qh"
42 #include "dialog_uid2name.qh"
43 #include "dialog_singleplayer.qh"
44 #include "dialog_multiplayer.qh"
45 #include "dialog_settings.qh"
46 #include "dialog_credits.qh"
47 #include "dialog_quit.qh"
48
49 void MainWindow_draw(entity me)
50 {
51         SUPER(MainWindow).draw(me);
52
53         if(me.dialogToShow)
54         {
55                 DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
56                 me.dialogToShow = NULL;
57         }
58 }
59
60 void DemoButton_Click(entity me, entity other)
61 {
62         if(me.text == _("Do not press this button again!"))
63                 DialogOpenButton_Click(me, other);
64         else
65                 me.setText(me, _("Do not press this button again!"));
66 }
67
68 void MainWindow_configureMainWindow(entity me)
69 {
70         entity n, i;
71
72         // dialog run upon startup
73         me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
74         i.configureDialog(i);
75         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
76
77
78         // hud_configure dialogs
79         i = NEW(XonoticHUDExitDialog);
80         i.configureDialog(i);
81         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
82
83         i = NEW(XonoticHUDNotificationDialog);
84         i.configureDialog(i);
85         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
86
87         i = NEW(XonoticHUDAmmoDialog);
88         i.configureDialog(i);
89         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
90
91         i = NEW(XonoticHUDHealthArmorDialog);
92         i.configureDialog(i);
93         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
94
95         i = NEW(XonoticHUDChatDialog);
96         i.configureDialog(i);
97         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
98
99         i = NEW(XonoticHUDModIconsDialog);
100         i.configureDialog(i);
101         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
102
103         i = NEW(XonoticHUDPowerupsDialog);
104         i.configureDialog(i);
105         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
106
107         i = NEW(XonoticHUDPressedKeysDialog);
108         i.configureDialog(i);
109         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
110
111         i = NEW(XonoticHUDRaceTimerDialog);
112         i.configureDialog(i);
113         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
114
115         i = NEW(XonoticHUDRadarDialog);
116         i.configureDialog(i);
117         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
118
119         i = NEW(XonoticHUDScoreDialog);
120         i.configureDialog(i);
121         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
122
123         i = NEW(XonoticHUDTimerDialog);
124         i.configureDialog(i);
125         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
126
127         i = NEW(XonoticHUDVoteDialog);
128         i.configureDialog(i);
129         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
130
131         i = NEW(XonoticHUDWeaponsDialog);
132         i.configureDialog(i);
133         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
134
135         i = NEW(XonoticHUDEngineInfoDialog);
136         i.configureDialog(i);
137         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
138
139         i = NEW(XonoticHUDInfoMessagesDialog);
140         i.configureDialog(i);
141         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
142
143         i = NEW(XonoticHUDPhysicsDialog);
144         i.configureDialog(i);
145         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
146
147         i = NEW(XonoticHUDCenterprintDialog);
148         i.configureDialog(i);
149         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
150
151         i = NEW(XonoticHUDItemsTimeDialog);
152         i.configureDialog(i);
153         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
154
155         i = NEW(XonoticHUDQuickMenuDialog);
156         i.configureDialog(i);
157         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
158
159         // dialogs used by settings
160         me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
161         i.configureDialog(i);
162         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
163
164         me.cvarsDialog = i = NEW(XonoticCvarsDialog);
165         i.configureDialog(i);
166         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
167
168         me.resetDialog = i = NEW(XonoticResetDialog);
169         i.configureDialog(i);
170         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
171
172         me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
173         i.configureDialog(i);
174         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175
176         me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
177         i.configureDialog(i);
178         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
179
180
181         // dialog used by singleplayer
182         me.winnerDialog = i = NEW(XonoticWinnerDialog);
183         i.configureDialog(i);
184         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185
186
187         // dialog used by multiplayer/join
188         me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
189         i.configureDialog(i);
190         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
191
192         me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
193         i.configureDialog(i);
194         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
195
196         me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
197         i.configureDialog(i);
198         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
199
200
201         // dialogs used by multiplayer/create
202         me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
203         i.configureDialog(i);
204         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
205
206         me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
207         i.configureDialog(i);
208         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
209
210
211         // dialogs used by multiplayer/media
212         me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
213         i.configureDialog(i);
214         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
215
216
217         // mutator dialogs
218         i = NEW(XonoticSandboxToolsDialog);
219         i.configureDialog(i);
220         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
221
222
223         // miscellaneous dialogs
224         i = NEW(XonoticTeamSelectDialog);
225         i.configureDialog(i);
226         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
227
228         i = NEW(XonoticUid2NameDialog);
229         i.configureDialog(i);
230         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
231
232         i = NEW(XonoticMonsterToolsDialog);
233         i.configureDialog(i);
234         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
235
236
237         // main dialogs/windows
238         me.mainNexposee = n = NEW(XonoticNexposee);
239         /*
240                 if(checkextension("DP_GECKO_SUPPORT"))
241                 {
242                         i = spawnXonoticNewsDialog();
243                         i.configureDialog(i);
244                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
245                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
246                 }
247         */
248                 i = NEW(XonoticSingleplayerDialog);
249                 i.configureDialog(i);
250                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
251                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
252
253                 i = NEW(XonoticMultiplayerDialog);
254                 i.configureDialog(i);
255                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
256                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
257
258                 i = NEW(XonoticSettingsDialog);
259                 i.configureDialog(i);
260                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
261                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
262
263                 i = NEW(XonoticCreditsDialog);
264                 i.configureDialog(i);
265                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
266                 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
267                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
268
269                 i = NEW(XonoticQuitDialog);
270                 i.configureDialog(i);
271                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
272                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
273                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
274
275         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
276         me.moveItemAfter(me, n, NULL);
277
278         me.initializeDialog(me, n);
279
280         if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
281                 me.dialogToShow = me.firstRunDialog;
282 }