}
}
+const int MIN_DISCONNECTION_TIME = 1;
float autocvar_menu_force_on_disconnection;
bool autocvar_g_campaign;
void m_draw(float width, float height)
{
if (autocvar_g_campaign)
{
- if (connected_time && time - connected_time > 1)
+ if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
{
// in the case player uses the disconnect command (in the console or with a key)
// reset g_campaign and update menu items to reflect cvar values that may have been restored after quiting the campaign
}
if (autocvar_menu_force_on_disconnection > 0)
{
- if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection)
+ if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
{
m_toggle(true);
- connected_time = 0;
}
}
+ if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
+ {
+ localcmd("\nmenu_cmd directmenu Welcome RESET\n");
+ connected_time = 0;
+ }
}
else
connected_time = time;
void welcomeDialog_resetStrings(entity me)
{
- strcpy(me.serverinfo_name, "<NO HOSTNAME>");
- strcpy(me.serverinfo_MOTD, "<NO WELCOME MESSAGE>");
+ strcpy(me.serverinfo_name, _("Welcome"));
+ strcpy(me.serverinfo_MOTD, "");
}
float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift)
strcpy(me.serverinfo_name, bufstr_get(argsbuf, ++i));
else if(s == "WELCOME")
strcpy(me.serverinfo_MOTD, bufstr_get(argsbuf, ++i));
+ else if(s == "RESET")
+ {
+ welcomeDialog_resetStrings(me);
+ break;
+ }
++i;
}
//me.serverinfo_name_ent.setText(me.serverinfo_name_ent, me.serverinfo_name);
me.frame.setText(me.frame, me.serverinfo_name);
}
+void XonoticWelcomeDialog_draw(entity me)
+{
+ SUPER(XonoticWelcomeDialog).draw(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
+ // in this case show the csqc welcome message and instantly close the dialog
+ localcmd("\n+show_info0; defer 2 -show_info0\n");
+ me.close(me);
+ }
+}
+
void XonoticWelcomeDialog_fill(entity me)
{
registercvar("_menu_welcome_dialog_available", "0", 0);
ATTRIB(XonoticWelcomeDialog, columns, float, 4);
ATTRIB(XonoticWelcomeDialog, name, string, "Welcome");
+ METHOD(XonoticWelcomeDialog, draw, void(entity));
METHOD(XonoticWelcomeDialog, mouseRelease, bool(entity, vector));
METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float));
METHOD(XonoticWelcomeDialog, destroy, void(entity));
//ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world);
ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD, string, string_null);
ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD_ent, entity, world);
+ ATTRIB(XonoticWelcomeDialog, requiresConnection, bool, true);
ENDCLASS(XonoticWelcomeDialog)
set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!"
set menu_showboxes 0 "show item bounding boxes (debug)"
set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list"
-set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)"
+set menu_force_on_disconnection 1 "force to show the menu after you get disconnected"
set _menu_credits_export 0 "set to 1 and restart the menu to export credits to credits.txt (menu will automatically reset to 0)"
alias menu_credits_export "_menu_credits_export 1; menu_restart"