Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
leavematchbutton.qc
Go to the documentation of this file.
1#include "leavematchbutton.qh"
2
3// resets g_campaign and updates menu items to reflect cvar values that may have been restored after leaving the campaign
4// the delay is for allowing listening to the button sound (if enabled), since the disconnect command stops all sounds
5// menu_sync is also useful when leaving Instant Action mode
6// see also m_draw
7const string LEAVEMATCH_CMD = "defer 0.4 disconnect; defer 0.4 wait; defer 0.4 \"g_campaign 0\"; defer 0.4 menu_sync";
8
10{
11 if (me.disabled)
12 return _("Leave current match");
13 else if(isdemo())
14 return _("Stop demo");
15 else if(cvar("g_campaign"))
16 return _("Leave campaign");
17 else if (isServerSingleplayer())
18 return _("Leave singleplayer");
19 else
20 return _("Leave multiplayer");
21}
22
24{
25 if (me.disabled || isdemo())
26 return "-";
27 else if(cvar("g_campaign"))
28 return _("Leave current campaign level");
29 else if (isServerSingleplayer())
30 return _("Leave current singleplayer match");
31 else
32 return _("Leave current multiplayer match / Disconnect from the server");
33}
34
36{
37 entity me;
39 me.configureXonoticLeaveMatchButton(me, theColor, theFlags);
40 return me;
41}
42
50
52{
53 me.configureXonoticCommandButton(me, string_null, theColor, LEAVEMATCH_CMD, theFlags, string_null);
55}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity makeXonoticLeaveMatchButton(vector theColor, int theFlags)
string leaveMatchButton_getText(entity me)
void XonoticLeaveMatchButton_draw(entity me)
const string LEAVEMATCH_CMD
void XonoticLeaveMatchButton_configureXonoticLeaveMatchButton(entity me, vector theColor, int theFlags)
string leaveMatchButton_getTooltip(entity me)
bool isServerSingleplayer()
Definition util.qc:804
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257
const int GAME_ISSERVER
Definition menu.qh:11
const int GAME_CONNECTED
Definition menu.qh:12
int gamestatus
Definition menu.qh:16
float isdemo()
float cvar(string name)
string string_null
Definition nil.qh:9
#define NEW(cname,...)
Definition oo.qh:117
#define SUPER(cname)
Definition oo.qh:231
vector
Definition self.qh:92