Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
297 stars 42 forks source link

Arrow Keys don't work on alternative layout #585

Open travankor opened 4 years ago

travankor commented 4 years ago

On both the alternative and nethack layout, the arrow keys do nothing.

Also PAGEUP, PAGEDOWN, HOME, and END don't seem to be detected when calling them with ISO LEVEL 3 SHIFT (basically level3+arrow keys should be page up, down, home,end).

AquariusPower commented 4 years ago

You are on Mac, Linux, Windows? I think we could create a developer option that shows every keypress on message log, to help on customizing such keys. What we actually have is 3 presets right? I use the default one on linux.

red-kangaroo commented 4 years ago

Right now, the game can only recognize one set of movement keys at one time. So you can only have arrow keys, or alternative, or NetHack-ish.

This should definitely be changed to allow arrow keys to work at least in menus for all movement key options.

travankor commented 4 years ago

You are on Mac, Linux, Windows?

The arrow keys issue affects all OS'es.

I think most people use the default one, but I had to switch because the pageup, pagedown, home, and end (I assume these are for diagonal movement for people without a numpad) are not being recognized for me on a laptop.

So, the second issue might be OS specific (Linux), if you're knowledgeable @AquariusPower on Linux issues.

In my xkb settings (see man xkeyboard-config), I have lv3:ralt_switch_multikey set. In theory, this means that the right alt acts as a modifier key, where right alt + arrow keys are pageup/down, home, end. Ivan either has the wrong SDL keymap to detect pageup/down, etc., or does not accept key chords (ie: multiple keys pressed -> one action).

AquariusPower commented 4 years ago

@travankor

there is some code on this branch: https://github.com/AquariusPower/ivan/tree/SomeFixes1234 for this PR https://github.com/Attnam/ivan/pull/587 (as far I tested if this functionality is not tried it wont bugout)

but it is still NOT working properly as for some reason game::LoadCustomCommandKeys() is destroying/disabling/removing every other keybinding in the game and I couldn't make a sense out of it yet... as only these new movement custom keybinds will work......

for now it just generates CustomCommandKeys.cfg file. you can try it from the config option "Movement control scheme" til it reaches "Custom" while the game is running, it will not work from the main menu either.

After you finish configuring (I tested F1 F2 ... and these keys were ignored, so I tested with 1 2 3 4...), the cfg file will have the scan codes for the keys you chose, but as soon it is set the game will bugout and every other key will be ignored :(, so this needs serious fixing or wont work after all.... Now just hit Alt+F4 in the bugged game to close it and go check the cfg file.

The most you can see for now is if the cfg file is being filled properly with the scan code values you need.

Anyone willing to help, check why game::LoadCustomCommandKeys() could be destroying every other keybinding in game, that makes no sense yet to me...

AquariusPower commented 4 years ago

ok, found it "the problem was between the keyboard and the chair" :> every movement key also may remap any other command key, so custom keys for every other command is still a missing feature, now I am trying to fix at least the custom movement keys initially, using as base the normal keys (every other command will use the normal config), I think this can be reworked tho to let other base be chosen. EDIT: Done!

EDIT: arrow keys up and down will now always work on lists