]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'bones_was_here/ripoldmotd' into 'master'
authorbones_was_here <bones_was_here@xa.org.au>
Mon, 11 Jul 2022 10:01:32 +0000 (10:01 +0000)
committerbones_was_here <bones_was_here@xa.org.au>
Mon, 11 Jul 2022 10:01:32 +0000 (10:01 +0000)
Remove legacy MOTD

Closes #2619

See merge request xonotic/xonotic-data.pk3dir!1012

13 files changed:
notifications.cfg
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qh
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/xonotic/dialog_welcome.qc
qcsrc/menu/xonotic/dialog_welcome.qh
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/scores.qc
xonotic-client.cfg

index 732ed5faec28f19209e3f12cb1fdd1d9270df378..1919601d57e49a7d0e20ec0181c64ea9a613183b 100644 (file)
@@ -343,7 +343,7 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 
-// MSG_CENTER notifications (count = 243):
+// MSG_CENTER notifications (count = 242):
 seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint"
@@ -485,7 +485,6 @@ seta notification_CENTER_LMS_VISIBLE_LEADER "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_LMS_VISIBLE_OTHER "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_PLAYERS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_TEAMS "1" "0 = off, 1 = centerprint"
-seta notification_CENTER_MOTD "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MOVETOSPEC_IDLING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_NADE_BONUS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_NADE_THROW "1" "0 = off, 1 = centerprint"
@@ -750,4 +749,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa
 seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
 seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
 
-// Notification counts (total = 843): MSG_ANNCE = 80, MSG_INFO = 335, MSG_CENTER = 243, MSG_MULTI = 157, MSG_CHOICE = 28
+// Notification counts (total = 842): MSG_ANNCE = 80, MSG_INFO = 335, MSG_CENTER = 242, MSG_MULTI = 157, MSG_CHOICE = 28
index 40d6cbbc2b6c2d4a93727927645993e04ed7b524..a9e9a3d0562fb970ae4c25117689a68ab383c769 100644 (file)
@@ -1394,7 +1394,6 @@ bool net_handle_ServerWelcome()
                return true;
        }
 
-       welcome_msg_force_centerprint = ReadByte();
        strcpy(hostname, ReadString());
 
        string hostversion = ReadString();
@@ -1435,21 +1434,19 @@ void Welcome_Message_Show_Try()
        if (!welcome_msg_menu_check_maxtime)
                return;
 
-       bool want_dialog = (!welcome_msg_force_centerprint && !isdemo() && autocvar_cl_welcome_in_menu_dialog);
        // 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() || !autocvar_cl_welcome)
+                               // close it after it's been initialized so it can still be opened manually
                                localcmd("\ntogglemenu 0\n");
                }
-               else
-                       centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", welcome_msg), -1, 0);
 
                strfree(welcome_msg);
                welcome_msg_menu_check_maxtime = 0;
index a2b0fe31c962c70277b5e6987eda31e997df5a3a..a71d72d536dfb7eb930ab763a8f4798327e33a2d 100644 (file)
@@ -19,7 +19,7 @@ bool autocvar__hud_showbinds_reload;
 bool autocvar_developer_csqcentities;
 bool autocvar_cl_race_cptimes_onlyself; // TODO: move to race gamemode
 bool autocvar_cl_race_cptimes_showself = false;
-bool autocvar_cl_welcome_in_menu_dialog = true;
+bool autocvar_cl_welcome = true;
 
 // Map coordinate base calculations need these
 vector mi_center;
@@ -106,7 +106,6 @@ bool warmup_stage;
 string hostname;
 string welcome_msg;
 float welcome_msg_menu_check_maxtime;
-bool welcome_msg_force_centerprint;
 void Welcome_Message_Show_Try();
 
 void Fog_Force();
