]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
authorSamual Lenks <samual@xonotic.org>
Wed, 30 Jan 2013 05:20:06 +0000 (00:20 -0500)
committerSamual Lenks <samual@xonotic.org>
Wed, 30 Jan 2013 05:20:06 +0000 (00:20 -0500)
_hud_common.cfg
bf.cfg [new file with mode: 0644]
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/menu/xonotic/dialog_settings_input.c
qcsrc/menu/xonotic/keybinder.c
qcsrc/server/cl_physics.qc

index 5179bb2abfcddf226f547c457d0877e39d78f5b7..ba88a2a4fa6fedcd4f2343caeb2e8b1445b1893e 100644 (file)
@@ -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/bf.cfg b/bf.cfg
new file mode 100644 (file)
index 0000000..6445def
--- /dev/null
+++ b/bf.cfg
@@ -0,0 +1,98 @@
+// DP console is TURING COMPLETE!
+
+alias _bf_vcall "${$1} ${2- ?}"
+
+// number system
+// Xon RPN: set $_bf_zero 0
+// Xon RPN: alias _bf_inc "rpn /$1 $2 1 add def"
+// Xon RPN: alias _bf_dec "rpn /$1 $2 1 sub def"
+
+// unary
+// decimal | unary
+//       0 | 0
+//       1 | +
+//       2 | ++
+//      -1 | -
+//      -2 | --
+alias _bf_zero "set $1 0"
+alias _bf_one "set $1 +"
+alias _bf_minus_one "set $1 -"
+alias _bf_return_3 "set $1 $3"
+alias _bf_return_4 "set $1 $4"
+set _bf_zero "0"
+alias _bf_inc_loop1 "set _bf_tmp_$3 _bf_inc_loop2; set _bf_tmp_+$2 _bf_return_3; _bf_vcall _bf_tmp_$3 $*"
+alias _bf_inc_loop2 "set _bf_tmp_$2 _bf_inc_loop3; set _bf_tmp_-$4 _bf_return_4; _bf_vcall _bf_tmp_$2 $*"
+alias _bf_inc_loop3 "_bf_inc_loop1 $1 $2 +$3 -$4"
+alias _bf_inc "set _bf_tmp_$2 _bf_inc_loop1; set _bf_tmp_0 _bf_one; set _bf_tmp_- _bf_zero; _bf_vcall _bf_tmp_$2 $1 $2 + -"
+alias _bf_dec_loop1 "set _bf_tmp_$3 _bf_dec_loop2; set _bf_tmp_-$2 _bf_return_3; _bf_vcall _bf_tmp_$3 $*"
+alias _bf_dec_loop2 "set _bf_tmp_$2 _bf_dec_loop3; set _bf_tmp_+$4 _bf_return_4; _bf_vcall _bf_tmp_$2 $*"
+alias _bf_dec_loop3 "_bf_dec_loop1 $1 $2 -$3 +$4"
+alias _bf_dec "set _bf_tmp_$2 _bf_dec_loop1; set _bf_tmp_0 _bf_minus_one; set _bf_tmp_+ _bf_zero; _bf_vcall _bf_tmp_$2 $1 $2 - +"
+// end of unary
+
+// interpreter state
+set bf_input ""
+alias _bf_clearstate "set _bf_left \"\"; set _bf_right \"\"; set _bf_register $_bf_zero; set _bf_execstack \"\""
+alias _bf_dumpstate "echo rev($_bf_left) < $_bf_register > $_bf_right"
+
+// a STACK!
+alias _bf_pop_get "set $2 \"${3 ?}\"; set $1 \"${4- ?}\""
+alias _bf_pop_dispatch "_bf_pop_get $1 $2 $_bf_popstack_"
+// usage: _bf_pop stackvar outvar defaultvalue
+alias _bf_pop "set _bf_popstack_ \"${$1 ?}\"; set \"_bf_popstack_${$1 ?}\" \"${3 ?}\"; _bf_pop_dispatch $*"
+// usage: _bf_push stackvar value
+alias _bf_push "set $1 \"$2 ${$1 ?}\""
+
+// skip mode: skip until matching ] (1 on _bf_execstack), then continue executing
+alias _bf_skip_ "echo PROGRAMM FELL OFF THE EDGE"
+alias _bf_skip_+ "_bf_skip_${* ?}"
+alias _bf_skip_- "_bf_skip_${* ?}"
+alias _bf_skip_< "_bf_skip_${* ?}"
+alias _bf_skip_> "_bf_skip_${* ?}"
+alias _bf_skip_. "_bf_skip_${* ?}"
+alias _bf_skip_, "_bf_skip_${* ?}"
+alias _bf_skip_endloop_0 "_bf_skip_${* ?}" // continue skipping
+alias _bf_skip_endloop_1 "bf_${* ?}" // back to execution
+alias _bf_skip_endloop_dispatch "_bf_skip_endloop_$_bf_stackval ${* ?}"
+alias _bf_skip_] "_bf_pop _bf_execstack _bf_stackval; _bf_skip_endloop_dispatch ${* ?}"
+alias _bf_skip_[ "_bf_push _bf_execstack 0; _bf_skip_${* ?}"
+// enter
+alias _bf_skiploop "_bf_push _bf_execstack 1; _bf_skip_${* ?}"
+
+// run mode: execute until matching ] (1 on _bf_execstack), then exit
+alias bf_ "echo PROGRAMM FELL OFF THE EDGE"
+alias bf_+ "_bf_inc _bf_register $_bf_register; bf_${* ?}"
+alias bf_- "_bf_dec _bf_register $_bf_register; bf_${* ?}"
+alias bf_< "_bf_push _bf_left $_bf_register; _bf_pop _bf_right _bf_register $_bf_zero; bf_${* ?}"
+alias bf_> "_bf_push _bf_right $_bf_register; _bf_pop _bf_left _bf_register $_bf_zero; bf_${* ?}"
+alias bf_. "echo $_bf_register; bf_${* ?}"
+// note: on EOF, we don't change the register value!
+alias _bf_input_get "set _bf_register $_bf_inputval; bf_${* ?}" // read input
+alias _bf_input_eof "bf_${* ?}" // at EOF, just continue
+alias _bf_input_dispatch "set _bf_inputval_ _bf_input_get; set _bf_inputval_$_bf_inputval _bf_input_eof; _bf_vcall _bf_inputval_ ${* ?}"
+alias bf_, "_bf_pop bf_input _bf_inputval; _bf_input_dispatch ${* ?}"
+alias _bf_endloop_0 "echo IN SKIP MODE, EXCEPT NOT"
+alias _bf_endloop_1 "" // back to caller
+alias _bf_endloop_ "echo PROGRAMM FELL OFF THE EDGE"
+alias _bf_endloop_dispatch "_bf_endloop_$_bf_stackval ${* ?}"
+alias bf_] "_bf_pop _bf_execstack _bf_stackval; _bf_endloop_dispatch ${* ?}"
+// enter
+alias _bf_runloop "_bf_push _bf_execstack 1; bf_$*; bf_[ ${* ?}"
+// loop dispatcher
+alias bf_[ "set _bf_runloop_$_bf_zero _bf_runloop; set _bf_runloop_$_bf_register _bf_skiploop; _bf_vcall _bf_runloop_$_bf_zero ${* ?}"
+
+// start it
+alias bf_exec "_bf_clearstate; _bf_push _bf_execstack 1; bf_$1 ]"
+
+// "cat"
+// Xon RPN: bf_input "1 2 3 4 5"
+bf_input "+ ++ +++ ++++ +++++"
+bf_exec "[ - ] - , + [ - . + [ - ] - , + ]"
+
+// output 42
+// Xon RPN: bf_input "12 6 9"
+bf_input "++++++++++++ ++++++ +++++++++"
+bf_exec ", > , > , < [ > [ - > + > + < < ] > > [ - < < + > > ] < < < - ] < [ - > > > - < < < ] > > > ."
+
+// hello world
+bf_exec "+ + + + + + + + + + [ > + + + + + + + > + + + + + + + + + + > + + + > + < < < < - ] > + + . > + . + + + + + + + . . + + + . > + + . < < + + + + + + + + + + + + + + + . > . + + + . - - - - - - . - - - - - - - - . > + . > ."
index 30cadd5cf0bdeefeff29af3e9d2a2d9219d12729..7b300dd508e5f9d688c91511a1025e4349a1af52 100644 (file)
@@ -1261,7 +1261,8 @@ string getcommandkey(string text, string command)
                                        keys = strcat(keys, ", ", keynumtostring(k));
 
                                ++l;
-                               if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
+                               if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit <= l)
+                                       break;
                        }
 
                }
