Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-10-25 17:53:31 -04:00
18 changed files with 1295 additions and 479 deletions

View File

@@ -1248,6 +1248,16 @@ static struct fieldid_t {
static const char threshold_value[] = "hilite_status threshold ",
is_out_of_range[] = " is out of range";
const char *
bl_idx_to_fldname(idx)
int idx;
{
if (idx >= 0 && idx < MAXBLSTATS)
return initblstats[idx].fldname;
return (const char *) 0;
}
/* field name to bottom line index */
STATIC_OVL enum statusfields
fldname_to_bl_indx(name)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1525056598 2018/04/30 02:49:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1540502147 2018/10/25 21:15:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.94 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -512,6 +512,7 @@ warning_of(mon)
struct monst *mon;
{
int wl = 0, tmp = 0;
if (mon_warning(mon)) {
tmp = (int) (mon->m_lev / 4); /* match display.h */
wl = (tmp > WARNCOUNT - 1) ? WARNCOUNT - 1 : tmp;
@@ -755,38 +756,36 @@ register int x, y;
/* normal region shown only on accessible positions, but poison clouds
* also shown above lava, pools and moats.
*/
if (reg != NULL && (ACCESSIBLE(lev->typ)
|| (reg->glyph == cmap_to_glyph(S_poisoncloud)
&& (lev->typ == LAVAPOOL || lev->typ == POOL
|| lev->typ == MOAT)))) {
if (reg && (ACCESSIBLE(lev->typ)
|| (reg->glyph == cmap_to_glyph(S_poisoncloud)
&& is_pool_or_lava(x, y)))) {
show_region(reg, x, y);
return;
}
if (x == u.ux && y == u.uy) {
if (canspotself()) {
_map_location(x, y, 0); /* map *under* self */
int see_self = canspotself();
/* update map information for <u.ux,u.uy> (remembered topology
and object/known trap/terrain glyph) but only display it if
hero can't see him/herself, then show self if appropriate */
_map_location(x, y, !see_self);
if (see_self)
display_self();
} else
/* we can see what is there */
_map_location(x, y, 1);
} else {
mon = m_at(x, y);
worm_tail = is_worm_tail(mon);
see_it =
mon && (worm_tail ? (!mon->minvis || See_invisible)
: (mon_visible(mon)) || tp_sensemon(mon)
|| MATCH_WARN_OF_MON(mon));
see_it = mon && (mon_visible(mon)
|| (!worm_tail && (tp_sensemon(mon)
|| MATCH_WARN_OF_MON(mon))));
if (mon && (see_it || (!worm_tail && Detect_monsters))) {
if (mon->mtrapped) {
struct trap *trap = t_at(x, y);
int tt = trap ? trap->ttyp : NO_TRAP;
/* if monster is in a physical trap, you see the trap too
*/
if (tt == BEAR_TRAP || is_pit(tt)
|| tt == WEB) {
trap->tseen = TRUE;
}
/* if monster is in a physical trap, you see trap too */
if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB)
trap->tseen = 1;
}
_map_location(x, y, 0); /* map under the monster */
/* also gets rid of any invisibility glyph */
@@ -795,7 +794,7 @@ register int x, y;
worm_tail);
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon);
} else if (glyph_is_invisible(levl[x][y].glyph)) {
} else if (glyph_is_invisible(lev->glyph)) {
map_invisible(x, y);
} else
_map_location(x, y, 1); /* map the location */\
@@ -808,19 +807,17 @@ register int x, y;
if (canspotself())
display_self();
} else if ((mon = m_at(x, y))
} else if ((mon = m_at(x, y)) != 0
&& ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
|| (see_with_infrared(mon)
&& mon_visible(mon))))
&& mon_visible(mon)))) != 0
|| Detect_monsters)) {
/* Monsters are printed every time. */
/* This also gets rid of any invisibility glyph */
/* Seen or sensed monsters are printed every time.
This also gets rid of any invisibility glyph. */
display_monster(x, y, mon, see_it ? 0 : DETECTED,
is_worm_tail(mon) ? TRUE : FALSE);
} else if ((mon = m_at(x, y)) && mon_warning(mon)
&& !is_worm_tail(mon)) {
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon);
}
/*
* If the location is remembered as being both dark (waslit is false)
@@ -828,7 +825,6 @@ register int x, y;
*
* (1) A dark location that the hero could see through night
* vision.
*
* (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read.
*
@@ -844,7 +840,7 @@ register int x, y;
* These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight.
*/
else if (Is_rogue_level(&u.uz)) {
} else if (Is_rogue_level(&u.uz)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM
@@ -852,8 +848,7 @@ register int x, y;
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
else
goto show_mem;
}
else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
} else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)

View File

