3 #include "../item/modalcontroller.qc"
4 CLASS(MainWindow, ModalController)
5 METHOD(MainWindow, configureMainWindow, void(entity));
6 METHOD(MainWindow, draw, void(entity));
7 ATTRIB(MainWindow, firstRunDialog, entity, NULL)
8 ATTRIB(MainWindow, advancedDialog, entity, NULL)
9 ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
10 ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
11 ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
12 ATTRIB(MainWindow, winnerDialog, entity, NULL)
13 ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
14 ATTRIB(MainWindow, cvarsDialog, entity, NULL)
15 ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
16 ATTRIB(MainWindow, viewDialog, entity, NULL)
17 ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
18 ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
19 ATTRIB(MainWindow, mainNexposee, entity, NULL)
20 ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
21 ATTRIB(MainWindow, dialogToShow, entity, NULL)
22 ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
23 ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
24 ATTRIB(MainWindow, resetDialog, entity, NULL)
29 void MainWindow_draw(entity me)
31 SUPER(MainWindow).draw(me);
35 DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
36 me.dialogToShow = NULL;
40 void DemoButton_Click(entity me, entity other)
42 if(me.text == _("Do not press this button again!"))
43 DialogOpenButton_Click(me, other);
45 me.setText(me, _("Do not press this button again!"));
48 void MainWindow_configureMainWindow(entity me)
52 // dialog run upon startup
53 me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
55 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
58 // hud_configure dialogs
59 i = NEW(XonoticHUDExitDialog);
61 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
63 i = NEW(XonoticHUDNotificationDialog);
65 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
67 i = NEW(XonoticHUDAmmoDialog);
69 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
71 i = NEW(XonoticHUDHealthArmorDialog);
73 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
75 i = NEW(XonoticHUDChatDialog);
77 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
79 i = NEW(XonoticHUDModIconsDialog);
81 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
83 i = NEW(XonoticHUDPowerupsDialog);
85 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
87 i = NEW(XonoticHUDPressedKeysDialog);
89 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
91 i = NEW(XonoticHUDRaceTimerDialog);
93 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
95 i = NEW(XonoticHUDRadarDialog);
97 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
99 i = NEW(XonoticHUDScoreDialog);
100 i.configureDialog(i);
101 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
103 i = NEW(XonoticHUDTimerDialog);
104 i.configureDialog(i);
105 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
107 i = NEW(XonoticHUDVoteDialog);
108 i.configureDialog(i);
109 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
111 i = NEW(XonoticHUDWeaponsDialog);
112 i.configureDialog(i);
113 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
115 i = NEW(XonoticHUDEngineInfoDialog);
116 i.configureDialog(i);
117 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
119 i = NEW(XonoticHUDInfoMessagesDialog);
120 i.configureDialog(i);
121 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
123 i = NEW(XonoticHUDPhysicsDialog);
124 i.configureDialog(i);
125 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
127 i = NEW(XonoticHUDCenterprintDialog);
128 i.configureDialog(i);
129 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
131 i = NEW(XonoticHUDItemsTimeDialog);
132 i.configureDialog(i);
133 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
135 i = NEW(XonoticHUDQuickMenuDialog);
136 i.configureDialog(i);
137 me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
139 // dialogs used by settings
140 me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
141 i.configureDialog(i);
142 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
144 me.cvarsDialog = i = NEW(XonoticCvarsDialog);
145 i.configureDialog(i);
146 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
148 me.resetDialog = i = NEW(XonoticResetDialog);
149 i.configureDialog(i);
150 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
152 me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
153 i.configureDialog(i);
154 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
156 me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
157 i.configureDialog(i);
158 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
161 // dialog used by singleplayer
162 me.winnerDialog = i = NEW(XonoticWinnerDialog);
163 i.configureDialog(i);
164 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
167 // dialog used by multiplayer/join
168 me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
169 i.configureDialog(i);
170 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
172 me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
173 i.configureDialog(i);
174 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
176 me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
177 i.configureDialog(i);
178 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
181 // dialogs used by multiplayer/create
182 me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
183 i.configureDialog(i);
184 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
186 me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
187 i.configureDialog(i);
188 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
191 // dialogs used by multiplayer/media
192 me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
193 i.configureDialog(i);
194 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
198 i = NEW(XonoticSandboxToolsDialog);
199 i.configureDialog(i);
200 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
203 // miscellaneous dialogs
204 i = NEW(XonoticTeamSelectDialog);
205 i.configureDialog(i);
206 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
208 i = NEW(XonoticMonsterToolsDialog);
209 i.configureDialog(i);
210 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
213 // main dialogs/windows
214 me.mainNexposee = n = NEW(XonoticNexposee);
216 if(checkextension("DP_GECKO_SUPPORT"))
218 i = spawnXonoticNewsDialog();
219 i.configureDialog(i);
220 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
221 n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
224 i = NEW(XonoticSingleplayerDialog);
225 i.configureDialog(i);
226 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
227 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
229 i = NEW(XonoticMultiplayerDialog);
230 i.configureDialog(i);
231 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
232 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
234 i = NEW(XonoticSettingsDialog);
235 i.configureDialog(i);
236 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
237 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
239 i = NEW(XonoticCreditsDialog);
240 i.configureDialog(i);
241 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
242 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
243 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
245 i = NEW(XonoticQuitDialog);
246 i.configureDialog(i);
247 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
248 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
249 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
251 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
252 me.moveItemAfter(me, n, NULL);
254 me.initializeDialog(me, n);
256 if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
257 me.dialogToShow = me.firstRunDialog;
261 /* Click. The c-word is here so you can grep for it :-) */