index dccee35de1559ccf42e6773ee2be22b0f564c98a..29bf68e2594b724d4d20b5b36f105c9fb0616944 100644 (file)
@@ -392,6 +392,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
index 387cf44c5dd2d129c41d395010f3035cabfe5c37..07f2b8f787375bb1669d9fbfce672c85a14944c2 100644 (file)
@@ -325,6 +325,7 @@ var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
 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;
index 96bf5e5c67d207f3b8b864535eca34c2a6628a85..daa8f3ff104fe3bcfc659fd32f7762c2ebd1fc50 100644 (file)
@@ -40,6 +40,7 @@ void XonoticInputSettingsTab_fill(entity me)
                me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0'));
                        e.onClick = KeyBinder_Bind_Clear;
                        e.onClickEntity = kb;
+                       kb.clearButton = e;
 
        me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
index 1107e60abc6b3296e77dd9582bbe6613a267ef32..739be1b056aa908da09d5ab1bfded18f3ef30708 100644 (file)
@@ -22,6 +22,7 @@ CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
        ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
        ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
        ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
        ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
        METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string))
 ENDCLASS(XonoticKeyBinder)
@@ -80,6 +81,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)
 {
@@ -126,6 +129,7 @@ void KeyBinder_Bind_Change(entity btn, entity me)
                return;
 
        me.keyGrabButton.forcePressed = 1;
+       me.clearButton.disabled = 1;
        keyGrabber = me;
 }
 void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
