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

@@ -3483,8 +3483,8 @@ Set exceptions to the
option.
See the \(lqConfiguring Autopickup Exceptions\(rq section.
.lp BINDINGS
Change the key bindings of some special keys, menu accelerators, or
extended commands.
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 \(lqChanging Key Bindings\(rq section for more information.
@@ -3753,9 +3753,6 @@ for more details.
.lp checkpoint
Save game state after each level change, for possible recovery after
program crash (default on). Persistent.
.lp clicklook
Allows looking at things on the screen by navigating the mouse
over them and clicking the right mouse button (default off).
.lp cmdassist
Have the game provide some additional command assistance for
new players if it detects some anticipated mistakes (default on).
@@ -4873,7 +4870,8 @@ menu accelerator keys, and 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 (\(lqx\(rq), a control key (\(lq\(haX\(rq,
\(lqC-x\(rq), a meta key (\(lqM-x\(rq), or a three-digit decimal ASCII code.
\(lqC-x\(rq), a meta key (\(lqM-x\(rq), a mouse button,
or a three-digit decimal ASCII code.
.pg
For example:
.sd
@@ -4893,6 +4891,9 @@ The menu control or accelerator keys can also be rebound via OPTIONS lines
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"
You can bind \(lqmouse1\(rq or \(lqmouse2\(rq to \(lqnothing\(rq,
\(lqtherecmdmenu\(rq, \(lqclicklook\(rq, or \(lqmouseaction\(rq.
.lp "Special command keys"
Below are the special commands you can rebind.
Some of them can be bound to