Two new options
Add "travel" boolean option to enable/disable travel command. Add "mouse_support" wincap option to enable/disable mouse. - When running the win32 tty version full-screen, some people complained about the square mouse cursor. Newsgroups: rec.games.roguelike.nethack Subject: Re: Getting rid of the cursor? <email deleted> <email deleted> Followup-To: On Thu, 04 Apr 2002 00:20:06 <email deleted> wrote: > Ok, let me be more specific: when playing the windows non-GUI version, is > there a way to get rid of the large rectangular white cursor? > > <email deleted> wrote in message > <email deleted> >> Can you get rid of the cursor in the windows version? I really hate that >> thing. >> <email deleted> >Newsgroups: rec.games.roguelike.nethack >Subject: Disabling Mouse Input > >I purchased an older P120 laptop to be able to play Nethack at the hotel. >I find that I rest my thumbs on the mouse touch pad all too often and my >@ moves unexpectedly at times. I took a peruse through defaults.nh, but >came up empty. > >Anyone know if mouse input can be disabled? > >MRSisson
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
.ds vr "NetHack 3.4
|
||||
.ds f0 "\*(vr
|
||||
.ds f1
|
||||
.ds f2 "March 20, 2002
|
||||
.ds f2 "April 3, 2002
|
||||
.mt
|
||||
A Guide to the Mazes of Menace
|
||||
(Guidebook for NetHack)
|
||||
@@ -2036,6 +2036,8 @@ pit, spiked pit, hole, trap door, teleportation trap, level teleporter,
|
||||
magic portal, web, statue trap, magic trap, anti-magic field, polymorph trap.
|
||||
|
||||
Cannot be set with the `O' command.
|
||||
.lp travel
|
||||
Allow the travel command (default on).
|
||||
.lp verbose
|
||||
Provide more commentary during the game (default on).
|
||||
.lp videocolors
|
||||
@@ -2113,6 +2115,8 @@ with tiles, generally displays a heart symbol near pets.
|
||||
NetHack should use a large font.
|
||||
.lp map_mode
|
||||
NetHack should display the map in the manner specified.
|
||||
.lp mouse_support
|
||||
Allow use of the mouse for input and travel.
|
||||
.lp player_selection
|
||||
NetHack should pop up dialog boxes, or use prompts for character selection.
|
||||
.lp popup_dialog
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\begin{document}
|
||||
%
|
||||
% input file: guidebook.mn
|
||||
% $Revision: 1.38 $ $Date: 2002/03/31 06:27:18 $
|
||||
% $Revision: 1.39 $ $Date: 2002/03/31 07:19:43 $
|
||||
%
|
||||
%.ds h0 "
|
||||
%.ds h1 %.ds h2 \%
|
||||
@@ -40,7 +40,7 @@
|
||||
%.au
|
||||
\author{Eric S. Raymond\\
|
||||
(Extensively edited and expanded for 3.4)}
|
||||
\date{March 20, 2002}
|
||||
\date{April 3, 2002}
|
||||
|
||||
\maketitle
|
||||
|
||||
@@ -2496,6 +2496,9 @@ magic portal, web, statue trap, magic trap, anti-magic field, polymorph trap.
|
||||
|
||||
Cannot be set with the `{\tt O}' command.
|
||||
%.lp
|
||||
\item[\ib{travel}]
|
||||
Allow the travel command (default on).
|
||||
%.lp
|
||||
\item[\ib{verbose}]
|
||||
Provide more commentary during the game (default on).
|
||||
%.lp
|
||||
@@ -2601,6 +2604,9 @@ NetHack should use a large font.
|
||||
\item[\ib{map\_mode}]
|
||||
NetHack should display the map in the manner specified.
|
||||
%.lp
|
||||
\item[\ib{mouse\_support}]
|
||||
Allow use of the mouse for input and travel.
|
||||
%.lp
|
||||
\item[\ib{player\_selection}]
|
||||
NetHack should pop up dialog boxes or use prompts for character selection.
|
||||
%.lp
|
||||
|
||||
@@ -69,3 +69,5 @@ General New Features
|
||||
--------------------
|
||||
lootabc option
|
||||
showrace option
|
||||
travel option
|
||||
mouse_support wincap option
|
||||
|
||||
@@ -499,6 +499,7 @@ to support:
|
||||
| | | wc_backgrnd_status |char * |
|
||||
| | | wc_foregrnd_text |char * |
|
||||
| | | wc_backgrnd_text |char * |
|
||||
| mouse | WC_MOUSE_SUPPORT | wc_mouse_support |boolean |
|
||||
+--------------------+--------------------+--------------------+--------+
|
||||
|
||||
align_message -- where to place message window (top, bottom, left, right)
|
||||
@@ -541,6 +542,7 @@ windowcolors
|
||||
-- port should use these colors for window foreground/background
|
||||
colors. Syntax:
|
||||
menu fore/back message fore/back status fore/back text fore/back
|
||||
mouse_support -- port should enable mouse support if possible
|
||||
|
||||
Whenever one of these settings is adjusted, the port is notified of a change
|
||||
to the setting by calling the port's preference_update() routine. The port
|
||||
@@ -578,10 +580,11 @@ To add a new wincap option, please follow all these steps:
|
||||
2. Add the description to the paragraph below the chart.
|
||||
3. Add the WC_ to the bit list in include/winprocs.h (if there is room).
|
||||
4. Add the wc_ field(s) to the iflags structure in flag.h.
|
||||
5. Add an appropriate parser to parseoptions() in options.c.
|
||||
6. Add code to display current value to get_compopt_value() in options.c.
|
||||
7. Document the option in Guidebook.mn and Guidebook.tex.
|
||||
8. Add the bit name to the OR'd values in your window port's winprocs struct
|
||||
5. Add the name and value to wc_options[] in options.c
|
||||
6. Add an appropriate parser to parseoptions() in options.c.
|
||||
7. Add code to display current value to get_compopt_value() in options.c.
|
||||
8. Document the option in Guidebook.mn and Guidebook.tex.
|
||||
9. Add the bit name to the OR'd values in your window port's winprocs struct
|
||||
wincap mask if your port supports the option.
|
||||
|
||||
V. New or respecified common, high level routines
|
||||
|
||||
@@ -252,10 +252,12 @@ struct instance_flags {
|
||||
boolean wc_large_font; /* draw in larger fonts (say, 12pt instead
|
||||
of 9pt) */
|
||||
boolean wc_eight_bit_input; /* allow eight bit input */
|
||||
boolean wc_mouse_support; /* allow mouse support */
|
||||
|
||||
/* Items which belong in flags, but are here to allow save compatibility */
|
||||
boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
|
||||
boolean showrace; /* show hero glyph by race rather than by role */
|
||||
boolean travelcmd; /* allow travel command */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -121,6 +121,10 @@ extern char hackdir[];
|
||||
#define getuid() 1
|
||||
#define getlogin() ((char *)0)
|
||||
extern void NDECL(win32_abort);
|
||||
#ifdef WIN32CON
|
||||
extern void FDECL(nttty_preference_update, (const char *));
|
||||
extern void NDECL(toggle_mouse_support);
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifndef __BORLANDC__
|
||||
|
||||
@@ -165,7 +165,8 @@ extern NEARDATA struct window_procs windowprocs;
|
||||
#define WC_MAP_MODE 0x10000000L /* 29 map_mode option */
|
||||
#define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */
|
||||
#define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */
|
||||
/* 1 free bit */
|
||||
#define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */
|
||||
/* no free bits */
|
||||
|
||||
#define ALIGN_LEFT 1
|
||||
#define ALIGN_RIGHT 2
|
||||
|
||||
140
src/cmd.c
140
src/cmd.c
@@ -1738,11 +1738,14 @@ register char *cmd;
|
||||
multi = 0;
|
||||
return;
|
||||
case CMD_TRAVEL:
|
||||
flags.travel = 1;
|
||||
flags.run = 8;
|
||||
flags.nopick = 1;
|
||||
do_rush = TRUE;
|
||||
break;
|
||||
if (iflags.travelcmd) {
|
||||
flags.travel = 1;
|
||||
flags.run = 8;
|
||||
flags.nopick = 1;
|
||||
do_rush = TRUE;
|
||||
break;
|
||||
}
|
||||
/*FALLTHRU*/
|
||||
default: if (movecmd(*cmd)) { /* ordinary movement */
|
||||
do_walk = TRUE;
|
||||
} else if (movecmd(iflags.num_pad ?
|
||||
@@ -1936,62 +1939,81 @@ click_to_cmd(x, y, mod)
|
||||
x -= u.ux;
|
||||
y -= u.uy;
|
||||
|
||||
if ( abs(x) <= 1 && abs(y) <= 1 ) {
|
||||
x = sgn(x), y = sgn(y);
|
||||
if (iflags.travelcmd) {
|
||||
if (abs(x) <= 1 && abs(y) <= 1 ) {
|
||||
x = sgn(x), y = sgn(y);
|
||||
} else {
|
||||
u.tx = u.ux+x;
|
||||
u.ty = u.uy+y;
|
||||
cmd[0] = CMD_TRAVEL;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
if(x == 0 && y == 0) {
|
||||
/* here */
|
||||
if(IS_FOUNTAIN(levl[u.ux][u.uy].typ) || IS_SINK(levl[u.ux][u.uy].typ)) {
|
||||
cmd[0]=mod == CLICK_1 ? 'q' : M('d');
|
||||
return cmd;
|
||||
} else if(IS_THRONE(levl[u.ux][u.uy].typ)) {
|
||||
cmd[0]=M('s');
|
||||
return cmd;
|
||||
} else if((u.ux == xupstair && u.uy == yupstair)
|
||||
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && sstairs.up)
|
||||
|| (u.ux == xupladder && u.uy == yupladder)) {
|
||||
return "<";
|
||||
} else if((u.ux == xdnstair && u.uy == ydnstair)
|
||||
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)
|
||||
|| (u.ux == xdnladder && u.uy == ydnladder)) {
|
||||
return ">";
|
||||
} else if(OBJ_AT(u.ux, u.uy)) {
|
||||
cmd[0] = Is_container(level.objects[u.ux][u.uy]) ? M('l') : ',';
|
||||
return cmd;
|
||||
} else {
|
||||
return "."; /* just rest */
|
||||
}
|
||||
}
|
||||
|
||||
/* directional commands */
|
||||
|
||||
dir = xytod(x, y);
|
||||
|
||||
if (!m_at(u.ux+x, u.uy+y) && !test_move(u.ux, u.uy, x, y, 1)) {
|
||||
cmd[1] = (iflags.num_pad ? ndir[dir] : sdir[dir]);
|
||||
cmd[2] = 0;
|
||||
if (IS_DOOR(levl[u.ux+x][u.uy+y].typ)) {
|
||||
/* slight assistance to the player: choose kick/open for them */
|
||||
if (levl[u.ux+x][u.uy+y].doormask & D_LOCKED) {
|
||||
cmd[0] = C('d');
|
||||
return cmd;
|
||||
}
|
||||
if (levl[u.ux+x][u.uy+y].doormask & D_CLOSED) {
|
||||
cmd[0] = 'o';
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
if (levl[u.ux+x][u.uy+y].typ <= SCORR) {
|
||||
cmd[0] = 's';
|
||||
cmd[1] = 0;
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
u.tx = u.ux+x;
|
||||
u.ty = u.uy+y;
|
||||
cmd[0] = CMD_TRAVEL;
|
||||
return cmd;
|
||||
}
|
||||
/* convert without using floating point, allowing sloppy clicking */
|
||||
if(x > 2*abs(y))
|
||||
x = 1, y = 0;
|
||||
else if(y > 2*abs(x))
|
||||
x = 0, y = 1;
|
||||
else if(x < -2*abs(y))
|
||||
x = -1, y = 0;
|
||||
else if(y < -2*abs(x))
|
||||
x = 0, y = -1;
|
||||
else
|
||||
x = sgn(x), y = sgn(y);
|
||||
|
||||
if(x == 0 && y == 0) {
|
||||
/* here */
|
||||
if(IS_FOUNTAIN(levl[u.ux][u.uy].typ) || IS_SINK(levl[u.ux][u.uy].typ)) {
|
||||
cmd[0]=mod == CLICK_1 ? 'q' : M('d');
|
||||
return cmd;
|
||||
} else if(IS_THRONE(levl[u.ux][u.uy].typ)) {
|
||||
cmd[0]=M('s');
|
||||
return cmd;
|
||||
} else if((u.ux == xupstair && u.uy == yupstair)
|
||||
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && sstairs.up)
|
||||
|| (u.ux == xupladder && u.uy == yupladder)) {
|
||||
return "<";
|
||||
} else if((u.ux == xdnstair && u.uy == ydnstair)
|
||||
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)
|
||||
|| (u.ux == xdnladder && u.uy == ydnladder)) {
|
||||
return ">";
|
||||
} else if(OBJ_AT(u.ux, u.uy)) {
|
||||
cmd[0] = Is_container(level.objects[u.ux][u.uy]) ? M('l') : ',';
|
||||
return cmd;
|
||||
} else {
|
||||
return "."; /* just rest */
|
||||
}
|
||||
}
|
||||
if(x == 0 && y == 0) /* map click on player to "rest" command */
|
||||
return ".";
|
||||
|
||||
/* directional commands */
|
||||
|
||||
dir = xytod(x, y);
|
||||
|
||||
if (!m_at(u.ux+x, u.uy+y) && !test_move(u.ux, u.uy, x, y, 1)) {
|
||||
cmd[1] = (iflags.num_pad ? ndir[dir] : sdir[dir]);
|
||||
cmd[2] = 0;
|
||||
if (IS_DOOR(levl[u.ux+x][u.uy+y].typ)) {
|
||||
/* slight assistance to the player: choose kick/open for them */
|
||||
if (levl[u.ux+x][u.uy+y].doormask & D_LOCKED) {
|
||||
cmd[0] = C('d');
|
||||
return cmd;
|
||||
}
|
||||
if (levl[u.ux+x][u.uy+y].doormask & D_CLOSED) {
|
||||
cmd[0] = 'o';
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
if (levl[u.ux+x][u.uy+y].typ <= SCORR) {
|
||||
cmd[0] = 's';
|
||||
cmd[1] = 0;
|
||||
return cmd;
|
||||
}
|
||||
dir = xytod(x, y);
|
||||
}
|
||||
|
||||
/* move, attack, etc. */
|
||||
@@ -2142,6 +2164,8 @@ dotravel()
|
||||
/* Keyboard travel command */
|
||||
static char cmd[2];
|
||||
coord cc;
|
||||
|
||||
if (!iflags.travelcmd) return 0;
|
||||
cmd[1]=0;
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
|
||||
@@ -128,6 +128,7 @@ static struct Bool_Opt
|
||||
#else
|
||||
{"msg_window", (boolean *)0, FALSE, SET_IN_FILE},
|
||||
#endif
|
||||
{"mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME}, /*WC*/
|
||||
#ifdef NEWS
|
||||
{"news", &iflags.news, TRUE, DISP_IN_GAME},
|
||||
#else
|
||||
@@ -183,6 +184,7 @@ static struct Bool_Opt
|
||||
#endif
|
||||
{"tombstone",&flags.tombstone, TRUE, SET_IN_GAME},
|
||||
{"toptenwin",&flags.toptenwin, FALSE, SET_IN_GAME},
|
||||
{"travel", &iflags.travelcmd, TRUE, SET_IN_GAME},
|
||||
{"use_inverse", &iflags.wc_inverse, FALSE, SET_IN_GAME}, /*WC*/
|
||||
{"verbose", &flags.verbose, TRUE, SET_IN_GAME},
|
||||
{(char *)0, (boolean *)0, FALSE, 0}
|
||||
@@ -2990,6 +2992,7 @@ struct wc_Opt wc_options[] = {
|
||||
{"hilite_pet", WC_HILITE_PET},
|
||||
{"large_font", WC_LARGE_FONT}, /* now obsolete */
|
||||
{"popup_dialog", WC_POPUP_DIALOG},
|
||||
{"player_selection", WC_PLAYER_SELECTION},
|
||||
{"preload_tiles", WC_PRELOAD_TILES},
|
||||
{"tiled_map", WC_TILED_MAP},
|
||||
{"tile_file", WC_TILE_FILE},
|
||||
@@ -3013,7 +3016,10 @@ struct wc_Opt wc_options[] = {
|
||||
{"font_text", WC_FONT_TEXT},
|
||||
{"map_mode", WC_MAP_MODE},
|
||||
{"scroll_margin", WC_SCROLL_MARGIN},
|
||||
{"splash_screen", WC_SPLASH_SCREEN},
|
||||
{"vary_msgcount",WC_VARY_MSGCOUNT},
|
||||
{"windowcolors", WC_WINDOWCOLORS},
|
||||
{"mouse_support", WC_MOUSE_SUPPORT},
|
||||
{(char *)0, 0L}
|
||||
};
|
||||
|
||||
|
||||
@@ -245,6 +245,10 @@ char *argv[];
|
||||
process_options(argc, argv);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32CON
|
||||
toggle_mouse_support(); /* must come after process_options */
|
||||
#endif
|
||||
|
||||
#ifdef MFLOPPY
|
||||
set_lock_and_bones();
|
||||
# ifndef AMIGA
|
||||
|
||||
@@ -128,6 +128,7 @@ int *wid, *hgt;
|
||||
if (twid > 80) twid = 80;
|
||||
*wid = twid;
|
||||
*hgt = origcsbi.srWindow.Bottom - origcsbi.srWindow.Top;
|
||||
set_option_mod_status("mouse_support", SET_IN_GAME);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -225,16 +226,18 @@ nttty_open()
|
||||
0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,0);
|
||||
#endif
|
||||
GetConsoleMode(hConIn,&cmode);
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
mask = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
|
||||
ENABLE_ECHO_INPUT | ENABLE_WINDOW_INPUT;
|
||||
#else
|
||||
#ifdef NO_MOUSE_ALLOWED
|
||||
mask = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
|
||||
ENABLE_MOUSE_INPUT | ENABLE_ECHO_INPUT | ENABLE_WINDOW_INPUT;
|
||||
#else
|
||||
mask = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
|
||||
ENABLE_ECHO_INPUT | ENABLE_WINDOW_INPUT;
|
||||
#endif
|
||||
/* Turn OFF the settings specified in the mask */
|
||||
cmode &= ~mask;
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
cmode |= ENABLE_MOUSE_INPUT;
|
||||
#endif
|
||||
SetConsoleMode(hConIn,cmode);
|
||||
if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE)) {
|
||||
/* Unable to set control handler */
|
||||
@@ -484,7 +487,7 @@ nttty_kbhit()
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
else /* Discard it, its an insignificant event */
|
||||
else /* Discard it, it's an insignificant event */
|
||||
ReadConsoleInput(hConIn,&ir,1,&count);
|
||||
} else /* There are no events in console event queue */ {
|
||||
done = 1; /* Stop looking */
|
||||
@@ -862,4 +865,29 @@ standoutend()
|
||||
colorchange = TRUE;
|
||||
}
|
||||
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
void
|
||||
toggle_mouse_support()
|
||||
{
|
||||
DWORD cmode;
|
||||
GetConsoleMode(hConIn,&cmode);
|
||||
if (iflags.wc_mouse_support)
|
||||
cmode |= ENABLE_MOUSE_INPUT;
|
||||
else
|
||||
cmode &= ~ENABLE_MOUSE_INPUT;
|
||||
SetConsoleMode(hConIn,cmode);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* handle tty options updates here */
|
||||
void nttty_preference_update(pref)
|
||||
const char *pref;
|
||||
{
|
||||
if( stricmp( pref, "mouse_support")==0) {
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
toggle_mouse_support();
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif /* WIN32CON */
|
||||
|
||||
@@ -45,6 +45,9 @@ struct window_procs tty_procs = {
|
||||
"tty",
|
||||
#ifdef MSDOS
|
||||
WC_TILED_MAP|WC_ASCII_MAP|
|
||||
#endif
|
||||
#if defined(WIN32CON)
|
||||
WC_MOUSE_SUPPORT|
|
||||
#endif
|
||||
WC_COLOR|WC_HILITE_PET|WC_INVERSE|WC_EIGHT_BIT_IN,
|
||||
tty_init_nhwindows,
|
||||
@@ -100,7 +103,11 @@ struct window_procs tty_procs = {
|
||||
tty_start_screen,
|
||||
tty_end_screen,
|
||||
genl_outrip,
|
||||
#if defined(WIN32CON)
|
||||
nttty_preference_update,
|
||||
#else
|
||||
genl_preference_update,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int maxwin = 0; /* number of windows in use */
|
||||
|
||||
Reference in New Issue
Block a user