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(world, 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);
132 // dialogs used by settings
133 me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
134 i.configureDialog(i);
135 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137 me.cvarsDialog = i = NEW(XonoticCvarsDialog);
138 i.configureDialog(i);
139 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141 me.resetDialog = i = NEW(XonoticResetDialog);
142 i.configureDialog(i);
143 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
145 me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
146 i.configureDialog(i);
147 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149 me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
150 i.configureDialog(i);
151 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
154 // dialog used by singleplayer
155 me.winnerDialog = i = NEW(XonoticWinnerDialog);
156 i.configureDialog(i);
157 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
160 // dialog used by multiplayer/join
161 me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
162 i.configureDialog(i);
163 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
165 me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
166 i.configureDialog(i);
167 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169 me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
170 i.configureDialog(i);
171 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
174 // dialogs used by multiplayer/create
175 me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
176 i.configureDialog(i);
177 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
179 me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
180 i.configureDialog(i);
181 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
184 // dialogs used by multiplayer/media
185 me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
186 i.configureDialog(i);
187 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
191 i = NEW(XonoticSandboxToolsDialog);
192 i.configureDialog(i);
193 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
196 // miscellaneous dialogs
197 i = NEW(XonoticTeamSelectDialog);
198 i.configureDialog(i);
199 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
201 i = NEW(XonoticMonsterToolsDialog);
202 i.configureDialog(i);
203 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
206 // main dialogs/windows
207 me.mainNexposee = n = NEW(XonoticNexposee);
209 if(checkextension("DP_GECKO_SUPPORT"))
211 i = spawnXonoticNewsDialog();
212 i.configureDialog(i);
213 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
214 n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
217 i = NEW(XonoticSingleplayerDialog);
218 i.configureDialog(i);
219 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
220 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
222 i = NEW(XonoticMultiplayerDialog);
223 i.configureDialog(i);
224 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
225 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
227 i = NEW(XonoticSettingsDialog);
228 i.configureDialog(i);
229 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
230 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
232 i = NEW(XonoticCreditsDialog);
233 i.configureDialog(i);
234 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
235 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
236 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
238 i = NEW(XonoticQuitDialog);
239 i.configureDialog(i);
240 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
241 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
242 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
244 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
245 me.moveItemAfter(me, n, NULL);
247 me.initializeDialog(me, n);
249 if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
250 me.dialogToShow = me.firstRunDialog;
254 /* Click. The c-word is here so you can grep for it :-) */