index 69483bfc3c075b19427b39d1eb808c7b4d857075..73c858fcfb8987e83a37357dd44db6aa605c4320 100644 (file)
@@ -716,8 +716,6 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_CENTER_NOTIF(INSTAGIB_FINDAMMO_FIRST,           N_ENABLE,    0, 0, "",               CPID_INSTAGIB_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!"))
     MSG_CENTER_NOTIF(INSTAGIB_LIVES_REMAINING,          N_ENABLE,    0, 1, "f1",             CPID_Null,              "0 0",  _("^F2Extra lives remaining: ^K1%s"), "")
 
-    MSG_CENTER_NOTIF(MOTD,                              N_ENABLE,    1, 0, "s1",             CPID_MOTD,              "-1 0", "^BG%s", "")
-
     MSG_CENTER_NOTIF(NIX_COUNTDOWN,                     N_ENABLE,    0, 2, "item_wepname",   CPID_NIX,               "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "")
     MSG_CENTER_NOTIF(NIX_NEWWEAPON,                     N_ENABLE,    0, 1, "item_wepname",   CPID_NIX,               "0 0",  _("^F2Active weapon: ^F1%s"), "")
 
index fb06d264af250212cea590a3e0b9b51224281898..74e313dce000995b724132e09eecf722a4fa4809 100644 (file)
@@ -62,7 +62,6 @@ ENUMCLASS(CPID)
        CASE(CPID, MISSING_TEAMS)
        CASE(CPID, MISSING_PLAYERS)
        CASE(CPID, INSTAGIB_FINDAMMO)
-       CASE(CPID, MOTD)
        CASE(CPID, NIX)
        CASE(CPID, ONSLAUGHT)
        CASE(CPID, ONS_CAPSHIELD)
index 0a5b049f57c3852970861c96cc0732bea9025b33..4bd214929658c80afa23d6c21c9cf515546f5ae2 100644 (file)
@@ -149,7 +149,7 @@ REPLICATE_INIT(bool, cvar_cl_movement_track_canjump);
 #define PHYS_INPUT_BUTTON_ZOOM(s)           PHYS_INPUT_BUTTON_BUTTON4(s)
 #define PHYS_INPUT_BUTTON_CROUCH(s)         PHYS_INPUT_BUTTON_BUTTON5(s)
 #define PHYS_INPUT_BUTTON_HOOK(s)           PHYS_INPUT_BUTTON_BUTTON6(s)
-#define PHYS_INPUT_BUTTON_INFO(s)           PHYS_INPUT_BUTTON_BUTTON7(s)
+#define PHYS_INPUT_BUTTON_INFO(s)           PHYS_INPUT_BUTTON_BUTTON7(s) // button7 is FREE
 #define PHYS_INPUT_BUTTON_DRAG(s)           PHYS_INPUT_BUTTON_BUTTON8(s)
 #define PHYS_INPUT_BUTTON_USE(s)            PHYS_INPUT_BUTTON_BUTTON_USE(s)
 #define PHYS_INPUT_BUTTON_CHAT(s)           PHYS_INPUT_BUTTON_BUTTON_CHAT(s)
index b56e8e9e4afd4ba69e8047d6afbdc04cd64119d7..2f97712b676a1dc67f0eb5bbbf2739507bb5f950 100644 (file)
@@ -93,12 +93,12 @@ void GameCommand(string theCommand)
                                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;
index 6448a0fca5333b3f71e0bc5ea736e74cf9435d7e..bf45084d73bc47b305d62ed831e09536e42f14b9 100644 (file)
@@ -82,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)
@@ -101,5 +112,5 @@ 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));
 }
index bca7e56e6e96d4eda373a949a9a466ec3c238b22..b8a85ff642d6f1e4bee58e6be8462652ad049423 100644 (file)
@@ -20,5 +20,6 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog)
        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)
index 2e6e9e6b852c84a6b6ffe5bec87524fb59e6a260..1e07dc03faa4bb8e2afa0960c0c4c063db4a2bdf 100644 (file)
@@ -1019,17 +1019,10 @@ void ClientPreConnect(entity this)
 }
 #endif
 
-void SendWelcomemessage(entity this, bool force_centerprint)
-{
-       msg_entity = this;
-       WriteHeader(MSG_ONE, TE_CSQC_SERVERWELCOME);
-       SendWelcomemessage_msg_type(this, force_centerprint, MSG_ONE);
-}
-
 // NOTE csqc uses the active mutators list sent by this function
 // to understand which mutators are enabled
 // also note that they aren't all registered mutators, e.g. jetpack, low gravity
-void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_type)
+void SendWelcomeMessage(entity this, int msg_type)
 {
        WriteByte(msg_type, boolean(autocvar_g_campaign));
        if (boolean(autocvar_g_campaign))
@@ -1039,7 +1032,6 @@ void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_ty
                WriteString(msg_type, Campaign_GetMessage());
                return;
        }
-       WriteByte(msg_type, force_centerprint);
        WriteString(msg_type, autocvar_hostname);
        WriteString(msg_type, autocvar_g_xonoticversion);
        WriteByte(msg_type, CS(this).version_mismatch);
@@ -1177,9 +1169,6 @@ void ClientConnect(entity this)
 
        if (player_count == 1)
                localcmd("\nsv_hook_firstjoin\n");
