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