@@ -134,6 +138,8 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
        string func;
 
        me.keyGrabButton.forcePressed = 0;
+       me.clearButton.disabled = 0;
+
        if(key == K_ESCAPE)
                return;
 
@@ -161,6 +167,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 +175,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 +196,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 +229,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)
 {
index 3e2268d89748d1eb193892407968c8ee721f66a5..4e5f007e3f17323ffca29b19b1bc8acb6bd309f0 100644 (file)
@@ -897,15 +897,15 @@ void SV_PlayerPhysics()
                maxspd_mod = autocvar_sv_spectator_speed_multiplier;
                if(!self.spectatorspeed)
                        self.spectatorspeed = maxspd_mod;
-               if(self.impulse && self.impulse <= 19)
+               if(self.impulse && self.impulse <= 19 || self.impulse >= 200 && self.impulse <= 209 || self.impulse >= 220 && self.impulse <= 229)
                {
                        if(self.lastclassname != "player")
                        {
-                               if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+                               if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || self.impulse >= 200 && self.impulse <= 209)
                                        self.spectatorspeed = bound(1, self.spectatorspeed + 0.5, 5);
                                else if(self.impulse == 11)
                                        self.spectatorspeed = maxspd_mod;
-                               else if(self.impulse == 12 || self.impulse == 16  || self.impulse == 19)
+                               else if(self.impulse == 12 || self.impulse == 16  || self.impulse == 19 || self.impulse >= 220 && self.impulse <= 229)
                                        self.spectatorspeed = bound(1, self.spectatorspeed - 0.5, 5);
                                else if(self.impulse >= 1 && self.impulse <= 9)
                                        self.spectatorspeed = 1 + 0.5 * (self.impulse - 1);