Merge branch 'NetHack-3.6.2'
This commit is contained in:
54
src/apply.c
54
src/apply.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 apply.c $NHDT-Date: 1519598527 2018/02/25 22:42:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.243 $ */
|
||||
/* NetHack 3.6 apply.c $NHDT-Date: 1526769961 2018/05/19 22:46:01 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.246 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2865,21 +2865,41 @@ coord *pos;
|
||||
int min_range, max_range;
|
||||
{
|
||||
struct monst *mtmp;
|
||||
struct monst *selmon = (struct monst *) 0;
|
||||
coord mpos;
|
||||
boolean impaired;
|
||||
int x, y, lo_x, hi_x, lo_y, hi_y, rt, glyph;
|
||||
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
||||
if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame
|
||||
&& cansee(mtmp->mx, mtmp->my)
|
||||
&& distu(mtmp->mx, mtmp->my) <= max_range
|
||||
&& distu(mtmp->mx, mtmp->my) >= min_range) {
|
||||
if (selmon)
|
||||
return FALSE;
|
||||
selmon = mtmp;
|
||||
if (Blind)
|
||||
return FALSE; /* must be able to see target location */
|
||||
impaired = (Confusion || Stunned || Hallucination);
|
||||
mpos.x = mpos.y = 0; /* no candidate location yet */
|
||||
rt = isqrt(max_range);
|
||||
lo_x = max(u.ux - rt, 1), hi_x = min(u.ux + rt, COLNO - 1);
|
||||
lo_y = max(u.uy - rt, 0), hi_y = min(u.uy + rt, ROWNO - 1);
|
||||
for (x = lo_x; x <= hi_x; ++x) {
|
||||
for (y = lo_y; y <= hi_y; ++y) {
|
||||
if (distu(x, y) < min_range || distu(x, y) > max_range
|
||||
|| !isok(x, y) || !cansee(x, y))
|
||||
continue;
|
||||
glyph = glyph_at(x, y);
|
||||
if (!impaired
|
||||
&& glyph_is_monster(glyph)
|
||||
&& (mtmp = m_at(x, y)) != 0
|
||||
&& (mtmp->mtame || (mtmp->mpeaceful && flags.confirm)))
|
||||
continue;
|
||||
if (glyph_is_monster(glyph)
|
||||
|| glyph_is_warning(glyph)
|
||||
|| glyph_is_invisible(glyph)
|
||||
|| (glyph_is_statue(glyph) && impaired)) {
|
||||
if (mpos.x)
|
||||
return FALSE; /* more than one candidate location */
|
||||
mpos.x = x, mpos.y = y;
|
||||
}
|
||||
}
|
||||
if (!selmon)
|
||||
return FALSE;
|
||||
pos->x = selmon->mx;
|
||||
pos->y = selmon->my;
|
||||
}
|
||||
if (!mpos.x)
|
||||
return FALSE; /* no candidate location */
|
||||
*pos = mpos;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2887,8 +2907,8 @@ static int polearm_range_min = -1;
|
||||
static int polearm_range_max = -1;
|
||||
|
||||
STATIC_OVL boolean
|
||||
get_valid_polearm_position(x,y)
|
||||
int x,y;
|
||||
get_valid_polearm_position(x, y)
|
||||
int x, y;
|
||||
{
|
||||
return (isok(x, y) && ACCESSIBLE(levl[x][y].typ)
|
||||
&& distu(x, y) >= polearm_range_min
|
||||
@@ -2998,7 +3018,7 @@ struct obj *obj;
|
||||
return res;
|
||||
}
|
||||
|
||||
context.polearm.hitmon = NULL;
|
||||
context.polearm.hitmon = (struct monst *) 0;
|
||||
/* Attack the monster there */
|
||||
bhitpos = cc;
|
||||
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != (struct monst *) 0) {
|
||||
|
||||
749
src/botl.c
749
src/botl.c
File diff suppressed because it is too large
Load Diff
@@ -5354,8 +5354,10 @@ dotravel(VOID_ARGS)
|
||||
}
|
||||
|
||||
#ifdef PORT_DEBUG
|
||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||
extern void NDECL(win32con_debug_keystrokes);
|
||||
extern void NDECL(win32con_handler_info);
|
||||
#endif
|
||||
|
||||
int
|
||||
wiz_port_debug()
|
||||
@@ -5369,7 +5371,7 @@ wiz_port_debug()
|
||||
char *menutext;
|
||||
void NDECL((*fn));
|
||||
} menu_selections[] = {
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||
{ "test win32 keystrokes (tty only)", win32con_debug_keystrokes },
|
||||
{ "show keystroke handler information (tty only)",
|
||||
win32con_handler_info },
|
||||
|
||||
@@ -2651,7 +2651,7 @@ boolean tinitial, tfrom_file;
|
||||
bad_negation(fullname, FALSE);
|
||||
return FALSE;
|
||||
} else if ((op = string_for_opt(opts, negated)) != 0) {
|
||||
#if defined(WIN32CON)
|
||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||
set_altkeyhandler(op);
|
||||
#endif
|
||||
} else
|
||||
@@ -3304,7 +3304,9 @@ boolean tinitial, tfrom_file;
|
||||
op = string_for_opt(opts, 0);
|
||||
if (!op)
|
||||
return FALSE;
|
||||
#ifdef TTY_GRAPHICS
|
||||
map_subkeyvalue(op);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return retval;
|
||||
|
||||
36
src/read.c
36
src/read.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 read.c $NHDT-Date: 1515802375 2018/01/13 00:12:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.150 $ */
|
||||
/* NetHack 3.6 read.c $NHDT-Date: 1526728750 2018/05/19 11:19:10 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.155 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -19,19 +19,23 @@ static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS,
|
||||
static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 };
|
||||
|
||||
STATIC_DCL boolean FDECL(learnscrolltyp, (SHORT_P));
|
||||
STATIC_DCL char * FDECL(erode_obj_text, (struct obj *, char *));
|
||||
STATIC_DCL void NDECL(do_class_genocide);
|
||||
STATIC_DCL char *FDECL(erode_obj_text, (struct obj *, char *));
|
||||
STATIC_DCL char *FDECL(apron_text, (struct obj *, char *buf));
|
||||
STATIC_DCL void FDECL(stripspe, (struct obj *));
|
||||
STATIC_DCL void FDECL(p_glow1, (struct obj *));
|
||||
STATIC_DCL void FDECL(p_glow2, (struct obj *, const char *));
|
||||
STATIC_DCL void FDECL(randomize, (int *, int));
|
||||
STATIC_DCL void FDECL(forget_single_object, (int));
|
||||
#if 0 /* not used */
|
||||
STATIC_DCL void FDECL(forget_objclass, (int));
|
||||
#endif
|
||||
STATIC_DCL void FDECL(randomize, (int *, int));
|
||||
STATIC_DCL void FDECL(forget, (int));
|
||||
STATIC_DCL int FDECL(maybe_tame, (struct monst *, struct obj *));
|
||||
STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(display_stinking_cloud_positions, (int));
|
||||
STATIC_DCL boolean FDECL(get_valid_stinking_cloud_pos, (int, int));
|
||||
STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P));
|
||||
STATIC_PTR void FDECL(display_stinking_cloud_positions, (int));
|
||||
STATIC_PTR void FDECL(set_lit, (int, int, genericptr));
|
||||
STATIC_DCL void NDECL(do_class_genocide);
|
||||
|
||||
STATIC_OVL boolean
|
||||
learnscrolltyp(scrolltyp)
|
||||
@@ -56,7 +60,7 @@ struct obj *sobj;
|
||||
(void) learnscrolltyp(sobj->otyp);
|
||||
}
|
||||
|
||||
char *
|
||||
STATIC_OVL char *
|
||||
erode_obj_text(otmp, buf)
|
||||
struct obj *otmp;
|
||||
char *buf;
|
||||
@@ -158,7 +162,7 @@ char *buf;
|
||||
return erode_obj_text(tshirt, buf);
|
||||
}
|
||||
|
||||
char *
|
||||
STATIC_OVL char *
|
||||
apron_text(apron, buf)
|
||||
struct obj *apron;
|
||||
char *buf;
|
||||
@@ -324,6 +328,7 @@ doread()
|
||||
return 0;
|
||||
} else if (Blind && (scroll->otyp != SPE_BOOK_OF_THE_DEAD)) {
|
||||
const char *what = 0;
|
||||
|
||||
if (scroll->oclass == SPBOOK_CLASS)
|
||||
what = "mystic runes";
|
||||
else if (!scroll->dknown)
|
||||
@@ -953,7 +958,7 @@ int x,y;
|
||||
|| distu(x, y) >= 32));
|
||||
}
|
||||
|
||||
boolean
|
||||
STATIC_OVL boolean
|
||||
is_valid_stinking_cloud_pos(x, y, showmsg)
|
||||
int x, y;
|
||||
boolean showmsg;
|
||||
@@ -966,7 +971,7 @@ boolean showmsg;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
STATIC_PTR void
|
||||
display_stinking_cloud_positions(state)
|
||||
int state;
|
||||
{
|
||||
@@ -1621,7 +1626,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
pline("This is a scroll of fire!");
|
||||
dam *= 5;
|
||||
pline("Where do you want to center the explosion?");
|
||||
getpos_sethilite(display_stinking_cloud_positions, get_valid_stinking_cloud_pos);
|
||||
getpos_sethilite(display_stinking_cloud_positions,
|
||||
get_valid_stinking_cloud_pos);
|
||||
(void) getpos(&cc, TRUE, "the desired position");
|
||||
if (!is_valid_stinking_cloud_pos(cc.x, cc.y, FALSE)) {
|
||||
/* try to reach too far, get burned */
|
||||
@@ -1693,7 +1699,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
already_known ? "stinking " : "");
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
getpos_sethilite(display_stinking_cloud_positions, get_valid_stinking_cloud_pos);
|
||||
getpos_sethilite(display_stinking_cloud_positions,
|
||||
get_valid_stinking_cloud_pos);
|
||||
if (getpos(&cc, TRUE, "the desired position") < 0) {
|
||||
pline1(Never_mind);
|
||||
break;
|
||||
@@ -1707,6 +1714,11 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
default:
|
||||
impossible("What weird effect is this? (%u)", otyp);
|
||||
}
|
||||
/* if sobj is gone, we've already called useup() above and the
|
||||
update_inventory() that it performs might have come too soon
|
||||
(before charging an item, for instance) */
|
||||
if (!sobj)
|
||||
update_inventory();
|
||||
return sobj ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
STATIC_DCL void FDECL(center, (int, char *));
|
||||
|
||||
#if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) \
|
||||
|| defined(MSWIN_GRAPHICS) || defined(DUMPLOG)
|
||||
#define TEXT_TOMBSTONE
|
||||
@@ -18,6 +16,7 @@ STATIC_DCL void FDECL(center, (int, char *));
|
||||
#endif
|
||||
|
||||
#ifdef TEXT_TOMBSTONE
|
||||
STATIC_DCL void FDECL(center, (int, char *));
|
||||
|
||||
#ifndef NH320_DEDICATION
|
||||
/* A normal tombstone for end of game display. */
|
||||
|
||||
35
src/u_init.c
35
src/u_init.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 u_init.c $NHDT-Date: 1503960969 2017/08/28 22:56:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.40 $ */
|
||||
/* NetHack 3.6 u_init.c $NHDT-Date: 1526755625 2018/05/19 18:47:05 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.42 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2017. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -219,11 +219,14 @@ static struct inv_sub {
|
||||
{ PM_ORC, SMALL_SHIELD, ORCISH_SHIELD },
|
||||
{ PM_ORC, RING_MAIL, ORCISH_RING_MAIL },
|
||||
{ PM_ORC, CHAIN_MAIL, ORCISH_CHAIN_MAIL },
|
||||
{ PM_ORC, CRAM_RATION, TRIPE_RATION },
|
||||
{ PM_ORC, LEMBAS_WAFER, TRIPE_RATION },
|
||||
{ PM_DWARF, SPEAR, DWARVISH_SPEAR },
|
||||
{ PM_DWARF, SHORT_SWORD, DWARVISH_SHORT_SWORD },
|
||||
{ PM_DWARF, HELMET, DWARVISH_IRON_HELM },
|
||||
/* { PM_DWARF, SMALL_SHIELD, DWARVISH_ROUNDSHIELD }, */
|
||||
/* { PM_DWARF, PICK_AXE, DWARVISH_MATTOCK }, */
|
||||
{ PM_DWARF, LEMBAS_WAFER, CRAM_RATION },
|
||||
{ PM_GNOME, BOW, CROSSBOW },
|
||||
{ PM_GNOME, ARROW, CROSSBOW_BOLT },
|
||||
{ NON_PM, STRANGE_OBJECT, STRANGE_OBJECT }
|
||||
@@ -972,17 +975,8 @@ register struct trobj *trop;
|
||||
int otyp, i;
|
||||
|
||||
while (trop->trclass) {
|
||||
if (trop->trotyp != UNDEF_TYP) {
|
||||
otyp = (int) trop->trotyp;
|
||||
if (urace.malenum != PM_HUMAN) {
|
||||
/* substitute specific items for generic ones */
|
||||
for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
|
||||
if (inv_subs[i].race_pm == urace.malenum
|
||||
&& otyp == inv_subs[i].item_otyp) {
|
||||
otyp = inv_subs[i].subs_otyp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
otyp = (int) trop->trotyp;
|
||||
if (otyp != UNDEF_TYP) {
|
||||
obj = mksobj(otyp, TRUE, FALSE);
|
||||
} else { /* UNDEF_TYP */
|
||||
static NEARDATA short nocreate = STRANGE_OBJECT;
|
||||
@@ -1057,6 +1051,23 @@ register struct trobj *trop;
|
||||
nocreate4 = otyp;
|
||||
}
|
||||
|
||||
if (urace.malenum != PM_HUMAN) {
|
||||
/* substitute race-specific items; this used to be in
|
||||
the 'if (otyp != UNDEF_TYP) { }' block above, but then
|
||||
substitutions didn't occur for randomly generated items
|
||||
(particularly food) which have racial substitutes */
|
||||
for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
|
||||
if (inv_subs[i].race_pm == urace.malenum
|
||||
&& otyp == inv_subs[i].item_otyp) {
|
||||
debugpline3("ini_inv: substituting %s for %s%s",
|
||||
OBJ_NAME(objects[inv_subs[i].subs_otyp]),
|
||||
(trop->trotyp == UNDEF_TYP) ? "random " : "",
|
||||
OBJ_NAME(objects[otyp]));
|
||||
otyp = obj->otyp = inv_subs[i].subs_otyp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* nudist gets no armor */
|
||||
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
|
||||
dealloc_obj(obj);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 windows.c $NHDT-Date: 1495232365 2017/05/19 22:19:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */
|
||||
/* NetHack 3.6 windows.c $NHDT-Date: 1526933747 2018/05/21 20:15:47 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.48 $ */
|
||||
/* Copyright (c) D. Cohrs, 1993. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -56,6 +56,7 @@ extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *));
|
||||
#endif
|
||||
|
||||
STATIC_DCL void FDECL(def_raw_print, (const char *s));
|
||||
STATIC_DCL void NDECL(def_wait_synch);
|
||||
|
||||
#ifdef DUMPLOG
|
||||
STATIC_DCL winid FDECL(dump_create_nhwindow, (int));
|
||||
@@ -191,6 +192,22 @@ const char *s;
|
||||
puts(s);
|
||||
}
|
||||
|
||||
STATIC_OVL
|
||||
void
|
||||
def_wait_synch(VOID_ARGS)
|
||||
{
|
||||
/* Config file error handling routines
|
||||
* call wait_sync() without checking to
|
||||
* see if it actually has a value,
|
||||
* leading to spectacular violations
|
||||
* when you try to execute address zero.
|
||||
* The existence of this allows early
|
||||
* processing to have something to execute
|
||||
* even though it essentially does nothing
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WINCHAIN
|
||||
static struct win_choices *
|
||||
win_choices_find(s)
|
||||
@@ -232,6 +249,9 @@ const char *s;
|
||||
|
||||
if (!windowprocs.win_raw_print)
|
||||
windowprocs.win_raw_print = def_raw_print;
|
||||
if (!windowprocs.win_wait_synch)
|
||||
/* early config file error processing routines call this */
|
||||
windowprocs.win_wait_synch = def_wait_synch;
|
||||
|
||||
if (!winchoices[0].procs) {
|
||||
raw_printf("No window types?");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 worn.c $NHDT-Date: 1496959481 2017/06/08 22:04:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
|
||||
/* NetHack 3.6 worn.c $NHDT-Date: 1526728754 2018/05/19 11:19:14 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.51 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -105,7 +105,8 @@ long mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
update_inventory();
|
||||
if (!restoring)
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/* called e.g. when obj is destroyed */
|
||||
@@ -136,7 +137,9 @@ register struct obj *obj;
|
||||
if ((p = w_blocks(obj, wp->w_mask)) != 0)
|
||||
u.uprops[p].blocked &= ~wp->w_mask;
|
||||
}
|
||||
update_inventory();
|
||||
/* setnotworn() isn't called during restore but parallel setworn() */
|
||||
if (!restoring)
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/* return a bitmask of the equipment slot(s) a given item might be worn in */
|
||||
|
||||
Reference in New Issue
Block a user