clicklook (main trunk only)
This allows the use of the right mouse button to look at things on the screen when the 'clicklook' option is set. Concept came from a patch for 3.4.0 that I saw referenced on r.g.r.n [see http://www.steelskies.com/nethack.php] but the implementation is different.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
.ds vr "NetHack 3.4
|
||||
.ds f0 "\*(vr
|
||||
.ds f1
|
||||
.ds f2 "June 5, 2003
|
||||
.ds f2 "June 29, 2003
|
||||
.mt
|
||||
A Guide to the Mazes of Menace
|
||||
(Guidebook for NetHack)
|
||||
@@ -1656,6 +1656,9 @@ Check free disk space before writing files to disk (default on).
|
||||
You may have to turn this off if you have more than 2 GB free space
|
||||
on the partition used for your save and level files.
|
||||
Only applies when MFLOPPY was defined during compilation.
|
||||
.lp clicklook
|
||||
Allows looking at things on the screen by navigating the mouse
|
||||
over them and clicking the right mouse button (default off).
|
||||
.lp cmdassist
|
||||
Have the game provide some additional command assistance for
|
||||
new players if it detects some anticipated mistakes (default on).
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\begin{document}
|
||||
%
|
||||
% input file: guidebook.mn
|
||||
% $Revision: 1.65 $ $Date: 2003/05/12 03:05:00 $
|
||||
% $Revision: 1.66 $ $Date: 2003/06/06 03:49:35 $
|
||||
%
|
||||
%.ds h0 "
|
||||
%.ds h1 %.ds h2 \%
|
||||
@@ -40,7 +40,7 @@
|
||||
%.au
|
||||
\author{Eric S. Raymond\\
|
||||
(Extensively edited and expanded for 3.4)}
|
||||
\date{June 5, 2003}
|
||||
\date{June 29, 2003}
|
||||
|
||||
\maketitle
|
||||
|
||||
@@ -2078,6 +2078,10 @@ You may have to turn this off if you have more than 2 GB free space
|
||||
on the partition used for your save and level files.
|
||||
Only applies when MFLOPPY was defined during compilation.
|
||||
%.lp
|
||||
\item[\ib{clicklook}]
|
||||
Allows looking at things on the screen by navigating the mouse
|
||||
over them and clicking the right mouse button (default off).
|
||||
%.lp
|
||||
\item[\ib{cmdassist}]
|
||||
Have the game provide some additional command assistance for new
|
||||
players if it detects some anticipated mistakes (default on).
|
||||
|
||||
@@ -41,6 +41,8 @@ General New Features
|
||||
--------------------
|
||||
burying a punishment ball no longer ends your punishment
|
||||
#tip command--pay a modest gratuity
|
||||
add clicklook option to allow looking at things on the display by clicking
|
||||
right mouse button when floating mouse pointer over them
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific New Features
|
||||
|
||||
@@ -1405,6 +1405,7 @@ E int NDECL(dowhatdoes);
|
||||
E char *FDECL(dowhatdoes_core,(CHAR_P, char *));
|
||||
E int NDECL(dohelp);
|
||||
E int NDECL(dohistory);
|
||||
E int FDECL(do_look, (int, coord *));
|
||||
|
||||
/* ### pcmain.c ### */
|
||||
|
||||
|
||||
@@ -262,6 +262,7 @@ struct instance_flags {
|
||||
boolean wc_mouse_support; /* allow mouse support */
|
||||
|
||||
boolean cmdassist; /* provide detailed assistance for some commands */
|
||||
boolean clicklook; /* allow right-clicking for look */
|
||||
boolean obsolete; /* obsolete options can point at this, it isn't used */
|
||||
#ifdef WIN32CON
|
||||
#define MAX_ALTKEYHANDLER 25
|
||||
|
||||
17
src/cmd.c
17
src/cmd.c
@@ -14,7 +14,8 @@
|
||||
#define NR_OF_EOFS 20
|
||||
#endif
|
||||
|
||||
#define CMD_TRAVEL (char)0x90
|
||||
#define CMD_TRAVEL (char)0x90
|
||||
#define CMD_CLICKLOOK (char)0x8F
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
@@ -151,6 +152,7 @@ static void NDECL(end_of_input);
|
||||
#endif /* OVLB */
|
||||
|
||||
static const char* readchar_queue="";
|
||||
static coord clicklook_cc;
|
||||
|
||||
STATIC_DCL char *NDECL(parse);
|
||||
STATIC_DCL boolean FDECL(help_dir, (CHAR_P,const char *));
|
||||
@@ -1853,6 +1855,12 @@ register char *cmd;
|
||||
flags.move = FALSE;
|
||||
multi = 0;
|
||||
return;
|
||||
case CMD_CLICKLOOK:
|
||||
if (iflags.clicklook) {
|
||||
flags.move = FALSE;
|
||||
do_look(2, &clicklook_cc);
|
||||
}
|
||||
return;
|
||||
case CMD_TRAVEL:
|
||||
if (flags.travelcmd) {
|
||||
flags.travel = 1;
|
||||
@@ -2167,6 +2175,13 @@ click_to_cmd(x, y, mod)
|
||||
static char cmd[4];
|
||||
cmd[1]=0;
|
||||
|
||||
if (iflags.clicklook && mod == CLICK_2) {
|
||||
clicklook_cc.x = x;
|
||||
clicklook_cc.y = y;
|
||||
cmd[0] = CMD_CLICKLOOK;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
x -= u.ux;
|
||||
y -= u.uy;
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ static struct Bool_Opt
|
||||
#else
|
||||
{"checkspace", (boolean *)0, FALSE, SET_IN_FILE},
|
||||
#endif
|
||||
{"clicklook", &iflags.clicklook, FALSE, SET_IN_GAME},
|
||||
{"cmdassist", &iflags.cmdassist, TRUE, SET_IN_GAME},
|
||||
# if defined(MICRO) || defined(WIN32)
|
||||
{"color", &iflags.wc_color,TRUE, SET_IN_GAME}, /*WC*/
|
||||
|
||||
112
src/pager.c
112
src/pager.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)pager.c 3.4 2002/12/18 */
|
||||
/* SCCS Id: @(#)pager.c 3.4 2003/06/29 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -13,7 +13,6 @@ STATIC_DCL int FDECL(append_str, (char *, const char *));
|
||||
STATIC_DCL struct permonst * FDECL(lookat, (int, int, char *, char *));
|
||||
STATIC_DCL void FDECL(checkfile,
|
||||
(char *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
|
||||
STATIC_DCL int FDECL(do_look, (BOOLEAN_P));
|
||||
STATIC_DCL boolean FDECL(help_menu, (int *));
|
||||
#ifdef PORT_HELP
|
||||
extern void NDECL(port_help);
|
||||
@@ -454,10 +453,13 @@ bad_data_file: impossible("'data' file in wrong format");
|
||||
/* also used by getpos hack in do_name.c */
|
||||
const char what_is_an_unknown_object[] = "an unknown object";
|
||||
|
||||
STATIC_OVL int
|
||||
do_look(quick)
|
||||
boolean quick; /* use cursor && don't search for "more info" */
|
||||
int
|
||||
do_look(mode, click_cc)
|
||||
int mode;
|
||||
coord *click_cc;
|
||||
{
|
||||
boolean quick = (mode == 1); /* use cursor && don't search for "more info" */
|
||||
boolean clicklook = (mode == 2); /* right mouse-click method */
|
||||
char out_str[BUFSZ], look_buf[BUFSZ];
|
||||
const char *x_str, *firstmatch = 0;
|
||||
struct permonst *pm = 0;
|
||||
@@ -472,28 +474,34 @@ do_look(quick)
|
||||
int skipped_venom; /* non-zero if we ignored "splash of venom" */
|
||||
static const char *mon_interior = "the interior of a monster";
|
||||
|
||||
if (quick) {
|
||||
from_screen = TRUE; /* yes, we want to use the cursor */
|
||||
} else {
|
||||
i = ynq("Specify unknown object by cursor?");
|
||||
if (i == 'q') return 0;
|
||||
from_screen = (i == 'y');
|
||||
}
|
||||
|
||||
if (from_screen) {
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
sym = 0; /* gcc -Wall lint */
|
||||
} else {
|
||||
getlin("Specify what? (type the word)", out_str);
|
||||
if (out_str[0] == '\0' || out_str[0] == '\033')
|
||||
return 0;
|
||||
|
||||
if (out_str[1]) { /* user typed in a complete string */
|
||||
checkfile(out_str, pm, TRUE, TRUE);
|
||||
return 0;
|
||||
if (!clicklook) {
|
||||
if (quick) {
|
||||
from_screen = TRUE; /* yes, we want to use the cursor */
|
||||
} else {
|
||||
i = ynq("Specify unknown object by cursor?");
|
||||
if (i == 'q') return 0;
|
||||
from_screen = (i == 'y');
|
||||
}
|
||||
sym = out_str[0];
|
||||
|
||||
if (from_screen) {
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
sym = 0; /* gcc -Wall lint */
|
||||
} else {
|
||||
getlin("Specify what? (type the word)", out_str);
|
||||
if (out_str[0] == '\0' || out_str[0] == '\033')
|
||||
return 0;
|
||||
if (out_str[1]) { /* user typed in a complete string */
|
||||
checkfile(out_str, pm, TRUE, TRUE);
|
||||
return 0;
|
||||
}
|
||||
sym = out_str[0];
|
||||
}
|
||||
} else { /* clicklook */
|
||||
cc.x = click_cc->x;
|
||||
cc.y = click_cc->y;
|
||||
sym = 0;
|
||||
from_screen = FALSE;
|
||||
}
|
||||
|
||||
/* Save the verbose flag, we change it later. */
|
||||
@@ -510,21 +518,23 @@ do_look(quick)
|
||||
found = 0;
|
||||
out_str[0] = '\0';
|
||||
|
||||
if (from_screen) {
|
||||
if (from_screen || clicklook) {
|
||||
int glyph; /* glyph at selected position */
|
||||
|
||||
if (flags.verbose)
|
||||
pline("Please move the cursor to %s.",
|
||||
what_is_an_unknown_object);
|
||||
else
|
||||
pline("Pick an object.");
|
||||
if (from_screen) {
|
||||
if (flags.verbose)
|
||||
pline("Please move the cursor to %s.",
|
||||
what_is_an_unknown_object);
|
||||
else
|
||||
pline("Pick an object.");
|
||||
|
||||
ans = getpos(&cc, quick, what_is_an_unknown_object);
|
||||
if (ans < 0 || cc.x < 0) {
|
||||
flags.verbose = save_verbose;
|
||||
return 0; /* done */
|
||||
ans = getpos(&cc, quick, what_is_an_unknown_object);
|
||||
if (ans < 0 || cc.x < 0) {
|
||||
flags.verbose = save_verbose;
|
||||
return 0; /* done */
|
||||
}
|
||||
flags.verbose = FALSE; /* only print long question once */
|
||||
}
|
||||
flags.verbose = FALSE; /* only print long question once */
|
||||
|
||||
/* Convert the glyph at the selected position to a symbol. */
|
||||
glyph = glyph_at(cc.x,cc.y);
|
||||
@@ -560,7 +570,7 @@ do_look(quick)
|
||||
|
||||
/* Check for monsters */
|
||||
for (i = 0; i < MAXMCLASSES; i++) {
|
||||
if (sym == (from_screen ? monsyms[i] : def_monsyms[i]) &&
|
||||
if (sym == ((from_screen || clicklook) ? monsyms[i] : def_monsyms[i]) &&
|
||||
monexplain[i]) {
|
||||
need_to_look = TRUE;
|
||||
if (!found) {
|
||||
@@ -575,7 +585,7 @@ do_look(quick)
|
||||
/* handle '@' as a special case if it refers to you and you're
|
||||
playing a character which isn't normally displayed by that
|
||||
symbol; firstmatch is assumed to already be set for '@' */
|
||||
if ((from_screen ?
|
||||
if (((from_screen || clicklook) ?
|
||||
(sym == monsyms[S_HUMAN] && cc.x == u.ux && cc.y == u.uy) :
|
||||
(sym == def_monsyms[S_HUMAN] && !flags.showrace)) &&
|
||||
!(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd)
|
||||
@@ -586,7 +596,7 @@ do_look(quick)
|
||||
* and looking at something other than our own symbol, then just say
|
||||
* "the interior of a monster".
|
||||
*/
|
||||
if (u.uswallow && from_screen && is_swallow_sym(sym)) {
|
||||
if (u.uswallow && (from_screen || clicklook) && is_swallow_sym(sym)) {
|
||||
if (!found) {
|
||||
Sprintf(out_str, "%c %s", sym, mon_interior);
|
||||
firstmatch = mon_interior;
|
||||
@@ -598,9 +608,9 @@ do_look(quick)
|
||||
|
||||
/* Now check for objects */
|
||||
for (i = 1; i < MAXOCLASSES; i++) {
|
||||
if (sym == (from_screen ? oc_syms[i] : def_oc_syms[i])) {
|
||||
if (sym == ((from_screen || clicklook) ? oc_syms[i] : def_oc_syms[i])) {
|
||||
need_to_look = TRUE;
|
||||
if (from_screen && i == VENOM_CLASS) {
|
||||
if ((from_screen || clicklook) && i == VENOM_CLASS) {
|
||||
skipped_venom++;
|
||||
continue;
|
||||
}
|
||||
@@ -630,7 +640,8 @@ do_look(quick)
|
||||
/* Now check for graphics symbols */
|
||||
for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) {
|
||||
x_str = defsyms[i].explanation;
|
||||
if (sym == (from_screen ? showsyms[i] : defsyms[i].sym) && *x_str) {
|
||||
if (sym == ((from_screen || clicklook) ?
|
||||
showsyms[i] : defsyms[i].sym) && *x_str) {
|
||||
/* avoid "an air", "a water", or "a floor of a room" */
|
||||
int article = (i == S_room) ? 2 : /* 2=>"the" */
|
||||
!(strcmp(x_str, "air") == 0 || /* 1=>"an" */
|
||||
@@ -663,7 +674,8 @@ do_look(quick)
|
||||
/* Now check for warning symbols */
|
||||
for (i = 1; i < WARNCOUNT; i++) {
|
||||
x_str = def_warnsyms[i].explanation;
|
||||
if (sym == (from_screen ? warnsyms[i] : def_warnsyms[i].sym)) {
|
||||
if (sym == ((from_screen || clicklook) ?
|
||||
warnsyms[i] : def_warnsyms[i].sym)) {
|
||||
if (!found) {
|
||||
Sprintf(out_str, "%c %s",
|
||||
sym, def_warnsyms[i].explanation);
|
||||
@@ -674,7 +686,7 @@ do_look(quick)
|
||||
}
|
||||
/* Kludge: warning trumps boulders on the display.
|
||||
Reveal the boulder too or player can get confused */
|
||||
if (from_screen && sobj_at(BOULDER, cc.x, cc.y))
|
||||
if ((from_screen || clicklook) && sobj_at(BOULDER, cc.x, cc.y))
|
||||
Strcat(out_str, " co-located with a boulder");
|
||||
break; /* out of for loop*/
|
||||
}
|
||||
@@ -707,7 +719,7 @@ do_look(quick)
|
||||
* If we are looking at the screen, follow multiple possibilities or
|
||||
* an ambiguous explanation by something more detailed.
|
||||
*/
|
||||
if (from_screen) {
|
||||
if (from_screen || clicklook) {
|
||||
if (found > 1 || need_to_look) {
|
||||
char monbuf[BUFSZ];
|
||||
char temp_buf[BUFSZ];
|
||||
@@ -731,7 +743,7 @@ do_look(quick)
|
||||
pline("%s", out_str);
|
||||
/* check the data file for information about this thing */
|
||||
if (found == 1 && ans != LOOK_QUICK && ans != LOOK_ONCE &&
|
||||
(ans == LOOK_VERBOSE || (flags.help && !quick))) {
|
||||
(ans == LOOK_VERBOSE || (flags.help && !quick)) && !clicklook) {
|
||||
char temp_buf[BUFSZ];
|
||||
Strcpy(temp_buf, firstmatch);
|
||||
checkfile(temp_buf, pm, FALSE, (boolean)(ans == LOOK_VERBOSE));
|
||||
@@ -740,7 +752,7 @@ do_look(quick)
|
||||
pline("I've never heard of such things.");
|
||||
}
|
||||
|
||||
} while (from_screen && !quick && ans != LOOK_ONCE);
|
||||
} while (from_screen && !quick && ans != LOOK_ONCE && !clicklook);
|
||||
|
||||
flags.verbose = save_verbose;
|
||||
return 0;
|
||||
@@ -750,13 +762,13 @@ do_look(quick)
|
||||
int
|
||||
dowhatis()
|
||||
{
|
||||
return do_look(FALSE);
|
||||
return do_look(0,(coord *)0);
|
||||
}
|
||||
|
||||
int
|
||||
doquickwhatis()
|
||||
{
|
||||
return do_look(TRUE);
|
||||
return do_look(1,(coord *)0);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user