1 #include "mainwindow.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"
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"
48 void MainWindow_draw(entity me)
50 SUPER(MainWindow).draw(me);
54 DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
55 me.dialogToShow = NULL;
59 void DemoButton_Click(entity me, entity other)
61 if(me.text == _("Do not press this button again!"))
62 DialogOpenButton_Click(me, other);
64 me.setText(me, _("Do not press this button again!"));
67 void MainWindow_configureMainWindow(entity me)
71 // dialog run upon startup
72 me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
74 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
77 // hud_configure dialogs
78 i = NEW(XonoticHUDExitDialog);
80 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
82 i = NEW(XonoticHUDNotificationDialog);
84 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
86 i = NEW(XonoticHUDAmmoDialog);
88 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
90 i = NEW(XonoticHUDHealthArmorDialog);
92 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
94 i = NEW(XonoticHUDChatDialog);
96 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
98 i = NEW(XonoticHUDModIconsDialog);
100 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
102 i = NEW(XonoticHUDPowerupsDialog);
103 i.configureDialog(i);
104 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
106 i = NEW(XonoticHUDPressedKeysDialog);
107 i.configureDialog(i);
108 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
110 i = NEW(XonoticHUDRaceTimerDialog);
111 i.configureDialog(i);
112 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
114 i = NEW(XonoticHUDRadarDialog);
115 i.configureDialog(i);
116 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
118 i = NEW(XonoticHUDScoreDialog);
119 i.configureDialog(i);
120 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
122 i = NEW(XonoticHUDTimerDialog);
123 i.configureDialog(i);
124 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
126 i = NEW(XonoticHUDVoteDialog);
127 i.configureDialog(i);
128 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
130 i = NEW(XonoticHUDWeaponsDialog);
131 i.configureDialog(i);
132 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
134 i = NEW(XonoticHUDEngineInfoDialog);
135 i.configureDialog(i);
136 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
138 i = NEW(XonoticHUDInfoMessagesDialog);
139 i.configureDialog(i);
140 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
142 i = NEW(XonoticHUDPhysicsDialog);
143 i.configureDialog(i);
144 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
146 i = NEW(XonoticHUDCenterprintDialog);
147 i.configureDialog(i);
148 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
150 i = NEW(XonoticHUDItemsTimeDialog);
151 i.configureDialog(i);
152 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
154 i = NEW(XonoticHUDQuickMenuDialog);
155 i.configureDialog(i);
156 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
163 me.cvarsDialog = i = NEW(XonoticCvarsDialog);
164 i.configureDialog(i);
165 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
167 me.resetDialog = i = NEW(XonoticResetDialog);
168 i.configureDialog(i);
169 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
171 me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
172 i.configureDialog(i);
173 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175 me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
176 i.configureDialog(i);
177 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
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);
191 me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
192 i.configureDialog(i);
193 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
195 me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
196 i.configureDialog(i);
197 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
205 me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
206 i.configureDialog(i);
207 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
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);
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);
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);
232 // main dialogs/windows
233 me.mainNexposee = n = NEW(XonoticNexposee);
235 if(checkextension("DP_GECKO_SUPPORT"))
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);
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);
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);
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);
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));
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));
270 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
271 me.moveItemAfter(me, n, NULL);
273 me.initializeDialog(me, n);
275 if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
276 me.dialogToShow = me.firstRunDialog;