]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/dialog_welcome.qc
Merge branch 'bones_was_here/jlhooks' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_welcome.qc
index fc7abd168a150d5d5dafb488409d572efbc3f3f6..a7646047ec62b3b572a7aa6bf7c511baad9e6c22 100644 (file)
@@ -9,8 +9,8 @@
 
 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)
@@ -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);