Skip to content

Duke3D: Add cvar `cl_keybindmode` to change keyboard config behavior

Dino Bollinger requested to merge dibollinger/eduke32:keybindmode into master

This merge request is meant to address what is also described in #164 (closed).

On the road to improving the keybind menu, a first step we could make is to make the existing menus more user-friendly. A common issue I and others run into is that, when setting up the keyboard controls (for example, when installing eduke32 for a new mod, or when clearing the settings) then due to the default configuration, the player may unintentionally end up with multiple gamefuncs being assigned to the same key. This is particularly a problem due to the large number of gamefuncs that are available. It is hard to keep an overview over which key is assigned to what actions.

In many other games, assigning a key to an action, when said key already has an action defined, either removes the previous assignment, or warns the player of the previous bind. This is done because it is rarely desired to have multiple actions occur with the same keypress, unless there are multiple gamemodes or player states where certain actions are deactivated. This is not the case for Duke3D or its derivatives however.

For this MR I decided to implement a removal of the previous keybinds, rather than displaying a warning, as the latter is cumbersome to implement in the current menu structure, and could become a nuisance to the player as well.

As such, if this MR is accepted, the new default behavior for the keyboard configuration is to remove all existing keybinds for a key before it is assigned to a new action. This is also set as the new default behavior. By setting the cvar cl_keybindmode back to 0, the old behavior is restored, and the player can again assign multiple gamefuncs to the same key.

Close #164 (closed).

Edited by Dino Bollinger

Merge request reports