2 CLASS(MainWindow, ModalController)
3 METHOD(MainWindow, configureMainWindow, void(entity))
4 METHOD(MainWindow, draw, void(entity))
5 ATTRIB(MainWindow, firstRunDialog, entity, NULL)
6 ATTRIB(MainWindow, advancedDialog, entity, NULL)
7 ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
8 ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
9 ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
10 ATTRIB(MainWindow, winnerDialog, entity, NULL)
11 ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
12 ATTRIB(MainWindow, cvarsDialog, entity, NULL)
13 ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
14 ATTRIB(MainWindow, viewDialog, entity, NULL)
15 ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
16 ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
17 ATTRIB(MainWindow, mainNexposee, entity, NULL)
18 ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
19 ATTRIB(MainWindow, dialogToShow, entity, NULL)
20 ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
21 ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
22 ATTRIB(MainWindow, resetDialog, entity, NULL)
27 void MainWindow_draw(entity me)
29 SUPER(MainWindow).draw(me);
33 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
34 me.dialogToShow = NULL;
38 void DemoButton_Click(entity me, entity other)
40 if(me.text == _("Do not press this button again!"))
41 DialogOpenButton_Click(me, other);
43 me.setText(me, _("Do not press this button again!"));
46 void MainWindow_configureMainWindow(entity me)
50 // dialog run upon startup
51 me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
53 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
56 // hud_configure dialogs
57 i = NEW(XonoticHUDExitDialog);
59 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
61 i = NEW(XonoticHUDNotificationDialog);
63 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
65 i = NEW(XonoticHUDAmmoDialog);
67 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
69 i = NEW(XonoticHUDHealthArmorDialog);
71 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
73 i = NEW(XonoticHUDChatDialog);
75 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
77 i = NEW(XonoticHUDModIconsDialog);
79 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
81 i = NEW(XonoticHUDPowerupsDialog);
83 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
85 i = NEW(XonoticHUDPressedKeysDialog);
87 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
89 i = NEW(XonoticHUDRaceTimerDialog);
91 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93 i = NEW(XonoticHUDRadarDialog);
95 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
97 i = NEW(XonoticHUDScoreDialog);
99 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
101 i = NEW(XonoticHUDTimerDialog);
102 i.configureDialog(i);
103 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
105 i = NEW(XonoticHUDVoteDialog);
106 i.configureDialog(i);
107 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
109 i = NEW(XonoticHUDWeaponsDialog);
110 i.configureDialog(i);
111 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
113 i = NEW(XonoticHUDEngineInfoDialog);
114 i.configureDialog(i);
115 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
117 i = NEW(XonoticHUDInfoMessagesDialog);
118 i.configureDialog(i);
119 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
121 i = NEW(XonoticHUDPhysicsDialog);
122 i.configureDialog(i);
123 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
125 me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
126 i.configureDialog(i);
127 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129 i = NEW(XonoticHUDCenterprintDialog);
130 i.configureDialog(i);
131 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133 i = NEW(XonoticHUDBuffsDialog);
134 i.configureDialog(i);
135 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
138 // dialogs used by settings
139 me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
140 i.configureDialog(i);
141 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143 me.cvarsDialog = i = NEW(XonoticCvarsDialog);
144 i.configureDialog(i);
145 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
147 me.resetDialog = i = NEW(XonoticResetDialog);
148 i.configureDialog(i);
149 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
151 me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
152 i.configureDialog(i);
153 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155 me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
156 i.configureDialog(i);
157 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
160 // dialog used by singleplayer
161 me.winnerDialog = i = NEW(XonoticWinnerDialog);
162 i.configureDialog(i);
163 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
166 // dialog used by multiplayer/join
167 me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
168 i.configureDialog(i);
169 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
171 me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
172 i.configureDialog(i);
173 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175 me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
176 i.configureDialog(i);
177 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
180 // dialogs used by multiplayer/create
181 me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
182 i.configureDialog(i);
183 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185 me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
186 i.configureDialog(i);
187 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
190 i = NEW(XonoticSandboxToolsDialog);
191 i.configureDialog(i);
192 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
195 // miscellaneous dialogs
196 i = NEW(XonoticTeamSelectDialog);
197 i.configureDialog(i);
198 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
200 i = NEW(XonoticMonsterToolsDialog);
201 i.configureDialog(i);
202 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
205 // main dialogs/windows
206 me.mainNexposee = n = NEW(XonoticNexposee);
208 if(checkextension("DP_GECKO_SUPPORT"))
210 i = spawnXonoticNewsDialog();
211 i.configureDialog(i);
212 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
213 n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
216 i = NEW(XonoticSingleplayerDialog);
217 i.configureDialog(i);
218 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
219 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
221 i = NEW(XonoticMultiplayerDialog);
222 i.configureDialog(i);
223 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
224 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
226 i = NEW(XonoticSettingsDialog);
227 i.configureDialog(i);
228 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
229 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
231 i = NEW(XonoticCreditsDialog);
232 i.configureDialog(i);
233 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
234 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
235 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
237 i = NEW(XonoticQuitDialog);
238 i.configureDialog(i);
239 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
240 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
241 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
243 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
244 me.moveItemAfter(me, n, NULL);
246 me.initializeDialog(me, n);
248 if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
249 me.dialogToShow = me.firstRunDialog;
253 /* Click. The c-word is here so you can grep for it :-) */