Commit Graph

65 Commits

Author SHA1 Message Date
Bill Currie 32a395a8d5 [dox] Fix up some doxygen issues
I found a few doxygen related patches in my git stash and while testing
them, found a few doc issues.
2022-04-13 14:17:58 +09:00
Bill Currie 652546a4fb [input] Clean out a lot of obsolete stuff from keys
The new binding system makes much of keys.[ch] obsolete leaving only the
key name translations.
2021-11-27 12:31:24 +09:00
Bill Currie fe9241e573 [input] Move some IMT documentation
And update to reflect some of the changed concepts (context vs keydest)
2021-11-27 12:06:11 +09:00
Bill Currie 4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00
Bill Currie 825d8b7a49 [input] Make a start on the new binding system
Input Mapping Tables are still at the core as they are a good concept,
however they include both axis and button mappings, and the size is not
hard-coded, but dependent on the known devices. Not much actually works
yet (nq segfaults when a key is pressed).
2021-11-03 19:02:39 +09:00
Bill Currie fed8f66824 [input] Rework logical buttons
kbutton_t is now in_button_t and has been moved to input.h. Also, a
button registration function has been added to take care of +button and
-button command creation and, eventually, direct binding of "physical"
buttons to logical buttons. "Physical" buttons are those coming in from
the OS (keyboard, mouse, joystick...), logical buttons are what the code
looks at for button state.

Additionally, the button edge detection code has been cleaned up such
that it no longer uses magic numbers, and the conversion to a float is
cleaner. Interestingly, I found that the handling is extremely
frame-rate dependent (eg, +forward will accelerate the player to full
speed much faster at 72fps than it does at 20fps). This may be a factor
in why gamers are frame rate obsessed: other games doing the same thing
would certainly feel different under varying frame rates.
2021-10-01 09:16:31 +09:00
Bill Currie 3b586fc0a6 [console] Untangle console and menu toggling
The recent changes to key handling broke using escape to get out of the
console (escape would toggle between console and menu). Thus take care
of the menu (escape) part of the coupling FIXME by implementing a
callback for the escape key (and removing key_togglemenu) and sorting
out the escape key handling in console. Seems to work nicely
2021-07-23 02:28:37 +09:00
Bill Currie e81d690b51 [input] Create QF input library using keys.c
This refactors (as such) keys.c so that it no longer depends on console
or gib, and pulls keys out of video targets. The eventual plan is to
move all high-level general input handling into libQFinput, and probably
low-level (eg, /dev/input handling for joysticks etc on Linux).

Fixes #8
2021-07-05 16:26:07 +09:00
Bill Currie dac9166339 [nq] Sort out some of the issues with keydest
Switches to "game" properly when starting a new game after playing
menus. Of course, basic bindings are still broken in "demo".
2021-03-29 22:39:43 +09:00
Bill Currie 28f50d2719 Add function key defs up to F48
This allows for the four combinations of shift and control. Not
bothering with alt because alt-f4 closes my xterm (bbkeys from the looks
of it: it grabs a bunch of Mod1-* keys).
2020-03-22 13:46:27 +09:00
Bill Currie 84cff64f99 Remove many key number hard-codings
I left the ones below 256 alone (some were necessary anyway), but above
256 they were almost entirely sequential, which rather defeats the
purpose of using an enum, especially since it makes it difficult to
expand sections.
2020-03-22 11:18:44 +09:00
Bill Currie a30433fa9e Make header protection consistent
And delete a couple of useless files.
2020-02-24 12:21:20 +09:00
Bill Currie 9248e8cf01 Update for doxygen 1.8.16 2020-02-11 15:22:42 +09:00
Bill Currie 34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie e1f9cb2028 Create an input subsection for the docs. 2016-01-04 17:24:13 +09:00
Bill Currie fb3396a21d Fix a typo in the key docs. 2016-01-04 16:20:57 +09:00
Bill Currie aecea5c350 Document most of they key binding system. 2016-01-04 16:11:15 +09:00
Bill Currie 7c16acf4aa Make Key_GetBinding take an imt instead of a name. 2016-01-04 16:06:48 +09:00
Bill Currie d1f1375df5 Increase number of supported joystick buttons.
Also fix a bug where despite supporting 32 buttons, only 18 were actually
supported, and a similar issue for the number of axes.

My saitek x52 has 34 buttons and 10 axes. Whee.
2014-08-17 11:35:40 +09:00
Bill Currie 475d90e96f Expose Key_StringToKeynum. 2013-01-28 16:34:29 +09:00
Bill Currie 35edfae2a0 Add keys for joystick axis buttons.
The idea is to allow a joystick axis to be mapped to button presses. These
allow the buttons to be bound without consuming other possibly valid keys.
2013-01-23 13:15:02 +09:00
Bill Currie ace8d9ebc5 Implement dynamic IMTs.
Now the user can create and destroy IMTs at will, though currently
destroying IMTs is currently all or nothing (imt_drop_all).

An IMT is created via imt_create which takes the keydest name (key_game
etc), the name of the IMT (must be unique for all IMTs) and optionally the
name of the IMT to which the key binding search will fall back if there is
no binding in the current IMT, but must be already defined and on the same
keydest. This means that IMTs now have user determined fallback paths. The
requirements for the fallback IMT prevent loops and other weird behaviour.

