Merge branch 'master' into win32-x64-working

Conflicts:
	src/display.c
This commit is contained in:
nhmall
2015-06-16 05:59:07 -04:00
14 changed files with 364 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1434025166 2015/06/11 12:19:26 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.68 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1434447701 2015/06/16 09:41:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1434071495 2015/06/12 01:11:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.6 end.c $NHDT-Date: 1434408399 2015/06/15 22:46:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.100 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -979,8 +979,10 @@ die:
force_launch_placement();
/* maintain ugrave_arise even for !bones_ok */
if (how == BURNING || how == DISSOLVED) /* corpse gets burnt up too */
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
if (how == PANICKED)
u.ugrave_arise = (NON_PM - 3); /* no corpse, no grave */
else if (how == BURNING || how == DISSOLVED) /* corpse burns up too */
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
else if (how == STONING)
u.ugrave_arise = (NON_PM - 1); /* statue instead of corpse */
else if (how == TURNED_SLIME)
@@ -1097,16 +1099,12 @@ die:
if (have_windows) {
wait_synch();
display_nhwindow(WIN_MESSAGE, TRUE);
destroy_nhwindow(WIN_MAP);
destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR;
#ifndef STATUS_VIA_WINDOWPORT
destroy_nhwindow(WIN_STATUS);
#endif
destroy_nhwindow(WIN_MESSAGE);
#ifdef STATUS_VIA_WINDOWPORT
WIN_MESSAGE = WIN_MAP = WIN_ERR;
#else
WIN_MESSAGE = WIN_STATUS = WIN_MAP = WIN_ERR;
destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR;
#endif
destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR;
if (!done_stopprint || flags.tombstone)
endwin = create_nhwindow(NHW_TEXT);
@@ -1115,9 +1113,9 @@ die:
} else
done_stopprint = 1; /* just avoid any more output */
if (u.uhave.amulet)
if (u.uhave.amulet) {
Strcat(killer.name, " (with the Amulet)");
else if (how == ESCAPED) {
} else if (how == ESCAPED) {
if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */
Strcat(killer.name, " (in celestial disgrace)");
else if (carrying(FAKE_AMULET_OF_YENDOR))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1434249087 2015/06/14 02:31:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.179 $ */
/* NetHack 3.6 files.c $NHDT-Date: 1434425313 2015/06/16 03:28:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.182 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3392,9 +3392,10 @@ boolean wildcards;
#define PASSAGESCOPE 3
boolean
read_tribute(tribsection, tribtitle, tribpassage)
read_tribute(tribsection, tribtitle, tribpassage, nowin_buf, bufsz)
const char *tribsection, *tribtitle;
int tribpassage;
int tribpassage, bufsz;
char *nowin_buf;
{
dlb *fp;
char *endp;
@@ -3406,10 +3407,12 @@ int tribpassage;
boolean matchedsection = FALSE, matchedtitle = FALSE;
winid tribwin = WIN_ERR;
boolean grasped = FALSE;
boolean foundpassage = FALSE;
/* check for mandatories */
if (!tribsection || !tribtitle) {
pline("It's %s of \"%s\"!", badtranslation, tribtitle);
if (!nowin_buf)
pline("It's %s of \"%s\"!", badtranslation, tribtitle);
return grasped;
}
@@ -3419,7 +3422,8 @@ int tribpassage;
fp = dlb_fopen(TRIBUTEFILE, "r");
if (!fp) {
/* this is actually an error - cannot open tribute file! */
pline("You feel too overwhelmed to continue!");
if (!nowin_buf)
pline("You feel too overwhelmed to continue!");
return grasped;
}
@@ -3494,12 +3498,16 @@ int tribpassage;
passagenum = atoi(st);
if (passagenum && (passagenum <= passagecnt)) {
scope = PASSAGESCOPE;
if (matchedtitle && (passagenum == targetpassage))
tribwin = create_nhwindow(NHW_MENU);
if (matchedtitle && (passagenum == targetpassage)) {
if (!nowin_buf)
tribwin = create_nhwindow(NHW_MENU);
else
foundpassage = TRUE;
}
}
} else if (!strncmpi(&line[1], "e ", sizeof("e ") - 1)) {
if (matchedtitle && (scope == PASSAGESCOPE)
&& tribwin != WIN_ERR)
&& ((!nowin_buf && tribwin != WIN_ERR) || (nowin_buf && foundpassage)))
goto cleanup;
if (scope == TITLESCOPE)
matchedtitle = FALSE;
@@ -3516,16 +3524,21 @@ int tribpassage;
/* comment only, next! */
break;
default:
if (matchedtitle && scope == PASSAGESCOPE && tribwin != WIN_ERR) {
putstr(tribwin, 0, line);
Strcpy(lastline, line);
if (matchedtitle && scope == PASSAGESCOPE) {
if (!nowin_buf && tribwin != WIN_ERR) {
putstr(tribwin, 0, line);
Strcpy(lastline, line);
} else if (nowin_buf) {
if ((int)strlen(line) < bufsz-1)
Strcpy(nowin_buf, line);
}
}
}
}
cleanup:
(void) dlb_fclose(fp);
if (tribwin != WIN_ERR) {
if (!nowin_buf && tribwin != WIN_ERR) {
if (matchedtitle && scope == PASSAGESCOPE) {
display_nhwindow(tribwin, FALSE);
/* put the final attribution line into message history,
@@ -3540,11 +3553,22 @@ cleanup:
tribwin = WIN_ERR;
grasped = TRUE;
} else {
pline("It seems to be %s of \"%s\"!", badtranslation, tribtitle);
if (!nowin_buf)
pline("It seems to be %s of \"%s\"!", badtranslation, tribtitle);
else
if (foundpassage)
grasped = TRUE;
}
return grasped;
}
boolean
Death_quote(buf, bufsz)
char *buf;
int bufsz;
{
return read_tribute("Death", "Death Quotes", 0, buf, bufsz);
}
/* ---------- END TRIBUTE ----------- */
/*files.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1432939569 2015/05/29 22:46:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.166 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1434421348 2015/06/16 02:22:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.167 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -815,6 +815,18 @@ have_lizard()
return (FALSE);
}
/* 3.6.0 tribute */
struct obj *
u_have_novel()
{
register struct obj *otmp;
for (otmp = invent; otmp; otmp = otmp->nobj)
if (otmp->otyp == SPE_NOVEL)
return otmp;
return (struct obj *)0;
}
struct obj *
o_on(id, objchn)
unsigned int id;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sounds.c $NHDT-Date: 1432510145 2015/05/24 23:29:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* NetHack 3.6 sounds.c $NHDT-Date: 1434421352 2015/06/16 02:22:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */
@@ -906,7 +906,29 @@ register struct monst *mtmp;
: soldier_foe_msg[rn2(3)];
} break;
case MS_RIDER:
if (ptr == &mons[PM_DEATH] && !rn2(10))
/* 3.6.0 tribute */
if (ptr == &mons[PM_DEATH] &&
!context.tribute.Deathnotice && u_have_novel()) {
struct obj *book = u_have_novel();
const char *tribtitle = (char *)0;
if (book) {
int novelidx = book->novelidx;
tribtitle = noveltitle(&novelidx);
}
if (tribtitle) {
Sprintf(verbuf,
"Ah, so you have a copy of '%s'. I may have been misquoted there.",
tribtitle);
verbl_msg = verbuf;
context.tribute.Deathnotice = 1;
}
} else if (ptr == &mons[PM_DEATH] &&
!rn2(2) && Death_quote(verbuf, BUFSZ)) {
verbl_msg = verbuf;
}
/* end of tribute addition */
else if (ptr == &mons[PM_DEATH] && !rn2(10))
pline_msg = "is busy reading a copy of Sandman #8.";
else
verbl_msg = "Who do you think you are, War?";

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 spell.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* NetHack 3.6 spell.c $NHDT-Date: 1434421353 2015/06/16 02:22:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */
@@ -473,7 +473,7 @@ register struct obj *spellbook;
if (booktype == SPE_NOVEL) {
/* Obtain current Terry Pratchett book title */
const char *tribtitle = noveltitle(&spellbook->novelidx);
if (read_tribute("books", tribtitle, 0)) {
if (read_tribute("books", tribtitle, 0, (char *)0, 0)) {
u.uconduct.literate++;
check_unpaid(spellbook);
if (!u.uevent.read_tribute) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 version.c $NHDT-Date: 1434151385 2015/06/12 23:23:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $ */
/* NetHack 3.6 version.c $NHDT-Date: 1434446944 2015/06/16 09:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -130,9 +130,9 @@ doextversion()
return 0;
}
extern char regex_id[];
extern const char regex_id[];
static char *rt_opts[] = {
static const char *rt_opts[] = {
"pattern matching via", regex_id,
};
static const char indent[] = " ";
@@ -150,7 +150,7 @@ char *buf;
{
char rtbuf[BUFSZ];
char *pd;
int l, i = 0, j = 0;
int l, i = 0;
if (strlen(buf) >= BUFSZ - 3)
return;