]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Get rid of the old waypoint dialog
[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, mainNexposee, entity, NULL)
15         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
16         ATTRIB(MainWindow, dialogToShow, entity, NULL)
17 ENDCLASS(MainWindow)
18 #endif
19
20 #ifdef IMPLEMENTATION
21 void MainWindow_draw(entity me)
22 {
23         SUPER(MainWindow).draw(me);
24
25         if(me.dialogToShow)
26         {
27                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
28                 me.dialogToShow = NULL;
29         }
30 }
31
32 void DemoButton_Click(entity me, entity other)
33 {
34         if(me.text == _("Do not press this button again!"))
35                 DialogOpenButton_Click(me, other);
36         else
37                 me.setText(me, _("Do not press this button again!"));
38 }
39
40 void MainWindow_configureMainWindow(entity me)
41 {
42         entity n, i;
43
44         me.firstRunDialog = i = spawnXonoticFirstRunDialog();
45         i.configureDialog(i);
46         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
47
48         i = spawnXonoticTeamSelectDialog();
49         i.configureDialog(i);
50         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
51
52         i = spawnXonoticSandboxToolsDialog();
53         i.configureDialog(i);
54         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
55         
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         me.advancedDialog = i = spawnXonoticAdvancedDialog();
129         i.configureDialog(i);
130         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
131
132         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
133         i.configureDialog(i);
134         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
135
136         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
137         i.configureDialog(i);
138         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
139
140         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
141         i.configureDialog(i);
142         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
143
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         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
149         i.configureDialog(i);
150         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
151         
152         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
153         i.configureDialog(i);
154         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
155         
156         me.cvarsDialog = i = spawnXonoticCvarsDialog();
157         i.configureDialog(i);
158         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
159         
160         me.mainNexposee = n = spawnXonoticNexposee();
161         /*
162                 if(checkextension("DP_GECKO_SUPPORT"))
163                 {
164                         i = spawnXonoticNewsDialog();
165                         i.configureDialog(i);
166                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
167                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
168                 }
169         */
170                 i = spawnXonoticSingleplayerDialog();
171                 i.configureDialog(i);
172                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
173                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
174                 
175                 i = spawnXonoticMultiplayerDialog();
176                 i.configureDialog(i);
177                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
178                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
179
180                 i = spawnXonoticSettingsDialog();
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_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
184
185                 i = spawnXonoticCreditsDialog();
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_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
189                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
190
191                 i = spawnXonoticQuitDialog();
192                 i.configureDialog(i);
193                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
194                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
195                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
196                 
197         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
198         me.moveItemAfter(me, n, NULL);
199
200         me.initializeDialog(me, n);
201
202         if(cvar_string("_cl_name") == "Player")
203                 me.dialogToShow = me.firstRunDialog;
204 }
205 #endif
206
207 /* Click. The c-word is here so you can grep for it :-) */