quakeforge/libs
Bill Currie 62f592b92c [input] Create an automatic imt switcher
An imt switcher automatically changes the context's active imt based on
a user specified list of binary inputs. The inputs may be either buttons
(indicated as +button) or cvars (bare name). For buttons, the
pressed/not pressed state is used, and cvars are interpreted as ints
being 0 or not 0. The order of the inputs determines the bit number of
the input, with the first input being bit 0, second bit 1, third bit 2
etc. A default imt is given so large switchers do not need to be fully
configured (the default imt is written to all states).

A context can have any number of switchers attached. The switchers can
wind up fighting over the active imt, but this seems to be something for
the "user" (eg, configuration system) to sort out rather than the
switcher code enforcing anything.

As a result of the inputs being treated as bits, a switcher with N
inputs will have 2**N states, thus there's a maximum of 16 inputs for
now as 65536 states is a lot of configuration.

Using a switcher, setting up a standard strafe/mouse look configuration
is fairly easy.

    imt_create key_game imt_mod
    imt_create key_game imt_mod_strafe imt_mod
    imt_create key_game imt_mod_freelook
    imt_create key_game imt_mod_lookstrafe imt_mod_freelook
    imt_switcher_create mouse key_game imt_mod_strafe +strafe lookstrafe +mlook freelook
    imt_switcher 0 imt_mod 2 imt_mod 4 imt_mod_freelook 8 imt_mod_freelook 12 imt_mod_freelook
    imt_switcher 6 imt_mod_lookstrafe 10 imt_mod_lookstrafe 14 imt_mod_lookstrafe
    in_bind imt_mod mouse axis 0 move.yaw
    in_bind imt_mod mouse axis 1 move.forward
    in_bind imt_mod_strafe mouse axis 0 move.side
    in_bind imt_mod_lookstrafe mouse axis 0 move.side
    in_bind imt_mod_freelook mouse axis 1 move.pitch

This takes advantage of imt chaining and the default imt for the
switcher (there are 8 states that use imt_mod_strafe).

The switcher name must be unique across all contexts, and every imt used
in a switcher must be in the switcher's context.
2021-11-25 20:23:18 +09:00
..
audio [win] Fix a pile of bitrot 2021-07-11 13:30:52 +09:00
client [client] Reimplement legacy bind and unbind commands 2021-11-25 13:36:02 +09:00
console [console] Close console when escape key is pressed 2021-11-22 14:59:32 +09:00
gamecode [gamecode] Conform with libc malloc for pr zone 2021-09-26 12:03:44 +09:00
gib [console] Hook up new input system 2021-11-08 11:20:04 +09:00
image Do an audit of hunk mark usage 2021-07-29 11:43:27 +09:00
input [input] Create an automatic imt switcher 2021-11-25 20:23:18 +09:00
models [util] Make bsp_t counts size_t 2021-08-01 21:54:05 +09:00
net [util] Make hunk (optionally) thread-safe 2021-07-29 11:43:27 +09:00
qw [util] Make sizebuf and msg sizes unisgned 2021-04-04 15:53:53 +09:00
ruamoko [console] Hook up new input system 2021-11-08 11:20:04 +09:00
scene [scene] Rename libQFentity to libQFscene 2021-07-24 14:20:59 +09:00
ui [ui] Add two view manipulation functions 2021-07-10 17:57:59 +09:00
util [util] Add listeners to cvars 2021-11-25 17:46:16 +09:00
video [x11] Protect XInput2 and XFixes code 2021-11-24 02:17:08 +09:00
Makemodule.am [scene] Rename libQFentity to libQFscene 2021-07-24 14:20:59 +09:00