cvar_set("_menu_gamemenu_dialog_available", "0");
}
+void XonoticGameMenuDialog_draw(entity me)
+{
+ entity btn = me.joinButton;
+ if(cvar("g_campaign"))
+ {
+ if (btn.toString(btn) == _("Join!"))
+ {
+ btn.setText(btn, _("Restart level"));
+ btn.onClickCommand = "resetmatch";
+ }
+ }
+ else
+ {
+ if (btn.toString(btn) == _("Restart level"))
+ {
+ btn.setText(btn, _("Join!"));
+ btn.onClickCommand = "join";
+ }
+ }
+ SUPER(XonoticGameMenuDialog).draw(me);
+}
+
void XonoticGameMenuDialog_fill(entity me)
{
registercvar("_menu_gamemenu_dialog_available", "0", 0);
me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Quick menu"), '0 0 0', "quickmenu", COMMANDBUTTON_CLOSE));
me.TR(me);
me.TR(me);
- me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Join!"), '0 0 0', "join", COMMANDBUTTON_CLOSE));
+ me.TD(me, 1, 1, e = me.joinButton = makeXonoticCommandButton(_("Join!"), '0 0 0', "join", COMMANDBUTTON_CLOSE));
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Spectate"), '0 0 0', "spec", COMMANDBUTTON_CLOSE));
me.TR(me);
#include "rootdialog.qh"
CLASS(XonoticGameMenuDialog, XonoticRootDialog)
+ METHOD(XonoticGameMenuDialog, draw, void(entity));
METHOD(XonoticGameMenuDialog, destroy, void(entity));
METHOD(XonoticGameMenuDialog, fill, void(entity));
ATTRIB(XonoticGameMenuDialog, title, string, _("Game menu"));
ATTRIB(XonoticGameMenuDialog, columns, float, 1);
ATTRIB(XonoticGameMenuDialog, name, string, "GameMenu");
ATTRIB(XonoticGameMenuDialog, requiresConnection, bool, true);
+ ATTRIB(XonoticGameMenuDialog, joinButton, entity, world);
ENDCLASS(XonoticGameMenuDialog)