cl_keys.c
1. Com_sprintf (cmd, sizeof(cmd), "-%s %i %i\n", button+1, key, time);
Guess what? Using the address of the time() function as the msec value is kind of lame ;). Key up timings are invalid. This is only noticable with low framerates, but this is a bug nontheless.
2. Next, multi binds are processed weirdly in CL_KeyEvent().
2.1. Bind that don't have the +[cmd] command in the beginning make that/those buttons stick.
For example, using /bind b "echo i'm off;+forward" would make you move forward continuously.
2.2. Up key events reprocess the commands after a +[cmd].
In other words, using /bind b "echo qwerty;+forward;echo asdfg", and pressing b once, yields
qwerty
asdfg
asdfg
(actually, if I hold the b key, both of the messages appear rapidly with the key repeat rate, and then asdfg is displayed once additionally on release, but that's a different story.)
2.3. Those up key events are processed while keycatching too.
That is, with something like /bind enter "+forward;quit", you are stuck on the enter key. You let it go, and the executable will shut down.
3. Same thing for ioq3.
Created attachment 1531[details]
key up event processing rework, for r55
- enjoy full subframe time smoothing and smooth movement even at 1 frames per second :)
- binds process continuous commands until release, and one time commands on every pressdown, even when combined, that is, binds like "echo sht;+moveright;echo fck;+forward;echo lol"
- process the echo commands exactly once every pressdown, and move forward-right until the key is up, and,
- don't execute any one time commands while keycatching
Created attachment 1858[details]
refactoring of CL_KeyEvent stuff
Continuing in my theme of stealing other people's good ideas and recoding them almost completely, I stole this good idea and recoded it more or less completely.
The whole CL_KeyEvent function is very strange, since more or less everything it does is conditional on down, so I split it up into several pieces. Now we have CL_KeyEvent immediately calling one of CL_KeyDownEvent or CL_KeyUpEvent, either of which can call CL_ParseBinding. I also made a few other minor readability changes, such as combining and reordering conditionals where appropriate. CL_KeyEvent is now so small that it could be removed entirely and replaced with Down/UpEvent where appropriate, but I decided against this because the diff is already big enough as it is.
The final effect should be more or less the same as the patch above.
Created attachment 1531 [details] key up event processing rework, for r55 - enjoy full subframe time smoothing and smooth movement even at 1 frames per second :) - binds process continuous commands until release, and one time commands on every pressdown, even when combined, that is, binds like "echo sht;+moveright;echo fck;+forward;echo lol" - process the echo commands exactly once every pressdown, and move forward-right until the key is up, and, - don't execute any one time commands while keycatching
Created attachment 1647 [details] key up event processing rework, for ioq3 r1249
Created attachment 1858 [details] refactoring of CL_KeyEvent stuff Continuing in my theme of stealing other people's good ideas and recoding them almost completely, I stole this good idea and recoded it more or less completely. The whole CL_KeyEvent function is very strange, since more or less everything it does is conditional on down, so I split it up into several pieces. Now we have CL_KeyEvent immediately calling one of CL_KeyDownEvent or CL_KeyUpEvent, either of which can call CL_ParseBinding. I also made a few other minor readability changes, such as combining and reordering conditionals where appropriate. CL_KeyEvent is now so small that it could be removed entirely and replaced with Down/UpEvent where appropriate, but I decided against this because the diff is already big enough as it is. The final effect should be more or less the same as the patch above.