display effect. on MSDOS without the termcap
lib, whether or not to pause for visual effect. [TRUE]
+Boolean option for Amiga, or for others if ALTMETA was set at compile time:
+altmeta For Amiga, treat Alt+key as Meta+key. [TRUE]
+altmeta For unix and VMS, treat two character sequence
+ "ESC c" as M-c (Meta+c, 8th bit set) when nethack
+ obtains a command from player's keyboard. [FALSE]
+
Boolean option if USE_TILES was set at compile time (MSDOS protected mode only):
preload_tiles control whether tiles get pre-loaded into RAM at the
start of the game. Doing so enhances performance
.ds vr "NetHack 3.5
.ds f0 "\*(vr
.ds f1
-.ds f2 "March 5, 2011
+.ds f2 "April 17, 2011
.mt
A Guide to the Mazes of Menace
(Guidebook for NetHack)
with another key, modifies it by setting the `meta' [8th, or `high']
bit), you can invoke many extended commands by meta-ing the first
letter of the command.
-.\" In {\it NT, OS/2, PC\/ {\rm and} ST NetHack},
-.\" the `Alt' key can be used in this fashion;
-.\" on the Amiga set the {\it altmeta\/} option to get this behavior.
-In NT, OS/2, and PC NetHack, the `Alt' key
-can be used in this fashion.
+In \fINT\fP, \fIOS/2\fP, \fIPC\fP and \fIST\fP \fINetHack\fP,
+the `Alt' key can be used in this fashion;
+on the \fIAmiga\fP, set the
+.op altmeta
+option to get this behavior.
+On other systems, if typing `Alt' plus another key transmits a
+two character sequence consisting of an \fBEscape\fP
+followed by the other key, you may set the
+.op altmeta
+option to have nethack combine them into meta+key.
.lp M-?
#? (not supported by all platforms)
.lp M-2
path information.
Cannot be set with the `O' command.
.lp altmeta
-(default on, AMIGA NetHack only).
+On Amiga, this option controls whether typing `Alt' plus another key
+functions as a meta-shift for that key (default on).
+.lp altmeta
+On other (non-Amiga) systems where this option is available, it can be
+set to tell nethack to convert a two character sequence beginning with
+ESC into a meta-shifted version of the second character (default off).
+.lp ""
+This conversion is only done for commands, not for other input prompts.
+Note that typing one or more digits as a count prefix prior to a
+command--preceded by \fBn\fP if the
+.op number_pad
+option is set--is also subject to this conversion, so attempting to
+abort the count by typing ESC will leave nethack waiting for another
+character to complete the two character sequence. Type a second ESC to
+finish cancelling such a count. At other prompts a single ESC suffices.
.lp "BIOS "
Use BIOS calls to update the screen
display quickly and to read the keyboard (allowing the use of arrow
\begin{document}
%
% input file: guidebook.mn
-% $Revision: 1.111 $ $Date: 2011/03/05 10:09:47 $
+% $Revision: 1.112 $ $Date: 2011/03/09 02:30:24 $
%
%.ds h0 "
%.ds h1 %.ds h2 \%
%.au
\author{Eric S. Raymond\\
(Extensively edited and expanded for 3.5)}
-\date{March 5, 2011}
+\date{April 17, 2011}
\maketitle
with another key, modifies it by setting the `meta' [8th, or `high']
bit), you can invoke many extended commands by meta-ing the first
letter of the command.
-%- In {\it NT, OS/2, PC\/ {\rm and} ST NetHack},
-%- the `Alt' key can be used in this fashion;
-%- on the Amiga set the {\it altmeta\/} option to get this behavior.
-In {\it NT, OS/2, {\rm and} PC NetHack},
-the `Alt' key can be used in this fashion.
+In {\it NT, OS/2, PC\/ {\rm and} ST NetHack},
+the `Alt' key can be used in this fashion;
+on the {\it Amiga\/}, set the {\it altmeta\/} option to get this behavior.
+On other systems, if typing `Alt' plus another key transmits a
+two character sequence consisting of an {\tt Escape}
+followed by the other key, you may set the {\it altmeta\/}
+option to have nethack combine them into meta\+key.
\blist{}
%.lp
\item[\tb{M-?}]
The name of the handler is specified without the .dll extension and without any
path information.
Cannot be set with the `{\tt O}' command.
-%.lp
+%.lp
+\item[\ib{altmeta}]
+On Amiga, this option controls whether typing ``Alt'' plus another key
+functions as a meta-shift for that key (default on).
+%.lp
\item[\ib{altmeta}]
-(default on, {\it Amiga NetHack \/} only).
+On other (non-Amiga) systems where this option is available, it can be
+set to tell nethack to convert a two character sequence beginning with
+ESC into a meta-shifted version of the second character (default off).
+
+%.lp ""
+This conversion is only done for commands, not for other input prompts.
+Note that typing one or more digits as a count prefix prior to a
+command---preceded by {\tt n} if the {\it number\_pad\/}
+option is set---is also subject to this conversion, so attempting to
+abort the count by typing ESC will leave nethack waiting for another
+character to complete the two character sequence. Type a second ESC to
+finish cancelling such a count. At other prompts a single ESC suffices.
%.lp
\item[\ib{BIOS}]
Use BIOS calls to update the screen display quickly and to read the keyboard
using phone keypad
smartphone: added Q(quiver) command to "Attack" layout
smartphone: fixed F command to prompt for direction
+unix,vms: altmeta option to handle terminals which send "ESC c" for Alt+c
Code Cleanup and Reorganization
int menu_headings; /* ATR for menu headings */
int *opt_booldup; /* for duplication of boolean opts in config file */
int *opt_compdup; /* for duplication of compound opts in config file */
+#ifdef ALTMETA
+ boolean altmeta; /* Alt-c sends ESC c rather than M-c */
+#endif
boolean cbreak; /* in cbreak mode, rogue format */
boolean deferred_X; /* deferred entry into explore mode */
boolean num_pad; /* use numbers for movement commands */
/* NetHack 3.5 unixconf.h $Date$ $Revision$ */
-/* SCCS Id: @(#)unixconf.h 3.5 2007/12/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#define MAILCKFREQ 50
#endif /* MAIL */
+/*
+ * Some terminals or terminal emulators send two character sequence "ESC c"
+ * when Alt+c is pressed. The altmeta run-time option allows the user to
+ * request that "ESC c" be treated as M-c.
+ */
+#define ALTMETA /* support altmeta run-time option */
#ifdef COMPRESS
/* NetHack 3.5 vmsconf.h $Date$ $Revision$ */
-/* SCCS Id: @(#)vmsconf.h 3.5 2007/10/27 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#define SHELL /* do not delete the '!' command */
#define SUSPEND /* don't delete the ^Z command, such as it is */
+/*
+ * Some terminals or terminal emulators send two character sequence "ESC c"
+ * when Alt+c is pressed. The altmeta run-time option allows the user to
+ * request that "ESC c" be treated as M-c, which means that if nethack sees
+ * ESC when it is waiting for a command, it will wait for another character
+ * (even if user intended that ESC to be standalone to cancel a count prefix).
+ */
+#define ALTMETA /* support altmeta run-time option */
+
+
#define RANDOM /* use sys/share/random.c instead of vaxcrtl rand */
#define FCMASK 0660 /* file creation mask */
#include "func_tab.h"
/* #define DEBUG */ /* uncomment for debugging */
+#ifdef ALTMETA
+STATIC_VAR boolean alt_esc = FALSE;
+#endif
+
struct cmd Cmd = { 0 }; /* flag.h */
extern const char *hu_stat[]; /* hunger status from eat.c */
context.move = 1;
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
+#ifdef ALTMETA
+ alt_esc = iflags.altmeta; /* readchar() hack */
+#endif
if (!Cmd.num_pad || (foo = readchar()) == 'n')
for (;;) {
foo = readchar();
if (!multi && foo == '0') prezero = TRUE;
} else break; /* not a digit */
}
+#ifdef ALTMETA
+ alt_esc = FALSE; /* readchar() reset */
+#endif
if (foo == '\033') { /* esc cancels count (TH) */
clear_nhwindow(WIN_MESSAGE);
hangup(0); /* call end_of_input() or set program_state.done_hup */
#endif
sym = '\033';
+#ifdef ALTMETA
+ } else if (sym == '\033' && alt_esc) {
+ /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' */
+ sym = *readchar_queue ? *readchar_queue++ : Getchar();
+ if (sym == EOF || sym == 0)
+ sym = '\033';
+ else if (sym != '\033')
+ sym |= 0200; /* force 8th bit on */
+#endif /*ALTMETA*/
} else if (sym == 0) {
/* click event */
readchar_queue = click_to_cmd(x, y, mod);
} boolopt[] = {
{"acoustics", &flags.acoustics, TRUE, SET_IN_GAME},
#if defined(SYSFLAGS) && defined(AMIGA)
+ /* Amiga altmeta causes Alt+key to be converted into Meta+key by
+ low level nethack code; on by default, can be toggled off if
+ Alt+key is needed for some ASCII chars on non-ASCII keyboard */
{"altmeta", &sysflags.altmeta, TRUE, DISP_IN_GAME},
#else
+# ifdef ALTMETA
+ /* non-Amiga altmeta causes nethack's top level command loop to treat
+ two character sequence "ESC c" as M-c, for terminals or emulators
+ which send "ESC c" when Alt+c is pressed; off by default, enabling
+ this can potentially make trouble if user types ESC when nethack
+ is honoring this conversion request (primarily after starting a
+ count prefix prior to a command and then deciding to cancel it) */
+ {"altmeta", &iflags.altmeta, FALSE, SET_IN_GAME},
+# else
{"altmeta", (boolean *)0, TRUE, DISP_IN_GAME},
+# endif
#endif
{"ascii_map", &iflags.wc_ascii_map, !PREFER_TILED, SET_IN_GAME}, /*WC*/
#if defined(SYSFLAGS) && defined(MFLOPPY)
/* NetHack 3.5 windows.c $Date$ $Revision$ */
-/* SCCS Id: @(#)windows.c 3.5 2007/02/01 */
/* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */
{
char *FDECL((*previnterface_getmsghistory), (BOOLEAN_P)) = 0;
+#ifdef ALTMETA
+ /* command processor shouldn't look for 2nd char after seeing ESC */
+ iflags.altmeta = FALSE;
+#endif
+
/* don't call exit_nhwindows() directly here; if a hangup occurs
while interface code is executing, exit_nhwindows could knock
the interface's active data structures out from under itself */