Bug 3374 - key up event processing bugs
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: unspecified
Hardware: All All
: P3 normal
Assignee: Tim Angus
QA Contact: Tremulous Bugs
URL: https://errorgenie.com/quickbooks/how...
Depends on:
Blocks:
 
Reported: 2007-10-04 15:05 EDT by /dev/humancontroller
Modified: 2022-03-07 06:41:30 EST
2 users (show)

See Also:


Attachments
key up event processing rework, for r55 (3.58 KB, patch)
2007-10-04 15:24 EDT, /dev/humancontroller
key up event processing rework, for ioq3 r1249 (3.35 KB, patch)
2008-01-21 18:29 EST, /dev/humancontroller
refactoring of CL_KeyEvent stuff (7.58 KB, patch)
2008-09-06 12:25 EDT, Ben Millwood

Description /dev/humancontroller 2007-10-04 15:05:20 EDT
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.
Comment 1 /dev/humancontroller 2007-10-04 15:24:30 EDT
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
Comment 2 Tim Angus 2007-10-04 16:33:23 EDT
(In reply to comment #0)
> 3. Same thing for ioq3.
Comment 3 /dev/humancontroller 2008-01-21 18:29:20 EST
Created attachment 1647 [details]
key up event processing rework, for ioq3 r1249
Comment 4 Ben Millwood 2008-09-06 12:25:28 EDT
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.
Comment 5 Thilo Schulz 2009-10-03 19:36:44 EDT
applied. Thanks to both of you!