@@ -354,12 +354,14 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
context.travel = context.travel1 = context.mv = context.run = 0;
context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
context.travel = context.travel1 = context.mv = context.run = 0;
context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE;
} else
return FALSE;
@@ -423,7 +425,7 @@ register struct monst *mtmp;
(void) hitum(mtmp, youmonst.data->mattk);
mtmp->mstrategy &= ~STRAT_WAITMASK;
atk_done:
atk_done:
/* see comment in attack_checks() */
/* we only need to check for this if we did an attack_checks()
* and it returned 0 (it's okay to attack), and the monster didn't
@@ -807,7 +809,8 @@ int dieroll;
silvermsg = TRUE;
silverobj = TRUE;
}
if (artifact_light(obj) && obj->lamplit && mon_hates_light(mon))
if (artifact_light(obj) && obj->lamplit
&& mon_hates_light(mon))
lightobj = TRUE;
if (u.usteed && !thrown && tmp > 0
&& weapon_type(obj) == P_LANCE && mon != u.ustuck) {
@@ -1550,6 +1553,7 @@ register struct attack *mattk;
register struct permonst *pd = mdef->data;
int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
boolean negated;
struct obj *mongold;
armpro = magic_negation(mdef);
/* since hero can't be cancelled, only defender's armor applies */
@@ -1689,18 +1693,16 @@ register struct attack *mattk;
case AD_SGLD:
/* This you as a leprechaun, so steal
real gold only, no lesser coins */
{
struct obj *mongold = findgold(mdef->minvent);
if (mongold) {
obj_extract_self(mongold);
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
addinv(mongold);
Your("purse feels heavier.");
} else {
You("grab %s's gold, but find no room in your knapsack.",
mon_nam(mdef));
dropy(mongold);
}
mongold = findgold(mdef->minvent);
if (mongold) {
obj_extract_self(mongold);
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
addinv(mongold);
Your("purse feels heavier.");
} else {
You("grab %s's gold, but find no room in your knapsack.",
mon_nam(mdef));
dropy(mongold);
}
}
exercise(A_DEX, TRUE);
@@ -1711,8 +1713,9 @@ register struct attack *mattk;
tmp = 1;
if (!negated && tmp < mdef->mhp) {
char nambuf[BUFSZ];
boolean u_saw_mon =
canseemon(mdef) || (u.uswallow && u.ustuck == mdef);
boolean u_saw_mon = (canseemon(mdef)
|| (u.uswallow && u.ustuck == mdef));
/* record the name before losing sight of monster */
Strcpy(nambuf, Monnam(mdef));
if (u_teleport_mon(mdef, FALSE) && u_saw_mon
@@ -1794,9 +1797,9 @@ register struct attack *mattk;
case AD_DRCO:
if (!negated && !rn2(8)) {
Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk));
if (resists_poison(mdef))
if (resists_poison(mdef)) {
pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
else {
} else {
if (!rn2(10)) {
Your("poison was deadly...");
tmp = mdef->mhp;
@@ -1941,12 +1944,11 @@ explum(mdef, mattk)
register struct monst *mdef;
register struct attack *mattk;
{
boolean resistance; /* only for cold/fire/elec */
register int tmp = d((int) mattk->damn, (int) mattk->damd);
You("explode!");
switch (mattk->adtyp) {
boolean resistance; /* only for cold/fire/elec */
case AD_BLND:
if (!resists_blnd(mdef)) {
pline("%s is blinded by your flash of light!", Monnam(mdef));

View File

@@ -64,7 +64,8 @@ STATIC_DCL void FDECL(dump_clear_nhwindow, (winid));
STATIC_DCL void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid));
STATIC_DCL void FDECL(dump_start_menu, (winid));
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, const char *, BOOLEAN_P));
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, BOOLEAN_P));
STATIC_DCL void FDECL(dump_end_menu, (winid, const char *));
STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *));
@@ -145,14 +146,22 @@ static struct winlink *chain = 0;
static struct winlink *
wl_new()
{
return calloc(1, sizeof(struct winlink));
struct winlink *wl = (struct winlink *) alloc(sizeof *wl);
wl->nextlink = 0;
wl->wincp = 0;
wl->linkdata = 0;
return wl;
}
static void
wl_addhead(struct winlink *wl)
{
wl->nextlink = chain;
chain = wl;
}
static void
wl_addtail(struct winlink *wl)
{
@@ -255,24 +264,28 @@ const char *s;
if (!winchoices[0].procs) {
raw_printf("No window types?");
exit(EXIT_FAILURE);
nh_terminate(EXIT_FAILURE);
}
if (!winchoices[1].procs) {
config_error_add("Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name);
config_error_add(
"Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name);
} else {
char buf[BUFSZ];
boolean first = TRUE;
buf[0] = '\0';
for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0])
continue;
if ('-' == winchoices[i].procs->name[0])
continue;
Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name);
Sprintf(eos(buf), "%s%s",
first ? "" : ", ", winchoices[i].procs->name);
first = FALSE;
}
config_error_add("Window type %s not recognized. Choices are: %s", s, buf);
config_error_add("Window type %s not recognized. Choices are: %s",
s, buf);
}
if (windowprocs.win_raw_print == def_raw_print)
@@ -291,6 +304,7 @@ const char *s;
continue;
if (!strcmpi(s, winchoices[i].procs->name)) {
struct winlink *p = wl_new();
p->wincp = &winchoices[i];
wl_addtail(p);
/* NB: The ini_routine() will be called during commit. */
@@ -307,7 +321,7 @@ const char *s;
raw_printf(" %s", winchoices[i].procs->name);
}
exit(EXIT_FAILURE);
nh_terminate(EXIT_FAILURE);
}
void
@@ -494,7 +508,8 @@ static short FDECL(hup_set_font_name, (winid, char *));
#endif
static char *NDECL(hup_get_color_string);
#endif /* CHANGE_COLOR */
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, unsigned long *));
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int,
unsigned long *));
static int NDECL(hup_int_ndecl);
static void NDECL(hup_void_ndecl);