[crossfire] [PATCH 1/2] Keybindings: multiple changes

Arvid Brodin arvidb at kth.se
Sun Nov 3 11:15:59 CST 2013


On 2013-11-03 16:50, Kevin Zheng wrote:
> On 11/03/2013 08:50, Arvid Brodin wrote:

[]

>> - 3 bindings of 'a' to "apply" (to handle different shift state and modifier 
>>   states). Replace with a single binding of 'a' with "Any" flag.
> 
> In hindsight, there are some issues with setting the directional keys
> with the "Any" flag. I usually bind ALT-B to 'cast burning hands', but
> it conflicts with the 'Any' definition of a NetHack-style direction key.
> Perhaps the 'Normal' checkbox should come back?

It does conflict. Before, you were allowed to enter conflicting keybindings,
and now, you are not. The order the keybinds were made mattered before. Look
at parse_key() in the old code. They find several matches: first_match, then
tries to find a perfect match (keyentry), then proceeds to completely ignore
the keyentry match...

You can solve this easily enough. You should create separate bindings for all
of the direction keys with no modifers, with Run modifiers, and with Fire 
modifiers. Then you can also bind Alt + 'b' to cast burning hands.

This might seem a bit complicated, but it has two IMO large pros:

* We can skip special handling of the Run and Fire modifiers in the future. 
  Instead of giving Shift and Control special meanings if used in conjunction 
  with a direction key, the user simply creates bindings for 'east', 'run east',
  'fire east' etc. These can be set up so that they work exactly like today.

* It is transparent to the end user - he/she can see exactly what happens.
  No hidden special treatment of the Shift and Control keys.


I really need to take a good look at the def-keys file though...


>> - I've never seen the "Nethack-Style" key layout before. Also, they don't seem
>>   to work in conjunction with the Fire modifier (only N and R). Does the fact
>>   that that bug has never been fixed mean they aren't used at all, perhaps? Or
>>   do people just fix that when they start to play?
> 
> I've always used NetHack style keys, and they've been working fine all
> the time. After the update some interesting things are happening, which
> I'm working on investigating.

I think this is a problem with my code. 
The default Nethack-style bindings look like this (from common/def-keys):

b 1 NR southwest
h 1 NR west
j 1 NR south
k 1 NR north
l 1 NR east
n 1 NR southeast
u 1 NR northeast
y 1 NR northwest

Logically that means they should work if no modifier keys are pressed, or with
Run pressed. (Are you saying they work with Fire pressed as well?)

Anyway, this needs to be expressed with two keybindings in my code: one with no
modifiers (called "None" in the keybindings dialog), and one with the "Run" 
modifier. My code ignores the 'N' here since it means "no flags" and only looks 
at the 'R' - which of course breaks things. I will figure out a solution.


>> - 2 of 'e' to examine (shift state). Replace with single binding of 'e'.
> 
> There should just be one examine command, "examine." I think it should
> be bound to normal and CTRL.

It looks like this today:

e 1 RF examine
E 1 RF examine

I.e. it is bound to Run and Fire (and not Normal). And the double bind is 
used since 'e' and 'E' have different key codes. My code converts all
key codes to lowercase, since shift state is treated separately anyway.


>> - Arrow keys... I *really* like the feature of command history and the prevkey/
>>   nextkey that is available. But these are not bound by default, so perhaps they
>>   aren't used as much as they could be. On the other hand, using the arrow keys
>>   for this (and not for north/south etc) requires an immidiate help text whenever
>>   a new character is started, to explain how to move.
> 
> Thing with Crossfire is that we don't have a "pop-up-on-your-screen"
> tutorial at the beginning. And if players start by using the arrow keys
> (based on intuition), they probably won't discover the other ways to
> move, either.

You don't think a text in the message pane would be enough? Hmm, maybe not...


-- 
Arvid


More information about the crossfire mailing list