From 454214d486ffc95d985fe5e53d59563409bc03db Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 27 Sep 2006 06:54:43 +0000 Subject: Fixed (well, hacked) *-direction and /-direction keypad handling for Unix. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@153 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index d8e3bce25a..f9d59182e6 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2557,6 +2557,18 @@ command_type keycode_to_command( keycode_type key ) { } } +#ifdef UNIX +static keycode_type numpad2vi(keycode_type key) +{ + if (key >= '1' && key <= '9') + { + const char *vikeys = "bjnh.lyku"; + return keycode_type(vikeys[key - '1']); + } + return (key); +} +#endif + keycode_type get_next_keycode() { keycode_type keyin; @@ -2575,12 +2587,12 @@ keycode_type get_next_keycode() { if (keyin == '*') { keyin = getch(); // return control-key - return CONTROL(toupper(keyin)); + return CONTROL(toupper(numpad2vi(keyin))); } else if (keyin == '/') { keyin = getch(); // return shift-key - return toupper(keyin); + return toupper(numpad2vi(keyin)); } #else // Old DOS keypad support -- cgit v1.2.3-54-g00ecf