Xonotic
mainwindow.qc File Reference
#include "mainwindow.qh"
#include <menu/mutators/_mod.qh>
#include "nexposee.qh"
#include "inputbox.qh"
#include "dialog_termsofservice.qh"
#include "dialog_firstrun.qh"
#include "dialog_hudsetup_exit.qh"
#include "dialog_hudpanel_notification.qh"
#include "dialog_hudpanel_ammo.qh"
#include "dialog_hudpanel_healtharmor.qh"
#include "dialog_hudpanel_chat.qh"
#include "dialog_hudpanel_modicons.qh"
#include "dialog_hudpanel_powerups.qh"
#include "dialog_hudpanel_pressedkeys.qh"
#include "dialog_hudpanel_racetimer.qh"
#include "dialog_hudpanel_radar.qh"
#include "dialog_hudpanel_score.qh"
#include "dialog_hudpanel_timer.qh"
#include "dialog_hudpanel_vote.qh"
#include "dialog_hudpanel_weapons.qh"
#include "dialog_hudpanel_engineinfo.qh"
#include "dialog_hudpanel_infomessages.qh"
#include "dialog_hudpanel_physics.qh"
#include "dialog_hudpanel_centerprint.qh"
#include "dialog_hudpanel_itemstime.qh"
#include "dialog_hudpanel_quickmenu.qh"
#include "dialog_hudpanel_strafehud.qh"
#include "dialog_settings_input_userbind.qh"
#include "dialog_settings_bindings_reset.qh"
#include "dialog_settings_misc_cvars.qh"
#include "dialog_settings_misc_reset.qh"
#include "dialog_settings_user_languagewarning.qh"
#include "dialog_settings_game_hudconfirm.qh"
#include "dialog_singleplayer_winner.qh"
#include "dialog_multiplayer_join_serverinfo.qh"
#include "dialog_multiplayer_media_demo_startconfirm.qh"
#include "dialog_multiplayer_media_demo_timeconfirm.qh"
#include "dialog_multiplayer_media_screenshot_viewer.qh"
#include "dialog_multiplayer_create_mapinfo.qh"
#include "dialog_multiplayer_create_mutators.qh"
#include "dialog_sandboxtools.qh"
#include "dialog_monstertools.qh"
#include "dialog_teamselect.qh"
#include "dialog_uid2name.qh"
#include "dialog_singleplayer.qh"
#include "dialog_multiplayer.qh"
#include "dialog_settings.qh"
#include "dialog_credits.qh"
#include "dialog_quit.qh"
#include "dialog_disconnect.qh"
+ Include dependency graph for mainwindow.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void DemoButton_Click (entity me, entity other)
 
void MainWindow_configureMainWindow (entity me)
 
void MainWindow_draw (entity me)
 

Function Documentation

◆ DemoButton_Click()

void DemoButton_Click ( entity  me,
entity  other 
)

Definition at line 102 of file mainwindow.qc.

103 {
104  if(me.text == _("Do not press this button again!"))
106  else
107  me.setText(me, _("Do not press this button again!"));
108 }
void DialogOpenButton_Click(entity button, entity tab)
entity other
Definition: csprogsdefs.qc:14

◆ MainWindow_configureMainWindow()

void MainWindow_configureMainWindow ( entity  me)

Definition at line 110 of file mainwindow.qc.

References conheight, entity(), eX, eY, MUTATOR_CALLHOOK, NEW, and NULL.

