Movement key reworking

Put the rush and run movement keys into g.Cmd instead of bit twiddling
the normal walk keys in multiple places to get the run and rush keys.

Allow meta keys in getpos. Use the normal running keys to fast-move
in getpos, instead of explicit HJKL - I polled couple places online,
and number_pad users did not use the HJKL keys in getpos.

Make meta keys work even after a prefix key.
This commit is contained in:
Pasi Kallinen
2021-07-03 15:19:53 +03:00
parent 0ba7ff46b9
commit db68395d69
6 changed files with 150 additions and 106 deletions

View File

@@ -173,6 +173,15 @@ struct kinfo {
char name[BUFSZ]; /* actual killer name */
};
enum movemodes {
MV_ANY = -1,
MV_WALK,
MV_RUN,
MV_RUSH,
N_MOVEMODES
};
enum movementdirs {
DIR_ERR = -1,
DIR_W,
@@ -500,6 +509,8 @@ struct cmd {
boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
char move[N_DIRS]; /* char used for moving one step in direction */
char rush[N_DIRS];
char run[N_DIRS];
const char *dirchars; /* current movement/direction characters */
const char *alphadirchars; /* same as dirchars if !numpad */
const struct ext_func_tab *commands[256]; /* indexed by input character */

View File

@@ -225,7 +225,7 @@ extern boolean bind_key(uchar, const char *);
extern void dokeylist(void);
extern int xytod(schar, schar);
extern void dtoxy(coord *, int);
extern int movecmd(char);
extern int movecmd(char, int);
extern int dxdy_moveok(void);
extern int getdir(const char *);
extern void confdir(void);
@@ -239,6 +239,7 @@ extern void hangup(int);
extern void end_of_input(void);
#endif
extern char readchar(void);
extern char readchar_poskey(int *, int *, int *);
extern void sanity_check(void);
extern char* key2txt(uchar, char *);
extern char yn_function(const char *, const char *, char);