From: terencehill Date: Sat, 15 Dec 2012 15:03:27 +0000 (+0100) Subject: New cvar _hud_showbinds_reload 0 "set it to 1 to reload binds if you changed any... X-Git-Tag: xonotic-v0.7.0~113^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8ae2a2c8b5e97e72dae7fe2cc9450ceafc3f650c;p=xonotic%2Fxonotic-data.pk3dir.git New cvar _hud_showbinds_reload 0 "set it to 1 to reload binds if you changed any. It is reset to 0 automatically". When you change a bind through the menu this cvar is toogled on automatically, allowing for example to refresh immediately keys bound to weapons in the HUD. --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 5179bb2ab..ba88a2a4f 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -35,6 +35,7 @@ alias hud_panel_radar_maximized "cl_cmd hud radar" // other hud cvars seta hud_showbinds 1 "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both" seta hud_showbinds_limit 2 "maximum number of bound keys to show for a command. 0 for unlimited" +set _hud_showbinds_reload 0 "set it to 1 to reload binds if you changed any. It is reset to 0 automatically" seta hud_colorflash_alpha 0.5 "starting alpha of the color flash" diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 9ffe5a738..35fabadcf 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -390,6 +390,13 @@ void CSQC_UpdateView(float w, float h) hud = getstati(STAT_HUD); + if(autocvar__hud_showbinds_reload) // menu can set this one + { + db_close(binddb); + binddb = db_create(); + cvar_set("_hud_showbinds_reload", "0"); + } + if(checkextension("DP_CSQC_MINFPS_QUALITY")) view_quality = getproperty(VF_MINFPS_QUALITY); else diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index ed56f7183..0d0941514 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -323,6 +323,7 @@ float autocvar_hud_panel_weapons_timeout_effect; float autocvar_hud_progressbar_alpha; float autocvar_hud_showbinds; float autocvar_hud_showbinds_limit; +float autocvar__hud_showbinds_reload; float autocvar_hud_shownames; float autocvar_hud_shownames_enemies; float autocvar_hud_shownames_crosshairdistance; diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index 1107e60ab..fbd7c3997 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -80,6 +80,8 @@ void replace_bind(string from, string to) if(k != -1) localcmd("\nbind \"", keynumtostring(k), "\" \"", to, "\"\n"); } + if(n) + cvar_set("_hud_showbinds_reload", "1"); } void XonoticKeyBinder_configureXonoticKeyBinder(entity me) { @@ -161,6 +163,7 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii) } localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n"); localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state + cvar_set("_hud_showbinds_reload", "1"); } void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease) { @@ -168,11 +171,11 @@ void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandP if(!me.userbindEditDialog) return; - + func = Xonotic_KeyBinds_Functions[me.selectedItem]; if(func == "") return; - + descr = Xonotic_KeyBinds_Descriptions[me.selectedItem]; if(substring(descr, 0, 1) != "$") return; @@ -189,11 +192,11 @@ void KeyBinder_Bind_Edit(entity btn, entity me) if(!me.userbindEditDialog) return; - + func = Xonotic_KeyBinds_Functions[me.selectedItem]; if(func == "") return; - + descr = Xonotic_KeyBinds_Descriptions[me.selectedItem]; if(substring(descr, 0, 1) != "$") return; @@ -222,6 +225,7 @@ void KeyBinder_Bind_Clear(entity btn, entity me) localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n"); } localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state + cvar_set("_hud_showbinds_reload", "1"); } void XonoticKeyBinder_clickListBoxItem(entity me, float i, vector where) {