Actual key binding via in_bind is unaffected. This is why the IMT name must
be unique across all IMTs.

The "imt" command works with the key_game keydest, but imt_keydest is
provided for specifying the active IMT for a specific keydest.

At startup, default IMTs are setup to emulate the previous static IMTs so
old configs will continue to work (mostly). New config files will be
written with commands to drop all of the current IMTs and build new ones,
with the bindings and active IMT set as well.
2013-01-16 19:48:54 +09:00
Bill Currie ec6ba8a03c Make key_dest private to keys.c
This has the bonus feature of making nq pause the game when input focus is
lost (same conditions as dropping the console or bringing up the menu).
2013-01-16 19:48:54 +09:00
Bill Currie 5d8aab744f Eliminate key_none.
It is no longer needed as it was a hack to get key repeat control working
properly.
2013-01-16 19:48:54 +09:00
Bill Currie cf0729c818 Support more than one keydest callback. 2013-01-16 19:48:54 +09:00
Bill Currie a8542c2d48 Correct the spelling of QFK_HIRAGANA_KATAKANA.
'twas QFK_HIRAGANA_kATAKANA. Took a while to spot it :P
2013-01-13 18:54:23 +09:00
Bill Currie e3b8157469 Create a new imt_menu imt.
It seems to work nicely as F10 no longer tries to quit while the menu is
displayed.
2013-01-13 18:19:00 +09:00
Bill Currie 7cd8806ec0 Add support for up to 32 mouse buttons.
My new mouse reports only up to 9 (skipping 6 and 9, it seems), but I
/have/ seen 32 button mice...
2012-07-02 16:33:57 +09:00
Bill Currie 603fe92cba Add a callback for when key_dest is set. 2012-06-29 18:00:21 +09:00
Bill Currie 23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie 858d95de58 Add a bunch more keys to the X11 clients.
Now, QF does something reasonable for every key on my keyboar for which X
gives us a keycode.
2011-12-19 16:37:48 +09:00
Bill Currie c3d41326b3 Do key dest changing properly.
key_demo wasn't so well thought out. This seems to be much better (and nq
is known to be working nicely).
2011-12-10 16:14:25 +09:00
Bill Currie 81a16c925b Add IMT_DEMO for demo playback bindings.
This will allow special key bindings for use during demo playback without
interfering with normal keys.
2011-12-10 14:21:12 +09:00
Bill Currie 14d8e8669f Rework the legacy bind/unbind commands.
in_bind_imt is now gone. I guess mercury was right in that it was a poor
design. However, it was (and still is necessary) to support "bind" and
"unbind". Now, instead, they work only with the IMT_MOD table. IMT_MOD sits
below IMT_0 in the imt hierarchy. If the key is not bound in IMT_0+, then
IMT_MOD will be checked. This way, "bind" and "unbind" can never mess with
a user's more sophisticated binding setup.
2011-12-10 13:56:02 +09:00
Bill Currie d9d56760e1 Add cvars to control the keys for menus and console.
The backquote is not always usable for toggling the console, and the new
bind system doesn't automatically bind a key to both game and console imts
(by design). Thus create a cvar that allows the "always works" console
toggle to be specified in eg $fs_globalcfg. While I'm at it, do one for the
menus, too.
2011-12-10 13:24:32 +09:00
Bill Currie 0b1cc3d21f Support Japanese keyoards (yay, I can finally toggle the console :P) 2009-03-18 00:26:34 +00:00
Ragnvald Maartmann-Moe IV 42d51bc486 Remove SDLK_WORLD_*, as they are no longer supported. Add SDLK_UNDO. 2006-12-01 06:58:23 +00:00
Bill Currie e24cbd75e0 M_BUTTON6 and M_BUTTON7. nuff said :) 2004-03-16 04:12:28 +00:00
Bill Currie 01392c78bb move the bulk of what whas libQFcsqc to libQFruamoko. 2004-01-16 05:46:19 +00:00
Bill Currie 92ea1de504 apply Kaare Slettnes' key name extention patch (Closes: #62) 2002-12-02 16:26:18 +00:00
Bill Currie ec47e08e1c go back to using QFile, quakeio.h and quakefs.h 2002-08-27 07:16:28 +00:00
Bill Currie 2b1fd8e8c0 fix the menu keybinding not working bug 2002-08-19 02:48:38 +00:00
Bill Currie ad6e025a91 take cmd.[ch] back to basics. the gib code is temporarily gone pending
renovations. cmd_source handling is a little hacky in nq, but it's working.
2002-07-31 05:19:03 +00:00
Brian Koropoff d85a238af2 Modified cmd.c to prepare for more file access functions and changed
the bind system to keep a restricted flag on binds to prevent the
server from executing restricted commands by binding them to keys.
2002-05-31 05:38:06 +00:00
Bill Currie 750100b3e3 obsolete declaration cleanup and const correctness for Key_GetBinding 2002-01-25 00:01:05 +00:00
Bill Currie 52aa1c311b qfcc now supports typedef 2002-01-23 21:16:43 +00:00
Bill Currie 20eec42a93 allow keys.h to be used in QC 2002-01-21 19:10:01 +00:00
Bill Currie ac71d101d2 menu code now gets initialized (menu_init in the progs). 2002-01-18 22:02:59 +00:00
Bill Currie c86c5a78bf finally, the client console is merged 2002-01-16 21:53:42 +00:00