]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Begin adding HUD tab to game settings
[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, 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, modelDialog, entity, NULL)
16         ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
17         ATTRIB(MainWindow, mainNexposee, entity, NULL)
18         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
19         ATTRIB(MainWindow, dialogToShow, entity, NULL)
20         ATTRIB(MainWindow, notificationDialog, entity, NULL)
21         ATTRIB(MainWindow, democonfirmDialog, 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         me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
125         i.configureDialog(i);
126         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
127
128         i = spawnXonoticHUDCenterprintDialog();
129         i.configureDialog(i);
130         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
131
132
133         // dialogs used by settings
134         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
135         i.configureDialog(i);
136         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137
138         me.cvarsDialog = i = spawnXonoticCvarsDialog();
139         i.configureDialog(i);
140         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141
142
143         // dialog used by singleplayer
144         me.winnerDialog = i = spawnXonoticWinnerDialog();
145         i.configureDialog(i);
146         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
147
148
149         // dialog used by multiplayer/join
150         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
151         i.configureDialog(i);
152         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
153         
154         me.democonfirmDialog = i = spawnXonoticDemoConfirmDialog();
155         i.configureDialog(i);
156         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
157         
158         
159         // dialogs used by multiplayer/create
160         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
161         i.configureDialog(i);
162         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
163
164         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
165         i.configureDialog(i);
166         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
167
168         // dialogs used by multiplayer/player setup     
169         me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
170         i.configureDialog(i);
171         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
172
173         me.modelDialog = i = spawnXonoticModelDialog();
174         i.configureDialog(i);
175         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
176
177         me.notificationDialog = i = spawnXonoticNotificationDialog();
178         i.configureDialog(i);
179         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
180
181
182         // mutator dialogs
183         i = spawnXonoticSandboxToolsDialog();
184         i.configureDialog(i);
185         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
186
187
188         // miscellaneous dialogs
189         i = spawnXonoticTeamSelectDialog();
190         i.configureDialog(i);
191         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
192
193
194         // main dialogs/windows
195         me.mainNexposee = n = spawnXonoticNexposee();
196         /*
197                 if(checkextension("DP_GECKO_SUPPORT"))
198                 {
199                         i = spawnXonoticNewsDialog();
200                         i.configureDialog(i);
201                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
202                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
203                 }
204         */
205                 i = spawnXonoticSingleplayerDialog();
206                 i.configureDialog(i);
207                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
208                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
209
210                 i = spawnXonoticMultiplayerDialog();
211                 i.configureDialog(i);
212                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
213                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
214
215                 i = spawnXonoticSettingsDialog();
216                 i.configureDialog(i);
217                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
218                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
219
220                 i = spawnXonoticCreditsDialog();
221                 i.configureDialog(i);
222                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
223                 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
224                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
225
226                 i = spawnXonoticQuitDialog();
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_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
230                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
231
232         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
233         me.moveItemAfter(me, n, NULL);
234
235         me.initializeDialog(me, n);
236
237         if(cvar_string("_cl_name") == "Player")
238                 me.dialogToShow = me.firstRunDialog;
239 }
240 #endif
241
242 /* Click. The c-word is here so you can grep for it :-) */