Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource
This commit is contained in:
@@ -893,6 +893,7 @@ boomerang makes noise when hitting a sink
|
||||
non-pet rust monsters would eat rust-proofed non-digestibles but ignore
|
||||
those non-digestibles otherwise
|
||||
kicking a grave may topple the gravestone
|
||||
allow showing legal jumping positions when asked for location to jump to
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
68
src/apply.c
68
src/apply.c
@@ -20,6 +20,7 @@ STATIC_DCL void FDECL(use_candelabrum, (struct obj *));
|
||||
STATIC_DCL void FDECL(use_candle, (struct obj **));
|
||||
STATIC_DCL void FDECL(use_lamp, (struct obj *));
|
||||
STATIC_DCL void FDECL(light_cocktail, (struct obj *));
|
||||
STATIC_PTR void FDECL(display_jump_positions, (int));
|
||||
STATIC_DCL void FDECL(use_tinning_kit, (struct obj *));
|
||||
STATIC_DCL void FDECL(use_figurine, (struct obj **));
|
||||
STATIC_DCL void FDECL(use_grease, (struct obj *));
|
||||
@@ -1361,6 +1362,53 @@ dojump()
|
||||
return jump(0);
|
||||
}
|
||||
|
||||
boolean
|
||||
is_valid_jump_pos(x,y, magic, showmsg)
|
||||
int x,y, magic;
|
||||
boolean showmsg;
|
||||
{
|
||||
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping &&
|
||||
distu(x, y) != 5) {
|
||||
/* The Knight jumping restriction still applies when riding a
|
||||
* horse. After all, what shape is the knight piece in chess?
|
||||
*/
|
||||
if (showmsg) pline("Illegal move!");
|
||||
return FALSE;
|
||||
} else if (distu(x, y) > (magic ? 6+magic*3 : 9)) {
|
||||
if (showmsg) pline("Too far!");
|
||||
return FALSE;
|
||||
} else if (!cansee(x, y)) {
|
||||
if (showmsg) You("cannot see where to land!");
|
||||
return FALSE;
|
||||
} else if (!isok(x, y)) {
|
||||
if (showmsg) You("cannot jump there!");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int jumping_is_magic;
|
||||
|
||||
void
|
||||
display_jump_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
for (dx = -4; dx <= 4; dx++)
|
||||
for (dy = -4; dy <= 4; dy++) {
|
||||
x = dx + (int)u.ux;
|
||||
y = dy + (int)u.uy;
|
||||
if (isok(x,y) && is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
|
||||
tmp_at(x,y);
|
||||
}
|
||||
} else {
|
||||
tmp_at(DISP_END, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
jump(magic)
|
||||
int magic; /* 0=Physical, otherwise skill level */
|
||||
@@ -1440,24 +1488,12 @@ int magic; /* 0=Physical, otherwise skill level */
|
||||
pline("Where do you want to jump?");
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
jumping_is_magic = magic;
|
||||
getpos_sethilite(display_jump_positions);
|
||||
if (getpos(&cc, TRUE, "the desired position") < 0)
|
||||
return 0; /* user pressed ESC */
|
||||
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping &&
|
||||
distu(cc.x, cc.y) != 5) {
|
||||
/* The Knight jumping restriction still applies when riding a
|
||||
* horse. After all, what shape is the knight piece in chess?
|
||||
*/
|
||||
pline("Illegal move!");
|
||||
return 0;
|
||||
} else if (distu(cc.x, cc.y) > (magic ? 6+magic*3 : 9)) {
|
||||
pline("Too far!");
|
||||
return 0;
|
||||
} else if (!cansee(cc.x, cc.y)) {
|
||||
You("cannot see where to land!");
|
||||
return 0;
|
||||
} else if (!isok(cc.x, cc.y)) {
|
||||
You("cannot jump there!");
|
||||
return 0;
|
||||
if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) {
|
||||
return 0;
|
||||
} else {
|
||||
coord uc;
|
||||
int range, temp;
|
||||
|
||||
@@ -510,12 +510,14 @@ enter_explore_mode(VOID_ARGS)
|
||||
You("are already in explore mode.");
|
||||
} else {
|
||||
#ifdef SYSCF
|
||||
# if defined(UNIX)
|
||||
if (!sysopt.explorers ||
|
||||
!sysopt.explorers[0] ||
|
||||
!check_user_string(sysopt.explorers)) {
|
||||
You("cannot access explore mode.");
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
pline(
|
||||
"Beware! From explore mode there will be no return to normal game.");
|
||||
|
||||
@@ -14,9 +14,6 @@ WIZARDS=*
|
||||
# Uses the same syntax as the WIZARDS option above.
|
||||
#SHELLERS=
|
||||
|
||||
# Users allowed to use #exploremode. Same syntax as WIZARDS above.
|
||||
EXPLORERS=*
|
||||
|
||||
# Show debugging information originating from these source files.
|
||||
# Use '*' for all, or list source files separated by spaces.
|
||||
# Only available if game has been compiled with DEBUG.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 winmenu.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 winmenu.c $NHDT-Date: 1427881480 2015/04/01 09:44:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */
|
||||
/* NetHack 3.5 winmenu.c $Date: 2009/05/06 10:55:53 $ $Revision: 1.5 $ */
|
||||
/* SCCS Id: @(#)winmenu.c 3.5 1996/08/15 */
|
||||
/* Copyright (c) Dean Luick, 1992 */
|
||||
@@ -206,6 +206,7 @@ menu_key(w, event, params, num_params)
|
||||
struct xwindow *wp;
|
||||
char ch;
|
||||
int count;
|
||||
boolean selected_something;
|
||||
|
||||
wp = find_widget(w);
|
||||
menu_info = wp->menu_information;
|
||||
@@ -218,6 +219,13 @@ menu_key(w, event, params, num_params)
|
||||
}
|
||||
|
||||
if (menu_info->is_active) { /* waiting for input */
|
||||
/* first check for an explicit selector match, so that it won't be
|
||||
overridden if it happens to duplicate a mapped menu command (':'
|
||||
to look inside a container vs ':' to select via search string) */
|
||||
for (curr = menu_info->curr_menu.base; curr; curr = curr->next)
|
||||
if (curr->identifier.a_void != 0 && curr->selector == ch)
|
||||
goto make_selection;
|
||||
|
||||
ch = map_menu_cmd(ch);
|
||||
if (ch == '\033') { /* quit */
|
||||
if (menu_info->counting) {
|
||||
@@ -294,7 +302,8 @@ menu_key(w, event, params, num_params)
|
||||
X11_nhbell();
|
||||
return;
|
||||
} else {
|
||||
boolean selected_something = FALSE;
|
||||
make_selection:
|
||||
selected_something = FALSE;
|
||||
for (count = 0, curr = menu_info->curr_menu.base; curr;
|
||||
curr = curr->next, count++)
|
||||
if (curr->identifier.a_void != 0 && curr->selector == ch) break;
|
||||
|
||||
Reference in New Issue
Block a user