From f645cbcbc879e545021572e5ef0da5c0b66ed3f8 Mon Sep 17 00:00:00 2001 From: z411 Date: Mon, 16 May 2022 22:16:01 -0400 Subject: [PATCH] Add join button to Welcome dialog and make it default --- qcsrc/menu/xonotic/dialog_welcome.qc | 9 ++++----- qcsrc/menu/xonotic/dialog_welcome.qh | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index ca80ef4dd..bf4edb9c7 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -20,7 +20,7 @@ float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shif case K_KP_ENTER: case K_ENTER: case K_SPACE: - me.close(me); + XonoticCommandButton_Click(me.joinButton_ent, me); return true; default: return SUPER(XonoticWelcomeDialog).keyDown(me, key, ascii, shift); @@ -95,8 +95,7 @@ void XonoticWelcomeDialog_fill(entity me) me.serverinfo_MOTD_ent.allowColors = true; me.serverinfo_MOTD_ent.escapedNewLines = true; me.gotoRC(me, me.rows - 1, 0); - me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0')); - e.onClick = Dialog_Close; - e.onClickEntity = me; - e.preferredFocusPriority = 1; + me.TD(me, 1, me.columns / 2, me.joinButton_ent = makeXonoticCommandButton(_("join"), '0 1 0', "cmd join", COMMANDBUTTON_CLOSE)); + me.joinButton_ent.preferredFocusPriority = 1; + me.TD(me, 1, me.columns / 2, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", COMMANDBUTTON_CLOSE)); } diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index d02cd6e73..bca7e56e6 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qh +++ b/qcsrc/menu/xonotic/dialog_welcome.qh @@ -19,5 +19,6 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog) //ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world); ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD, string, string_null); ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD_ent, entity, world); + ATTRIB(XonoticWelcomeDialog, joinButton_ent, entity, world); ATTRIB(XonoticWelcomeDialog, requiresConnection, bool, true); ENDCLASS(XonoticWelcomeDialog) -- 2.39.2