111 {
112  entity n, i;
113 
114  // terms of service dialog
115  me.ToSDialog = i = NEW(XonoticToSDialog);
116  i.configureDialog(i);
117  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
118 
119  // dialog run upon startup
120  me.firstRunDialog = i = NEW(XonoticFirstRunDialog);
121  i.configureDialog(i);
122  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
123 
124 
125  // hud_configure dialogs
127  i.configureDialog(i);
128  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129 
131  i.configureDialog(i);
132  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133 
135  i.configureDialog(i);
136  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137 
139  i.configureDialog(i);
140  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141 
143  i.configureDialog(i);
144  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
145 
147  i.configureDialog(i);
148  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149 
151  i.configureDialog(i);
152  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
153 
155  i.configureDialog(i);
156  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
157 
159  i.configureDialog(i);
160  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
161 
163  i.configureDialog(i);
164  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
165 
167  i.configureDialog(i);
168  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169 
171  i.configureDialog(i);
172  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
173 
175  i.configureDialog(i);
176  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
177 
179  i.configureDialog(i);
180  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
181 
183  i.configureDialog(i);
184  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185 
187  i.configureDialog(i);
188  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
189 
191  i.configureDialog(i);
192  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
193 
195  i.configureDialog(i);
196  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
197 
199  i.configureDialog(i);
200  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
201 
203  i.configureDialog(i);
204  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
205 
207  i.configureDialog(i);
208  me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
209 
210  // dialogs used by settings
211  me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
212  i.configureDialog(i);
213  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
214 
215  me.bindingsResetDialog = i = NEW(XonoticBindingsResetDialog);
216  i.configureDialog(i);
217  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
218 
219  me.cvarsDialog = i = NEW(XonoticCvarsDialog);
220  i.configureDialog(i);
221  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
222 
223  me.resetDialog = i = NEW(XonoticResetDialog);
224  i.configureDialog(i);
225  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
226 
227  me.languageWarningDialog = i = NEW(XonoticLanguageWarningDialog);
228  i.configureDialog(i);
229  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
230 
231  me.hudconfirmDialog = i = NEW(XonoticHUDConfirmDialog);
232  i.configureDialog(i);
233  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
234 
235 
236  // dialog used by singleplayer
237  me.winnerDialog = i = NEW(XonoticWinnerDialog);
238  i.configureDialog(i);
239  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
240 
241 
242  // dialog used by multiplayer/join
243  me.serverInfoDialog = i = NEW(XonoticServerInfoDialog);
244  i.configureDialog(i);
245  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
246 
247  me.demostartconfirmDialog = i = NEW(XonoticDemoStartConfirmDialog);
248  i.configureDialog(i);
249  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
250 
251  me.demotimeconfirmDialog = i = NEW(XonoticDemoTimeConfirmDialog);
252  i.configureDialog(i);
253  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
254 
255 
256  // dialogs used by multiplayer/create
257  me.mapInfoDialog = i = NEW(XonoticMapInfoDialog);
258  i.configureDialog(i);
259  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
260 
261  me.mutatorsDialog = i = NEW(XonoticMutatorsDialog);
262  i.configureDialog(i);
263  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
264 
265 
266  // dialogs used by multiplayer/media
267  me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
268  i.configureDialog(i);
269  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
270 
271 
272  // mutator dialogs
274  i.configureDialog(i);
275  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
276 
277 
278  // miscellaneous dialogs
280  i.configureDialog(i);
281  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
282 
284  i.configureDialog(i);
285  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
286 
288  i.configureDialog(i);
289  me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
290 
291  MUTATOR_CALLHOOK(ConfigureDialogs, me);
292 
293 
294  // main dialogs/windows
295  me.mainNexposee = n = NEW(XonoticNexposee);
296 
297  /*
298  if(checkextension("DP_GECKO_SUPPORT"))
299  {
300  i = spawnXonoticNewsDialog();
301  i.configureDialog(i);
302  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
303  n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
304  }
305  */
306 
308  i.configureDialog(i);
309  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
310  n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
311 
313  i.configureDialog(i);
314  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
315  n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
316 
318  i.configureDialog(i);
319  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
320  n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
321 
323  i.configureDialog(i);
324  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
325  n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
326  n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
327 
328  //Disconnect dialog at center of screen (between credits and quit)
330  i.configureDialog(i);
331  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
332  n.setNexposee(n, i, '0.5 1.2 0.0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
333  n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
334  me.disconnectDialog = i;
335 
336  i = NEW(XonoticQuitDialog);
337  i.configureDialog(i);
338  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
339  n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
340  n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
341 
342  me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
343  me.moveItemAfter(me, n, NULL);
344 
345  me.initializeDialog(me, n);
346  me.disconnectDialogVisibility = 1;
347 }
const vector eY
Definition: vector.qh:45
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
#define NULL
Definition: post.qh:17
const vector eX
Definition: vector.qh:44
#define MUTATOR_CALLHOOK(id,...)
Definition: base.qh:140
+ Here is the call graph for this function:

◆ MainWindow_draw()

void MainWindow_draw ( entity  me)

Definition at line 58 of file mainwindow.qc.

References conheight, conwidth, DialogOpenButton_Click_withCoords(), entity(), eX, eY, GAME_CONNECTED, GAME_ISSERVER, gamestatus, NULL, and SUPER.

59 {
60  SUPER(MainWindow).draw(me);
61 
62  if (me.firstDraw) {
63  if (me.ToSDialog.shouldShow())
64  {
65  me.ToSDialog.loadXonoticToS(me.ToSDialog);
66  DialogOpenButton_Click_withCoords(NULL, me.ToSDialog, '0 0 0', eX * conwidth + eY * conheight);
67  }
68  else if(me.firstRunDialog.shouldShow())
69  DialogOpenButton_Click_withCoords(NULL, me.firstRunDialog, '0 0 0', eX * conwidth + eY * conheight);
70 
71  me.firstDraw = false;
72  }
73 
74  //-------------------------------------
75  // Part of Disconnect Dialog button:
76  // In case of this function is recalling every time, need to use condition of visibility
77 
78  if (me.disconnectDialogVisibility && !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)))
79  {
80  // If gamestate is not "ingame" (and it is a first "frame" of drawing (or dialog is visible)),
81  // disconnect button is unnecessary, remove it
82  me.removeItem(me.mainNexposee, me.disconnectDialog);
83  me.disconnectDialogVisibility = 0;
84 
85  } else if(!me.disconnectDialogVisibility && (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))) {
86 
87  // If gamestate is "ingame" (and dialog is not visible),
88  // make disconnect button visible
89  entity n, i;
90  n = me.mainNexposee;
91  i = me.disconnectDialog;
92  n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93  n.setNexposee(n, i, '0.5 1.2 0.0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
94  me.disconnectDialogVisibility = 1;
95  }
96 
97  // I haven't found the best solution for making button visible.
98  // Alpha channel is the worst thing, because dialog with alpha is also clickable
99  //-------------------------------------
100 }
const vector eY
Definition: vector.qh:45
entity() spawn
void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize)
#define SUPER(cname)
Definition: oo.qh:219
#define NULL
Definition: post.qh:17
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function: