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