X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fdialog_welcome.qc;h=a7646047ec62b3b572a7aa6bf7c511baad9e6c22;hb=50ce40f7278957bcd42639ca3dcfbf55692aa298;hp=fc7abd168a150d5d5dafb488409d572efbc3f3f6;hpb=9f000a362078b9f77715ffdac2c729ad8dd8c417;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index fc7abd168..a7646047e 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -9,8 +9,8 @@ void welcomeDialog_resetStrings(entity me) { - strcpy(me.serverinfo_name, ""); - strcpy(me.serverinfo_MOTD, ""); + strcpy(me.serverinfo_name, _("Welcome")); + strcpy(me.serverinfo_MOTD, ""); } float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift) @@ -27,6 +27,18 @@ float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shif } } +// the same implentation in mousePress apparently works, but for some reason if you try to open +// the dialog again it doesn't show up and requires opening it a seconds time to show up +bool XonoticWelcomeDialog_mouseRelease(entity me, vector pos) +{ + if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) + { + return SUPER(XonoticWelcomeDialog).mouseRelease(me, pos); + } + me.close(me); + return true; +} + void XonoticWelcomeDialog_destroy(entity me) { cvar_set("_menu_welcome_dialog_available", "0"); @@ -44,6 +56,11 @@ void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf) 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); @@ -51,6 +68,18 @@ void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf) 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);