dkfans / keeperfx

Open source remake and Fan Expansion of Dungeon Keeper.
https://keeperfx.net/
GNU General Public License v2.0
776 stars 76 forks source link

Add new In-Game commands to the Key Binding Menu #826

Open eddebaby opened 4 years ago

eddebaby commented 4 years ago

There are many new in-game commands: https://github.com/dkfans/keeperfx/wiki/New-In-Game-Commands.

It would be good to add them all (as well as any other missing ones) to the Key Binding Menu, so that players can bind them as they choose.

The codebase will need to be searched for the hard-coded keys and buttons: so they can be replaced with the new rebindable actions.

Suggested additions to const struct GameSettings default_settings in _setup_defaultsettings() in bflib_keybrd.h:

// System keys (reserved, cannot be rebound, nor can their combos be used for binding)
{KC_C, KMod_ALT},                   // Gkey_TakeScreenShot
{KC_M, KMod_ALT},                   // Gkey_RecordMovie
{KC_R, KMod_ALT},                   // Gkey_ToggleResolutions
{KC_X, KMod_ALT},                   // Gkey_ExitGame
{KC_F, KMod_ALT},                   // Gkey_ToggleHealthFlowers
{KC_D, KMod_ALT},                   // Gkey_WriteToLog
{KC_T, KMod_ALT},                   // Gkey_TakeControl (whilst replaying a packet file)

// User rebindable Action keys
{KC_MOUSE3, KMod_NONE},             // Gkey_SnapCamera
{KC_MOUSE3, KMod_SHIFT},            // Gkey_SnapCameraClockwise
{KC_MOUSE3, KMod_CONTROL},          // Gkey_SnapCameraAntiClockwise
{KC_LCONTROL, KMod_NONE},           // Gkey_ScrollMessages (in combination with the mouse scroll wheel)
{KC_LSHIFT, KMod_NONE},             // Gkey_ScrollLists (in combination with the mouse scroll wheel)
{KC_LCONTROL, KMod_NONE},           // Gkey_SelectStrongestUnit (in combination with clicking an item in the creature list)
{KC_LSHIFT, KMod_NONE},             // Gkey_SelectWeakestUnit (in combination with clicking an item in the creature list)
{KC_LALT, KMod_NONE},               // Gkey_SellTrapOnSubtile
{KC_LCONTROL, KMod_NONE},           // Gkey_SquareRoomSpace
{KC_MOUSEWHEEL_UP, KMod_CONTROL},   // Gkey_SquareRoomSpaceIncSize
{KC_MOUSEWHEEL_DOWN, KMod_CONTROL}, // Gkey_SquareRoomSpaceDecSize
{KC_LSHIFT, KMod_NONE},             // Gkey_BestRoomSpace
{KC_MOUSEWHEEL_UP, KMod_SHIFT},     // Gkey_BestRoomSpaceIncTolerance
{KC_MOUSEWHEEL_DOWN, KMod_SHIFT},   // Gkey_BestRoomSpaceDecTolerance

Other System keys (no conflict):

// Other System keys (no conflict)
{KC_TAB, KMod_CONTROL},             // Gkey_ToggleSidebar
{KC_LCONTROL, KMod_NONE},           // Gkey_FrameskipMode (in combination with +/= or -)
{KC_LCONTROL, KMod_NONE},           // Gkey_SaveBookmark (in combination with a number key)
{KC_LSHIFT, KMod_NONE},             // Gkey_GoToBookmark (in combination with a number key)
{KC_F8, KMod_NONE},                 // Gkey_ToggleToolTips

Please expand/revise the above list, and I'll sort out the code on the back end from there.

It might be best to handle each key, or group of keys in separate Pull Requests, to ensure all parts of the code base use the new Gkey_foobar instead of the hard-coded keys for a particular feature.

eddebaby commented 4 years ago

I am happy for certain game keys to be deemed System Keys and not be re-definable in the Key Binding Menu, and also prevent their bindings from being bound to other game actions (as per #821) .

Loobinex commented 4 years ago

As discussed, we might get a conflict here because #222 remains open. Ctrl sometimes picks up the strongest unit, sometimes it doesn't.

Loobinex commented 4 years ago

We discussed yesterday to not add the ones where it's just Shift/Ctrl to the define keys menu. These ones:

{KC_MOUSE3, KMod_SHIFT}, // Gkey_SnapCameraClockwise {KC_MOUSE3, KMod_CONTROL}, // Gkey_SnapCameraAntiClockwise {KC_LCONTROL, KMod_NONE}, // Gkey_ScrollMessages (in combination with the mouse scroll wheel) {KC_LSHIFT, KMod_NONE}, // Gkey_ScrollLists (in combination with the mouse scroll wheel) {KC_LCONTROL, KMod_NONE}, // Gkey_SelectStrongestUnit (in combination with clicking an item in the creature list) {KC_LSHIFT, KMod_NONE}, // Gkey_SelectWeakestUnit (in combination with clicking an item in the creature list)