Allow binding mouse buttons

Instead of hardcoding mouse button actions, allow the user to
bind mouse buttons to extended commands.  For example the new
defaults are:

BIND=mouse1:therecmdmenu
BIND=mouse2:clicklook

Currently a bit rudimentary; the defaults should be OK, but
documentation is bit lacking, and in-game binding and option
saving are missing.

Allowed commands to bind are "nothing", "therecmdmenu", "clicklook",
and "mouseaction". Clicklook replaces the "clicklook" boolean option,
and mouseaction does what mouse 1 button used to do - a context sensitive
action.
This commit is contained in:
Pasi Kallinen
2022-08-23 23:06:26 +03:00
parent 3a255e86c4
commit c42e73fd9c
11 changed files with 135 additions and 78 deletions

View File

@@ -3779,9 +3779,9 @@ Set exceptions to the {{\it pickup\_types\/}}
option. See the ``Configuring Autopickup Exceptions'' section.
%.lp
\item[\bb{BINDINGS}]
Change the key bindings of some special keys, menu accelerators, or
extended commands. You can specify multiple bindings. Format is key
followed by the command, separated by a colon.
Change the key bindings of some special keys, menu accelerators,
extended commands, or mouse buttons. You can specify multiple bindings.
Format is key followed by the command, separated by a colon.
See the ``Changing Key Bindings`` section for more information.
%.lp ""
@@ -4087,10 +4087,6 @@ Synonym for ``{\tt role}'' to pick the type of your character
Save game state after each level change, for possible recovery after
program crash (default on). Persistent.
%.lp
\item[\ib{clicklook}]
Allows looking at things on the screen by navigating the mouse
over them and clicking the right mouse button (default off).
%.lp
\item[\ib{cmdassist}]
Have the game provide some additional command assistance for new
players if it detects some anticipated mistakes (default on).
@@ -5379,11 +5375,11 @@ autopickup.
%.pg
It is possible to change the default key bindings of some special commands,
menu accelerator keys, and extended commands, by using BIND stanzas in the
menu accelerator keys, extended commands, by using BIND stanzas in the
configuration file. Format is key, followed by the command to bind to,
separated by a colon. The key can be a single character (``{\tt x}''),
a control key (``{\tt \^{}X}'', ``{\tt C-x}''), a meta key (``{\tt M-x}''),
or a three-digit decimal ASCII code.
a mouse button, or a three-digit decimal ASCII code.
%.pg
For example:
@@ -5408,6 +5404,11 @@ in the configuration file.
You cannot bind object symbols or selection letters into menu accelerators.
Some interfaces only support some of the menu accelerators.
%.lp "Mouse buttons"
\item[\tb{Mouse buttons}]
You can bind ``mouse1'' or ``mouse2'' to ``{\tt nothing}'',
``{\tt therecmdmenu}'', ``{\tt clicklook}'', or ``{\tt mouseaction}''.
%.lp "Special command keys"
\item[\tb{Special command keys}]
Below are the special commands you can rebind. Some of them can be bound to