From: terencehill Date: Fri, 11 Mar 2022 20:39:33 +0000 (+0100) Subject: cl_welcome_in_menu_dialog 1 "1: show the welcome message in a dedicated menu dialog... X-Git-Tag: xonotic-v0.8.5~81^2~20 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9b1be706d74badec3925b51f64956ffffe4c77a8;p=xonotic%2Fxonotic-data.pk3dir.git cl_welcome_in_menu_dialog 1 "1: show the welcome message in a dedicated menu dialog; 0: show it as a centerprint message" --- diff --git a/binds-xonotic.cfg b/binds-xonotic.cfg index 9fd9877cc..2fa44700c 100644 --- a/binds-xonotic.cfg +++ b/binds-xonotic.cfg @@ -58,7 +58,7 @@ bind z messagemode2 bind u "+con_chat_maximize" bind m +hud_panel_radar_maximized bind b "quickmenu" -bind i menu_showwelcomedialog +bind i +show_info bind PAUSE pause bind F9 "cl_cmd hud minigame" bind F10 menu_showquitdialog diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index f3f06acd5..dde1467e6 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1286,15 +1286,23 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew) } } -string welcomedialog_args; NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew) { - if(welcomedialog_args) - strunzone(welcomedialog_args); - welcomedialog_args = strcat("name \"", ReadString(), "\""); - welcomedialog_args = strcat(welcomedialog_args, " motd \"", MakeConsoleSafe(strreplace("\n", "\\n", ReadString())), "\""); - localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n"); - welcomedialog_args = string_null; + string hostname = ReadString(); + string msg = ReadString(); + // players running older Xonotic version without the Welocome dialog have the cvar + // cl_welcome_in_menu_dialog not saved because it was created by the relative autocvar + // initilaization when server's client program is run + if (cvar_type("cl_welcome_in_menu_dialog") & CVAR_TYPEFLAG_SAVED && autocvar_cl_welcome_in_menu_dialog) + { + string welcomedialog_args; + welcomedialog_args = strcat("name \"", hostname, "\""); + msg = MakeConsoleSafe(strreplace("\n", "\\n", msg)); + welcomedialog_args = strcat(welcomedialog_args, " motd \"", msg, "\""); + localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n"); + } + else + centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", msg), -1, 0); return true; } diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 83417c08d..56dae7f4f 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -19,6 +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; // Map coordinate base calculations need these vector mi_center; diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index 4c3166649..86ba9a794 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -17,6 +17,7 @@ void welcomeDialog_resetStrings(entity me) strunzone(me.serverinfo_MOTD); me.serverinfo_MOTD = strzone(_("")); } + float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift) { switch(key) @@ -24,21 +25,19 @@ float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shif case K_KP_ENTER: case K_ENTER: case K_SPACE: - XonoticWelcomeDialog_close(me); + me.close(me); return true; default: return SUPER(XonoticWelcomeDialog).keyDown(me, key, ascii, shift); } } -void XonoticWelcomeDialog_close(entity me) -{ - SUPER(XonoticWelcomeDialog).close(me); -} + void XonoticWelcomeDialog_configureDialog(entity me) { welcomeDialog_resetStrings(me); SUPER(XonoticWelcomeDialog).configureDialog(me); } + void XonoticWelcomeDialog_readInputArgs(entity me, float argsbuf) { int i = 0; @@ -63,7 +62,6 @@ void XonoticWelcomeDialog_readInputArgs(entity me, float argsbuf) } ++i; } - localcmd("\nwait; wait; +show_info; wait; wait; -show_info\n"); //me.serverinfo_name_ent.setText(me.serverinfo_name_ent, me.serverinfo_name); me.serverinfo_MOTD_ent.setText(me.serverinfo_MOTD_ent, me.serverinfo_MOTD); me.frame.setText(me.frame, me.serverinfo_name); diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index a1666ed02..bc6c06d82 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qh +++ b/qcsrc/menu/xonotic/dialog_welcome.qh @@ -11,7 +11,6 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog) ATTRIB(XonoticWelcomeDialog, name, string, "Welcome"); METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float)); - METHOD(XonoticWelcomeDialog, close, void(entity)); METHOD(XonoticWelcomeDialog, configureDialog, void(entity)); METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, float)); ATTRIB(XonoticWelcomeDialog, serverinfo_name, string, string_null); diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index a368938c2..debc05669 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -95,6 +95,7 @@ void CampaignPreInit() cvar_settemp("g_dm", "0"); cvar_settemp("skill", ftos(baseskill)); cvar_settemp("bot_number", ftos(campaign_bots[0])); + cvar_settemp("cl_welcome_in_menu_dialog", "0"); MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false)); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 3d0fffe0a..75c98a868 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1199,14 +1199,8 @@ void ClientConnect(entity this) MUTATOR_CALLHOOK(ClientConnect, this); - if (IS_REAL_CLIENT(this)) - { - if (!autocvar_g_campaign && !IS_PLAYER(this)) - { - CS(this).motd_actived_time = -1; - Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this)); - } - } + 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 } /* ============= diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 09602a543..beac1862e 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -23,8 +23,15 @@ alias use "impulse 21" cl_particles_forcetraileffects 1 alias dropweapon "impulse 17" -alias +show_info +button7 -alias -show_info -button7 + +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 // merge lightmaps up to 2048x2048 textures mod_q3bsp_lightmapmergepower 4