2 CLASS(MainWindow) EXTENDS(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, mainNexposee, entity, NULL)
17 ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
18 ATTRIB(MainWindow, dialogToShow, entity, NULL)
19 ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
20 ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
25 void MainWindow_draw(entity me)
27 SUPER(MainWindow).draw(me);
31 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
32 me.dialogToShow = NULL;
36 void DemoButton_Click(entity me, entity other)
38 if(me.text == _("Do not press this button again!"))
39 DialogOpenButton_Click(me, other);
41 me.setText(me, _("Do not press this button again!"));
44 void MainWindow_configureMainWindow(entity me)
48 // dialog run upon startup
49 me.firstRunDialog = i = spawnXonoticFirstRunDialog();
51 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
54 // hud_configure dialogs
55 i = spawnXonoticHUDExitDialog();
57 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
59 i = spawnXonoticHUDNotificationDialog();
61 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
63 i = spawnXonoticHUDAmmoDialog();
65 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
67 i = spawnXonoticHUDHealthArmorDialog();
69 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
71 i = spawnXonoticHUDChatDialog();
73 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
75 i = spawnXonoticHUDModIconsDialog();
77 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
79 i = spawnXonoticHUDPowerupsDialog();
81 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
83 i = spawnXonoticHUDPressedKeysDialog();
85 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
87 i = spawnXonoticHUDRaceTimerDialog();
89 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
91 i = spawnXonoticHUDRadarDialog();
93 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
95 i = spawnXonoticHUDScoreDialog();
97 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
99 i = spawnXonoticHUDTimerDialog();
100 i.configureDialog(i);
101 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
103 i = spawnXonoticHUDVoteDialog();
104 i.configureDialog(i);
105 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
107 i = spawnXonoticHUDWeaponsDialog();
108 i.configureDialog(i);
109 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
111 i = spawnXonoticHUDEngineInfoDialog();
112 i.configureDialog(i);
113 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
115 i = spawnXonoticHUDInfoMessagesDialog();
116 i.configureDialog(i);
117 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
119 i = spawnXonoticHUDPhysicsDialog();
120 i.configureDialog(i);
121 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
123 me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
124 i.configureDialog(i);
125 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
127 i = spawnXonoticHUDCenterprintDialog();
128 i.configureDialog(i);
129 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
132 // dialogs used by settings
133 me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
134 i.configureDialog(i);
135 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137 me.cvarsDialog = i = spawnXonoticCvarsDialog();
138 i.configureDialog(i);
139 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141 me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
142 i.configureDialog(i);
143 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
146 // dialog used by singleplayer
147 me.winnerDialog = i = spawnXonoticWinnerDialog();
148 i.configureDialog(i);
149 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
152 // dialog used by multiplayer/join
153 me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
154 i.configureDialog(i);
155 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
157 me.demostartconfirmDialog = i = spawnXonoticDemoStartConfirmDialog();
158 i.configureDialog(i);
159 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
161 me.demotimeconfirmDialog = i = spawnXonoticDemoTimeConfirmDialog();
162 i.configureDialog(i);
163 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
166 // dialogs used by multiplayer/create
167 me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
168 i.configureDialog(i);
169 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
171 me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
172 i.configureDialog(i);
173 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
176 i = spawnXonoticSandboxToolsDialog();
177 i.configureDialog(i);
178 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
181 // miscellaneous dialogs
182 i = spawnXonoticTeamSelectDialog();
183 i.configureDialog(i);
184 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
186 i = spawnXonoticMonsterToolsDialog();
187 i.configureDialog(i);
188 me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
191 // main dialogs/windows
192 me.mainNexposee = n = spawnXonoticNexposee();
194 if(checkextension("DP_GECKO_SUPPORT"))
196 i = spawnXonoticNewsDialog();
197 i.configureDialog(i);
198 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
199 n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
202 i = spawnXonoticSingleplayerDialog();
203 i.configureDialog(i);
204 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
205 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
207 i = spawnXonoticMultiplayerDialog();
208 i.configureDialog(i);
209 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
210 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
212 i = spawnXonoticSettingsDialog();
213 i.configureDialog(i);
214 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
215 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
217 i = spawnXonoticCreditsDialog();
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
221 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
223 i = spawnXonoticQuitDialog();
224 i.configureDialog(i);
225 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
226 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
227 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
229 me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
230 me.moveItemAfter(me, n, NULL);
232 me.initializeDialog(me, n);
234 if(cvar_string("_cl_name") == "Player")
235 me.dialogToShow = me.firstRunDialog;
239 /* Click. The c-word is here so you can grep for it :-) */