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_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"
49 void MainWindow_draw(entity me)
51 SUPER(MainWindow).draw(me);
55 DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
56 me.dialogToShow = NULL;
60 void DemoButton_Click(entity me, entity other)
62 if(me.text == _("Do not press this button again!"))
63 DialogOpenButton_Click(me, other);
65 me.setText(me, _("Do not press this button again!"));
68 void MainWindow_configureMainWindow(entity me)
72 // dialog run upon startup
73 me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
75 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
78 // hud_configure dialogs
79 i = NEW(XonoticHUDExitDialog);
81 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
83 i = NEW(XonoticHUDNotificationDialog);
85 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
87 i = NEW(XonoticHUDAmmoDialog);
89 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
91 i = NEW(XonoticHUDHealthArmorDialog);
93 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
95 i = NEW(XonoticHUDChatDialog);
97 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
99 i = NEW(XonoticHUDModIconsDialog);
100 i.configureDialog(i);
101 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
103 i = NEW(XonoticHUDPowerupsDialog);
104 i.configureDialog(i);
105 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
107 i = NEW(XonoticHUDPressedKeysDialog);
108 i.configureDialog(i);
109 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
111 i = NEW(XonoticHUDRaceTimerDialog);
112 i.configureDialog(i);
113 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
115 i = NEW(XonoticHUDRadarDialog);
116 i.configureDialog(i);
117 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
119 i = NEW(XonoticHUDScoreDialog);
120 i.configureDialog(i);
121 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
123 i = NEW(XonoticHUDTimerDialog);
124 i.configureDialog(i);
125 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
127 i = NEW(XonoticHUDVoteDialog);
128 i.configureDialog(i);
129 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
131 i = NEW(XonoticHUDWeaponsDialog);
132 i.configureDialog(i);
133 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
135 i = NEW(XonoticHUDEngineInfoDialog);
136 i.configureDialog(i);
137 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
139 i = NEW(XonoticHUDInfoMessagesDialog);
140 i.configureDialog(i);
141 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143 i = NEW(XonoticHUDPhysicsDialog);
144 i.configureDialog(i);
145 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
147 i = NEW(XonoticHUDCenterprintDialog);
148 i.configureDialog(i);
149 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
151 i = NEW(XonoticHUDItemsTimeDialog);
152 i.configureDialog(i);
153 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155 i = NEW(XonoticHUDQuickMenuDialog);
156 i.configureDialog(i);
157 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
164 me.cvarsDialog = i = NEW(XonoticCvarsDialog);
165 i.configureDialog(i);
166 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
168 me.resetDialog = i = NEW(XonoticResetDialog);
169 i.configureDialog(i);
170 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
172 me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
173 i.configureDialog(i);
174 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
176 me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
177 i.configureDialog(i);
178 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
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);
192 me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
193 i.configureDialog(i);
194 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
196 me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
197 i.configureDialog(i);
198 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
206 me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
207 i.configureDialog(i);
208 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
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);
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);
228 i = NEW(XonoticUid2NameDialog);
229 i.configureDialog(i);
230 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
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);
237 // main dialogs/windows
238 me.mainNexposee = n = NEW(XonoticNexposee);
240 if(checkextension("DP_GECKO_SUPPORT"))
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);
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);
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);
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);
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));
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));
275 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
276 me.moveItemAfter(me, n, NULL);
278 me.initializeDialog(me, n);
280 if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
281 me.dialogToShow = me.firstRunDialog;