]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make sure that the profile apply button command has really taken effect before updati...
authorterencehill <piuntn@gmail.com>
Wed, 4 Oct 2023 21:43:33 +0000 (23:43 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 4 Oct 2023 21:43:33 +0000 (23:43 +0200)
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/dialog_multiplayer_profile.qc
xonotic-client.cfg

index 710dca1e6685be3d57671237bd9a1647148cfa55..453737b02d2aadef95a90b1d979a63bc4eb13cb2 100644 (file)
@@ -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);
index f15969a1d9ec39b4b8e39843fd41579048e6c80e..a101ef76cbaa6d1f1449fd4d35b1099ad29ac613 100644 (file)
@@ -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;
 
index c5af7159d3cfdb87a446642000a8afc63d16c0d6..e99e3232c5b3070e6efe36ed56462fe902159363 100644 (file)
@@ -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