X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fdialog_welcome.qc;h=bf45084d73bc47b305d62ed831e09536e42f14b9;hb=7813b4aefcef935a31a09287fc4618234b154dc6;hp=a7646047ec62b3b572a7aa6bf7c511baad9e6c22;hpb=a4133baa73c78a12232ee297177451c729bede72;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index a7646047e..bf45084d7 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); @@ -71,6 +71,10 @@ void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf) void XonoticWelcomeDialog_draw(entity me) { SUPER(XonoticWelcomeDialog).draw(me); + + if (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))) + me.close(me); + if(me.serverinfo_MOTD == "" && gamestatus & (GAME_CONNECTED | GAME_ISSERVER)) { // if serverinfo_MOTD is empty while connected it means we are connected to an old server @@ -78,6 +82,17 @@ void XonoticWelcomeDialog_draw(entity me) localcmd("\n+show_info0; defer 2 -show_info0\n"); me.close(me); } + + if (isdemo()) + { + me.joinButton_ent.disabled = true; + me.spectateButton_ent.disabled = true; + } + else + { + me.joinButton_ent.disabled = false; + me.spectateButton_ent.disabled = false; + } } void XonoticWelcomeDialog_fill(entity me) @@ -85,6 +100,8 @@ void XonoticWelcomeDialog_fill(entity me) registercvar("_menu_welcome_dialog_available", "0", 0); cvar_set("_menu_welcome_dialog_available", "1"); + me.frame.allowColors = true; // allow color codes in the title + entity e; me.TR(me); @@ -93,8 +110,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, me.spectateButton_ent = makeXonoticCommandButton(_("Spectate"), '0 0 0', "cmd spectate", COMMANDBUTTON_CLOSE)); }