simulated mouse click for #therecmdmenu

The #therecmdmenu command calls getdir() which issues an "in what
direction?" prompt.  This allows you to answer with "_" instead of a
regular direction, then it will call getpos() to allow you to move
the cursor and type "," (or ";") to behave as if a left-click had
been done or type "." (or ":") to behave as right-click.

Ordinarily I would think of the 'normal' getpos() response of "."
as suitable for left-click, then one of the other getpos finishers
for right-click, but comma is left of period on a standard keyboard
and that seems useful for remembering which is used for which click.

Left clicking on a spot farther than one step away offers travel,
throw iff lined up, and also click-look as choices.  If you right
click farther than one step away, it will only offer click-look.
The look choice for either left or right click isn't inhibited by
having the clicklook option set to False.  After all, player is
explicitly choosing the menu entry to look at something.

New getdir.mouse can be bound to some other key than "_" and the
getpos.pick* responses could already be re-bound, but there's no
separate getdir.left/right that could be used to bind different keys
from those used for the four getpos responses.
This commit is contained in:
PatR
2022-06-13 16:06:06 -07:00
parent 145232a16f
commit 00fd2b79de
6 changed files with 127 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 decl.h $NHDT-Date: 1654070559 2022/06/01 08:02:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.296 $ */
/* NetHack 3.7 decl.h $NHDT-Date: 1655161560 2022/06/13 23:06:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.298 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
@@ -458,6 +458,9 @@ enum nh_keyfunc {
NHKF_GETDIR_SELF,
NHKF_GETDIR_SELF2,
NHKF_GETDIR_HELP,
NHKF_GETDIR_MOUSE, /* simulated click for #therecmdmenu; use '_' as
* direction to initiate, then getpos() finishing
* with ',' (left click) or '.' (right click) */
NHKF_COUNT,
NHKF_GETPOS_SELF,
NHKF_GETPOS_PICK,