Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space and Ctrl cause Enter to appear pressed, Alt causes ESC to appear pressed #1106

Closed
rversteegen opened this issue Mar 17, 2020 · 2 comments
Labels
bug Yeah... that's broken controls Keyboard, mouse and joystick/gamepad input/controls rel: fufluns Present in fufluns 2020-01-12 rel: New in ... Introduced in the tagged "rel:" release/nightlies
Milestone

Comments

@rversteegen
Copy link
Contributor

rversteegen commented Mar 17, 2020

Pressing Space or Ctrl results in key is pressed(key:enter) returning true if the "Map joystick controls to keyboard keys for scripts" general pref bit is on -- and it is by default in all games since a year ago (fufluns) -- and ditto for Alt and ESC.

This is caused by this block in script_keyval (added r10966 (daaad76)):

 IF prefbit(47) = NO THEN  '!Map joystick controls to keyboard keys for scripts
  SELECT CASE key
   CASE scUp:     ret OR= keyval(ccUp)
   CASE scDown:   ret OR= keyval(ccDown)
   CASE scLeft:   ret OR= keyval(ccLeft)
   CASE scRight:  ret OR= keyval(ccRight)
   CASE scEnter:  ret OR= keyval(ccUse)
   CASE scEsc:    ret OR= keyval(ccCancel)
  END SELECT
 END IF

Unfortunately this is a bit tricky to fix without breaking this prefbit because of the way carray is now computed. I think I need to refactor that code in allmodex to give each input device its own carray array, so that we can check just the joystick carray and map that to keyboard keys.

@rversteegen rversteegen added bug Yeah... that's broken controls Keyboard, mouse and joystick/gamepad input/controls rel: New in ... Introduced in the tagged "rel:" release/nightlies rel: fufluns Present in fufluns 2020-01-12 labels Mar 17, 2020
@rversteegen rversteegen added this to the gorgonzola milestone Mar 17, 2020
@rversteegen
Copy link
Contributor Author

Wow, I forgot that I already fixed this bug once before. Well now it's back! I was wondering why I left it unfixed for so long, but actually I rebroke this only recent in r12270 (ef83342).

@rversteegen rversteegen reopened this Sep 7, 2021
bob-the-hamster pushed a commit that referenced this issue Sep 8, 2021
…ses ESC to appear pressed

git-svn-id: https://rpg.hamsterrepublic.com/source/wip@12393 7d344553-34f0-0310-a9b1-970ce8f1c3a2
bob-the-hamster pushed a commit that referenced this issue Sep 8, 2021
…ses ESC to appear pressed

(Copied from r12393 on wip branch)

git-svn-id: https://rpg.hamsterrepublic.com/source/rel/hrodvitnir@12402 7d344553-34f0-0310-a9b1-970ce8f1c3a2
@rversteegen
Copy link
Contributor Author

Fixed again in r12393.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Yeah... that's broken controls Keyboard, mouse and joystick/gamepad input/controls rel: fufluns Present in fufluns 2020-01-12 rel: New in ... Introduced in the tagged "rel:" release/nightlies
Projects
None yet
Development

No branches or pull requests

1 participant