]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.qc
Merge branch 'master' into Mario/hagar_notfixed
[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_singleplayer.qh"
43 #include "dialog_multiplayer.qh"
44 #include "dialog_settings.qh"
45 #include "dialog_credits.qh"
46 #include "dialog_quit.qh"
47
48 void MainWindow_draw(entity me)
49 {
50         SUPER(MainWindow).draw(me);
51
52         if(me.dialogToShow)
53         {
54                 DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
55                 me.dialogToShow = NULL;
56         }
57 }
58
59 void DemoButton_Click(entity me, entity other)
60 {
61         if(me.text == _("Do not press this button again!"))
62                 DialogOpenButton_Click(me, other);
63         else
64                 me.setText(me, _("Do not press this button again!"));
65 }
66
67 void MainWindow_configureMainWindow(entity me)
68 {
69         entity n, i;
70
71         // dialog run upon startup
72         me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
73         i.configureDialog(i);
74         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
75
76
77         // hud_configure dialogs
78         i = NEW(XonoticHUDExitDialog);
79         i.configureDialog(i);
80         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
81
82         i = NEW(XonoticHUDNotificationDialog);
83         i.configureDialog(i);
84         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
85
86         i = NEW(XonoticHUDAmmoDialog);
87         i.configureDialog(i);
88         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
89
90         i = NEW(XonoticHUDHealthArmorDialog);
91         i.configureDialog(i);
92         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93
94         i = NEW(XonoticHUDChatDialog);
95         i.configureDialog(i);
96         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
97
98         i = NEW(XonoticHUDModIconsDialog);
99         i.configureDialog(i);
100         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
101
102         i = NEW(XonoticHUDPowerupsDialog);
103         i.configureDialog(i);
104         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
105
106         i = NEW(XonoticHUDPressedKeysDialog);
107         i.configureDialog(i);
108         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
109
110         i = NEW(XonoticHUDRaceTimerDialog);
111         i.configureDialog(i);
112         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
113
114         i = NEW(XonoticHUDRadarDialog);
115         i.configureDialog(i);
116         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
117
118         i = NEW(XonoticHUDScoreDialog);
119         i.configureDialog(i);
120         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
121
122         i = NEW(XonoticHUDTimerDialog);
123         i.configureDialog(i);
124         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
125
126         i = NEW(XonoticHUDVoteDialog);
127         i.configureDialog(i);
128         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129
130         i = NEW(XonoticHUDWeaponsDialog);
131         i.configureDialog(i);
132         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133
134         i = NEW(XonoticHUDEngineInfoDialog);
135         i.configureDialog(i);
136         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137
138         i = NEW(XonoticHUDInfoMessagesDialog);
139         i.configureDialog(i);
140         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141
142         i = NEW(XonoticHUDPhysicsDialog);
143         i.configureDialog(i);
144         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
145
146         i = NEW(XonoticHUDCenterprintDialog);
147         i.configureDialog(i);
148         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149
150         i = NEW(XonoticHUDItemsTimeDialog);
151         i.configureDialog(i);
152         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
153
154         i = NEW(XonoticHUDQuickMenuDialog);
155         i.configureDialog(i);
156         me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
157
158         // dialogs used by settings
159         me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
160         i.configureDialog(i);
161         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
162
163         me.cvarsDialog = i = NEW(XonoticCvarsDialog);
164         i.configureDialog(i);
165         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
166
167         me.resetDialog = i = NEW(XonoticResetDialog);
168         i.configureDialog(i);
169         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
170
171         me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
172         i.configureDialog(i);
173         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
174
175         me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
176         i.configureDialog(i);
177         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
178
179
180         // dialog used by singleplayer
181         me.winnerDialog = i = NEW(XonoticWinnerDialog);
182         i.configureDialog(i);
183         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
184
185
186         // dialog used by multiplayer/join
187         me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
188         i.configureDialog(i);
189         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
190
191         me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
192         i.configureDialog(i);
193         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
194
195         me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
196         i.configureDialog(i);
197         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
198
199
200         // dialogs used by multiplayer/create
201         me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
202         i.configureDialog(i);
203         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
204
205         me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
206         i.configureDialog(i);
207         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
208
209
210         // dialogs used by multiplayer/media
211         me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
212         i.configureDialog(i);
213         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
214
215
216         // mutator dialogs
217         i = NEW(XonoticSandboxToolsDialog);
218         i.configureDialog(i);
219         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
220
221
222         // miscellaneous dialogs
223         i = NEW(XonoticTeamSelectDialog);
224         i.configureDialog(i);
225         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
226
227         i = NEW(XonoticMonsterToolsDialog);
228         i.configureDialog(i);
229         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
230
231
232         // main dialogs/windows
233         me.mainNexposee = n = NEW(XonoticNexposee);
234         /*
235                 if(checkextension("DP_GECKO_SUPPORT"))
236                 {
237                         i = spawnXonoticNewsDialog();
238                         i.configureDialog(i);
239                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
240                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
241                 }
242         */
243                 i = NEW(XonoticSingleplayerDialog);
244                 i.configureDialog(i);
245                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
246                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
247
248                 i = NEW(XonoticMultiplayerDialog);
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_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
252
253                 i = NEW(XonoticSettingsDialog);
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_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
257
258                 i = NEW(XonoticCreditsDialog);
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
262                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
263
264                 i = NEW(XonoticQuitDialog);
265                 i.configureDialog(i);
266                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
267                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
268                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
269
270         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
271         me.moveItemAfter(me, n, NULL);
272
273         me.initializeDialog(me, n);
274
275         if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
276                 me.dialogToShow = me.firstRunDialog;
277 }