From: terencehill Date: Wed, 4 Oct 2023 21:43:33 +0000 (+0200) Subject: Make sure that the profile apply button command has really taken effect before updati... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d5244d30e2a7103ae47a2dc82b8712d8f309bd9;p=xonotic%2Fxonotic-data.pk3dir.git Make sure that the profile apply button command has really taken effect before updating cvars. Drop support for syncing name changed in console with menu as it is incompatible with this patch --- diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 710dca1e6..453737b02 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -67,6 +67,7 @@ void m_init() } prvm_language = strzone(prvm_language); cvar_set("_menu_prvm_language", prvm_language); + cvar_set("_menu_profile_apply_button_command_executed", "1"); #ifdef WATERMARK LOG_TRACEF("^4MQC Build information: ^1%s", WATERMARK); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc index f15969a1d..a101ef76c 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc @@ -34,6 +34,7 @@ entity makeXonoticProfileTab() return me; } +bool autocvar__menu_profile_apply_button_command_executed; void XonoticProfileTab_draw(entity me) { string name = cvar_string("_cl_name"); @@ -42,10 +43,12 @@ void XonoticProfileTab_draw(entity me) me.playerNameLabel.alpha = ((mod(time * 2, 2) < 1) ? 1 : 0); else me.playerNameLabel.alpha = me.playerNameLabelAlpha; - - // if values changed from console, update it in menu - if (me.applyButton.disabled) + + // if this cvar is set then we are sure the apply button command has really taken effect + // we can't assume that it gets executed in one frame due to how cmd works + if (autocvar__menu_profile_apply_button_command_executed) { + cvar_set("_menu_profile_apply_button_command_executed", "0"); // name field string inputName = cvar_string(MENU_CVAR_NAME); if (name != inputName) @@ -97,6 +100,7 @@ void XonoticProfileTab_fill(entity me) "name \"$"MENU_CVAR_NAME"\";" "playermodel $"MENU_CVAR_MODEL";" "playerskin $"MENU_CVAR_SKIN";" + "_menu_profile_apply_button_command_executed 1;" , COMMANDBUTTON_APPLY); me.applyButton.disableOnClick = true; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index c5af7159d..e99e3232c 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -287,6 +287,7 @@ set _menu_cl_name "" set _menu_cl_color "" set _menu_cl_playerskin "" set _menu_cl_playermodel "" +set _menu_profile_apply_button_command_executed 0 // effects r_glsl_vertextextureblend_usebothalphas 1 // allows to abuse texture blending as detail texture