-
-       if (IS_REAL_CLIENT(this) && !IS_PLAYER(this) && !autocvar_g_campaign)
-               CS(this).motd_actived_time = -1; // the welcome message is shown by the client
 }
 /*
 =============
@@ -2038,62 +2027,6 @@ int nJoinAllowed(entity this, entity ignore)
        return free_slots;
 }
 
-void PrintWelcomeMessage(entity this)
-{
-       if(CS(this).motd_actived_time == 0)
-       {
-               if (autocvar_g_campaign) {
-                       if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
-                               CS(this).motd_actived_time = time;
-                               SendWelcomemessage(this, false);
-                       }
-               } else {
-                       if (PHYS_INPUT_BUTTON_INFO(this)) {
-                               CS(this).motd_actived_time = time;
-                               SendWelcomemessage(this, true);
-                       }
-               }
-       }
-       else if(CS(this).motd_actived_time > 0) // showing MOTD or campaign message
-       {
-               if (autocvar_g_campaign) {
-                       if (PHYS_INPUT_BUTTON_INFO(this))
-                               CS(this).motd_actived_time = time;
-                       else if ((time - CS(this).motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
-                               CS(this).motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
-                       }
-               } else {
-                       if (PHYS_INPUT_BUTTON_INFO(this))
-                               CS(this).motd_actived_time = time;
-                       else if (time - CS(this).motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
-                               CS(this).motd_actived_time = 0;
-                               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
-                       }
-               }
-       }
-       else //if(CS(this).motd_actived_time < 0) // just connected, motd is active
-       {
-               if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
-                       CS(this).motd_actived_time = -2; // wait until BUTTON_INFO gets released
-               else if (CS(this).motd_actived_time == -2)
-               {
-                       // instantly hide MOTD
-                       CS(this).motd_actived_time = 0;
-                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
-               }
-               else if (IS_PLAYER(this) || IS_SPEC(this))
-               {
-                       // FIXME occasionally for some reason MOTD never goes away
-                       // delay MOTD removal a little bit in the hope it fixes this bug
-                       if (CS(this).motd_actived_time == -1) // MOTD marked to fade away as soon as client becomes player or spectator
-                               CS(this).motd_actived_time = -(5 + floor(random() * 10)); // add small delay
-                       else //if (CS(this).motd_actived_time < -2)
-                               CS(this).motd_actived_time++;
-               }
-       }
-}
-
 bool joinAllowed(entity this)
 {
        if (CS(this).version_mismatch) return false;
@@ -2525,9 +2458,6 @@ void PlayerPreThink (entity this)
                PlayerUseKey(this);
        CS(this).usekeypressed = PHYS_INPUT_BUTTON_USE(this);
 
-       if (IS_REAL_CLIENT(this))
-               PrintWelcomeMessage(this);
-
        if (IS_PLAYER(this)) {
                if (IS_REAL_CLIENT(this) && time < CS(this).jointime + MIN_SPEC_TIME)
                        error("Client can't be spawned as player on connection!");
index 5fc5422c63f7e55e5d4316f1a91fad7f3b0bdce5..9ba57f1931a33f0c1bf8d911ce0c7db80d6780b4 100644 (file)
@@ -64,7 +64,6 @@ bool autocvar_sv_showspectators;
 .float jointime; // time of connecting
 .float startplaytime; // time of switching from spectator to player
 .float alivetime; // time of being alive
-.float motd_actived_time; // used for both motd and campaign_message
 
 .bool wasplayer;
 
@@ -159,7 +158,6 @@ CLASS(Client, Object)
     ATTRIB(Client, teamkill_soundtime, float, this.teamkill_soundtime);
     ATTRIB(Client, teamkill_soundsource, entity, this.teamkill_soundsource);
     ATTRIB(Client, usekeypressed, bool, this.usekeypressed);
-    ATTRIB(Client, motd_actived_time, float, this.motd_actived_time);
     ATTRIB(Client, jointime, float, this.jointime);
     ATTRIB(Client, spectatortime, float, this.spectatortime);
     ATTRIB(Client, startplaytime, float, this.startplaytime);
@@ -320,7 +318,7 @@ bool independent_players;
 .float nickspamtime; // time of last nick change
 .float nickspamcount;
 
-void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_type);
+void SendWelcomeMessage(entity this, int msg_type);
 
 // respawning
 .int respawn_flags;
index b6244ee24ba2a5e8eb820e9a59581433f8c34374..512f61ad231ae5d4255ec197a7b4d0667416220a 100644 (file)
@@ -214,7 +214,7 @@ bool ScoreInfo_SendEntity(entity this, entity to, int sf)
        WriteByte(MSG_ENTITY, welcome_msg_too);
        // welcome message is sent here because it needs to know the gametype
        if (welcome_msg_too)
-               SendWelcomemessage_msg_type(to, false, MSG_ENTITY);
+               SendWelcomeMessage(to, MSG_ENTITY);
        return true;
 }
 
index 7a0dec6890d33f858326018b9a0c59976989ce15..e751bcc2c168966469557ef2106c0e4b5edd7374 100644 (file)
@@ -24,14 +24,14 @@ cl_particles_forcetraileffects 1
 
 alias dropweapon "impulse 17"
 
+// support for servers still using the old centreprint MOTD
 alias +show_info0 "+button7"
 alias -show_info0 "-button7"
 alias +show_info1 "menu_showwelcomedialog"
 alias -show_info1 ""
-
-seta cl_welcome_in_menu_dialog 1 "1: show the welcome message in a dedicated menu dialog; 0: show it as a centerprint message"
-alias +show_info +show_info$cl_welcome_in_menu_dialog
-alias -show_info -show_info$cl_welcome_in_menu_dialog
+alias +show_info +show_info$_menu_welcome_dialog_available
+alias -show_info -show_info$_menu_welcome_dialog_available
+seta cl_welcome 1 "1: show the Welcome dialog when connecting; 0: show it only when +show_info keybind is pressed"
 
 // merge lightmaps up to 2048x2048 textures
 mod_q3bsp_lightmapmergepower 4