Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
801 stars 62 forks source link

add missing hotkeys #375

Closed arxo closed 3 years ago

arxo commented 3 years ago

The readme mentions several hotkeys as missing, but I could not find an issue ticket for this:

Any background on why these are missing? In the DOS version I used especially the F-keys a lot...

donnierussellii commented 3 years ago

The 0-9 hotkeys are not missing; they are included in Prefs.c, where keybinds are handled.

The following calls should get the function keys working: hotkey_add(KEY_F1, DEMO_CONTEXT,mfd_button_callback_kb,0); hotkey_add(KEY_F2, DEMO_CONTEXT,mfd_button_callback_kb,1); hotkey_add(KEY_F3, DEMO_CONTEXT,mfd_button_callback_kb,2); hotkey_add(KEY_F4, DEMO_CONTEXT,mfd_button_callback_kb,3); hotkey_add(KEY_F5, DEMO_CONTEXT,mfd_button_callback_kb,4); hotkey_add(KEY_F6, DEMO_CONTEXT,mfd_button_callback_kb,5); hotkey_add(KEY_F7, DEMO_CONTEXT,mfd_button_callback_kb,6); hotkey_add(KEY_F8, DEMO_CONTEXT,mfd_button_callback_kb,7); hotkey_add(KEY_F9, DEMO_CONTEXT,mfd_button_callback_kb,8); hotkey_add(KEY_F10,DEMO_CONTEXT,mfd_button_callback_kb,9); But these should be integrated into the keybinds system.

There are hotkey_add() calls throughout the source, but they are commented out so that everything is handled in Prefs.c. The F1-F10 hotkey_add() calls above were commented out at some point before I implemented keybinds, maybe because they weren't needed in the Mac port? I don't know; I also don't know if the hotkey_add() calls above actually work.

arxo commented 3 years ago

I tried to have a go at this myself and at least the MFD hotkeys F1-F10 are now working.

Here's a diff vs. bb31626db603eac6ade442298340a6c8574cc9c0:

mfdHotkeys.diff.txt

arxo commented 3 years ago

my PR #377 was merged, so what's left are the 0..9 keys (and I forgot to update README.md ;)

arxo commented 3 years ago

remaining hotkeys added via PR #380