if (!welcome_msg_menu_check_maxtime)
return;
- bool want_dialog = !isdemo();
// if want dialog check if menu is initialized but for a short time
- if (!want_dialog || cvar("_menu_initialized") == 2 || time > welcome_msg_menu_check_maxtime)
+ if (cvar("_menu_initialized") == 2 || time > welcome_msg_menu_check_maxtime)
{
- if (want_dialog && cvar("_menu_welcome_dialog_available"))
+ if (cvar("_menu_welcome_dialog_available"))
{
string welcomedialog_args = strcat("HOSTNAME \"", hostname, "\"");
string msg = MakeConsoleSafe(strreplace("\n", "\\n", welcome_msg));
welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\"");
localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
- if (intermission) // close it after it's been initialized so it can still be opened manually
+ if (intermission || isdemo()) // close it after it's been initialized so it can still be opened manually
localcmd("\ntogglemenu 0\n");
}
LOG_HELP(" ", s);
});
}
- else if (argc == 2 && !isdemo()) // don't allow this command in demos
+ else if (argc == 2 && (!isdemo() || argv(1) == "Welcome")) // don't allow this command in demos
{
m_play_click_sound(MENU_SOUND_OPEN);
m_goto(strcat(filter, argv(1))); // switch to a menu item
}
- else if(argc > 2 && !isdemo())
+ else if(argc > 2 && (!isdemo() || argv(1) == "Welcome"))
{
entity e = NULL;
float argsbuf = 0;
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)
me.gotoRC(me, me.rows - 1, 0);
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));
+ me.TD(me, 1, me.columns / 2, me.spectateButton_ent = makeXonoticCommandButton(_("Spectate"), '0 0 0', "cmd spectate", COMMANDBUTTON_CLOSE));
}
ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD, string, string_null);
ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD_ent, entity, world);
ATTRIB(XonoticWelcomeDialog, joinButton_ent, entity, world);
+ ATTRIB(XonoticWelcomeDialog, spectateButton_ent, entity, world);
ATTRIB(XonoticWelcomeDialog, requiresConnection, bool, true);
ENDCLASS(XonoticWelcomeDialog)