]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.c
1 #ifdef INTERFACE
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, weaponsDialog, entity, NULL)
9         ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
10         ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
11         ATTRIB(MainWindow, winnerDialog, entity, NULL)
12         ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
13         ATTRIB(MainWindow, cvarsDialog, entity, NULL)
14         ATTRIB(MainWindow, viewDialog, entity, NULL)
15         ATTRIB(MainWindow, modelDialog, entity, NULL)
16         ATTRIB(MainWindow, crosshairDialog, entity, NULL)
17         ATTRIB(MainWindow, hudDialog, entity, NULL)
18         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
19         ATTRIB(MainWindow, mainNexposee, entity, NULL)
20         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
21         ATTRIB(MainWindow, dialogToShow, entity, NULL)
22 ENDCLASS(MainWindow)
23 #endif
24
25 #ifdef IMPLEMENTATION
26 void MainWindow_draw(entity me)
27 {
28         SUPER(MainWindow).draw(me);
29
30         if(me.dialogToShow)
31         {
32                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
33                 me.dialogToShow = NULL;
34         }
35 }
36
37 void DemoButton_Click(entity me, entity other)
38 {
39         if(me.text == _("Do not press this button again!"))
40                 DialogOpenButton_Click(me, other);
41         else
42                 me.setText(me, _("Do not press this button again!"));
43 }
44
45 void MainWindow_configureMainWindow(entity me)
46 {
47         entity n, i;
48
49         // dialog run upon startup
50         me.firstRunDialog = i = spawnXonoticFirstRunDialog();
51         i.configureDialog(i);
52         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
53         
54         
55         // hud_configure dialogs
56         i = spawnXonoticHUDExitDialog();
57         i.configureDialog(i);
58         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
59         
60         i = spawnXonoticHUDNotificationDialog();
61         i.configureDialog(i);
62         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
63         
64         i = spawnXonoticHUDAmmoDialog();
65         i.configureDialog(i);
66         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
67         
68         i = spawnXonoticHUDHealthArmorDialog();
69         i.configureDialog(i);
70         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
71         
72         i = spawnXonoticHUDChatDialog();
73         i.configureDialog(i);
74         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
75         
76         i = spawnXonoticHUDModIconsDialog();
77         i.configureDialog(i);
78         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
79         
80         i = spawnXonoticHUDPowerupsDialog();
81         i.configureDialog(i);
82         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
83         
84         i = spawnXonoticHUDPressedKeysDialog();
85         i.configureDialog(i);
86         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
87         
88         i = spawnXonoticHUDRaceTimerDialog();
89         i.configureDialog(i);
90         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
91         
92         i = spawnXonoticHUDRadarDialog();
93         i.configureDialog(i);
94         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
95         
96         i = spawnXonoticHUDScoreDialog();
97         i.configureDialog(i);
98         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
99         
100         i = spawnXonoticHUDTimerDialog();
101         i.configureDialog(i);
102         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
103         
104         i = spawnXonoticHUDVoteDialog();
105         i.configureDialog(i);
106         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
107         
108         i = spawnXonoticHUDWeaponsDialog();
109         i.configureDialog(i);
110         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
111
112         i = spawnXonoticHUDEngineInfoDialog();
113         i.configureDialog(i);
114         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
115
116         i = spawnXonoticHUDInfoMessagesDialog();
117         i.configureDialog(i);
118         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
119
120         i = spawnXonoticHUDPhysicsDialog();
121         i.configureDialog(i);
122         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
123
124         i = spawnXonoticHUDCenterprintDialog();
125         i.configureDialog(i);
126         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
127         
128         
129         // dialogs used by settings
130         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
131         i.configureDialog(i);
132         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133         
134         me.cvarsDialog = i = spawnXonoticCvarsDialog();
135         i.configureDialog(i);
136         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137         
138         
139         // dialog used by singleplayer
140         me.winnerDialog = i = spawnXonoticWinnerDialog();
141         i.configureDialog(i);
142         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143         
144         
145         // dialog used by multiplayer/join
146         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
147         i.configureDialog(i);
148         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149         
150         
151         // dialogs used by multiplayer/create
152         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
153         i.configureDialog(i);
154         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155         
156         me.advancedDialog = i = spawnXonoticAdvancedDialog();
157         i.configureDialog(i);
158         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
159
160         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
161         i.configureDialog(i);
162         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
163         
164
165         // dialogs used by multiplayer/player setup
166         me.crosshairDialog = i = spawnXonoticCrosshairDialog();
167         i.configureDialog(i);
168         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169         
170         me.hudDialog = i = spawnXonoticHUDDialog();
171         i.configureDialog(i);
172         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
173
174         me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
175         i.configureDialog(i);
176         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
177         
178         me.modelDialog = i = spawnXonoticModelDialog();
179         i.configureDialog(i);
180         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
181         
182         me.viewDialog = i = spawnXonoticViewDialog();
183         i.configureDialog(i);
184         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185         
186         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
187         i.configureDialog(i);
188         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
189         
190
191         // mutator dialogs
192         i = spawnXonoticSandboxToolsDialog();
193         i.configureDialog(i);
194         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
195         
196         i = spawnXonoticTowerDefenseDialog();
197         i.configureDialog(i);
198         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
199         
200         
201         // miscellaneous dialogs
202         i = spawnXonoticTeamSelectDialog();
203         i.configureDialog(i);
204         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
205         
206         i = spawnXonoticMonsterToolsDialog();
207         i.configureDialog(i);
208         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
209         
210         
211         // main dialogs/windows
212         me.mainNexposee = n = spawnXonoticNexposee();
213         /*
214                 if(checkextension("DP_GECKO_SUPPORT"))
215                 {
216                         i = spawnXonoticNewsDialog();
217                         i.configureDialog(i);
218                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
219                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
220                 }
221         */
222                 i = spawnXonoticSingleplayerDialog();
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_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
226                 
227                 i = spawnXonoticMultiplayerDialog();
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_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
231
232                 i = spawnXonoticSettingsDialog();
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_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
236
237                 i = spawnXonoticCreditsDialog();
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
241                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
242
243                 i = spawnXonoticQuitDialog();
244                 i.configureDialog(i);
245                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
246                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
247                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
248                 
249         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
250         me.moveItemAfter(me, n, NULL);
251
252         me.initializeDialog(me, n);
253
254         if(cvar_string("_cl_name") == "Player")
255                 me.dialogToShow = me.firstRunDialog;
256 }
257 #endif
258
259 /* Click. The c-word is here so you can grep for it :-) */