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