Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource
This commit is contained in:
+2
-1
@@ -901,6 +901,7 @@ lichen corpse is an acid indicator
|
||||
camera may contain a picture-painting demon
|
||||
some monsters can eat through iron bars
|
||||
inaccessible niches occasionally have iron bars in front
|
||||
sinks may teleport or polymorph
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
@@ -1150,7 +1151,7 @@ tty,win32gui,win32tty: add menucolors
|
||||
NetHack Community Patches (or Variation) Included
|
||||
-------------------------------------------------
|
||||
Roderick Schertler's pickup_thrown patch
|
||||
Malcolm Ryan's Statue Glyphs patch
|
||||
adopt/adapt/extend Malcolm Ryan's Statue Glyphs patch to work for tty and tiles
|
||||
adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray
|
||||
paranoid_confirm:Confirm when requiring "yes" instead of y to confirm,
|
||||
also require explicit "no" to reject
|
||||
|
||||
+2
-1
@@ -39,6 +39,7 @@ E void FDECL(m_unleash, (struct monst *,BOOLEAN_P));
|
||||
E void NDECL(unleash_all);
|
||||
E boolean NDECL(next_to_u);
|
||||
E struct obj *FDECL(get_mleash, (struct monst *));
|
||||
E const char *NDECL(beautiful);
|
||||
E void FDECL(check_leash, (XCHAR_P,XCHAR_P));
|
||||
E boolean FDECL(um_dist, (XCHAR_P,XCHAR_P,XCHAR_P));
|
||||
E boolean FDECL(snuff_candle, (struct obj *));
|
||||
@@ -752,7 +753,7 @@ E void NDECL(really_close);
|
||||
#ifdef DEBUG
|
||||
E boolean FDECL(showdebug, (const char *));
|
||||
#endif
|
||||
E void FDECL(read_tribute, (const char *,const char *,int));
|
||||
E boolean FDECL(read_tribute, (const char *,const char *,int));
|
||||
|
||||
/* ### fountain.c ### */
|
||||
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
#define EXT_ENCUMBER 4 /* Overtaxed */
|
||||
#define OVERLOADED 5 /* Overloaded */
|
||||
|
||||
/* hunger states - see hu_stat in eat.c */
|
||||
#define SATIATED 0
|
||||
#define NOT_HUNGRY 1
|
||||
#define HUNGRY 2
|
||||
#define WEAK 3
|
||||
#define FAINTING 4
|
||||
#define FAINTED 5
|
||||
#define STARVED 6
|
||||
|
||||
/* Macros for how a rumor was delivered in outrumor() */
|
||||
#define BY_ORACLE 0
|
||||
#define BY_COOKIE 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 patchlevel.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 patchlevel.h $NHDT-Date: 1429513493 2015/04/20 07:04:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.102 $ */
|
||||
/* NetHack 3.5 patchlevel.h $Date: 2012/04/14 08:31:03 $ $Revision: 1.93 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -14,7 +14,7 @@
|
||||
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
||||
* and save files.
|
||||
*/
|
||||
#define EDITLEVEL 61
|
||||
#define EDITLEVEL 63
|
||||
|
||||
#define COPYRIGHT_BANNER_A \
|
||||
"NetHack, Copyright 1985-2015"
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 you.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 you.h $NHDT-Date: 1429513494 2015/04/20 07:04:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */
|
||||
/* NetHack 3.5 you.h $Date: 2012/04/14 08:31:03 $ $Revision: 1.13 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -39,12 +39,13 @@ struct u_have {
|
||||
struct u_event {
|
||||
Bitfield(minor_oracle,1); /* received at least 1 cheap oracle */
|
||||
Bitfield(major_oracle,1); /* " expensive oracle */
|
||||
Bitfield(read_tribute,1); /* read a passage from a novel */
|
||||
Bitfield(qcalled,1); /* called by Quest leader to do task */
|
||||
Bitfield(qexpelled,1); /* expelled from the Quest dungeon */
|
||||
Bitfield(qcompleted,1); /* successfully completed Quest task */
|
||||
Bitfield(uheard_tune,2); /* 1=know about, 2=heard passtune */
|
||||
Bitfield(uopened_dbridge,1); /* opened the drawbridge */
|
||||
|
||||
Bitfield(uopened_dbridge,1); /* opened the drawbridge */
|
||||
Bitfield(invoked,1); /* invoked Gate to the Sanctum level */
|
||||
Bitfield(gehennom_entered,1); /* entered Gehennom via Valley */
|
||||
Bitfield(uhand_of_elbereth,2); /* became Hand of Elbereth */
|
||||
@@ -67,7 +68,7 @@ struct u_achieve {
|
||||
};
|
||||
|
||||
struct u_realtime {
|
||||
time_t realtime; /* actual playing time up until the last restore */
|
||||
long realtime; /* actual playing time up until the last restore, seconds */
|
||||
time_t restored; /* time the game was started or restored */
|
||||
time_t endtime;
|
||||
};
|
||||
|
||||
+1
-1
@@ -537,7 +537,7 @@ newgame()
|
||||
#endif
|
||||
program_state.something_worth_saving++; /* useful data now exists */
|
||||
|
||||
urealtime.realtime = (time_t)0L;
|
||||
urealtime.realtime = 0L;
|
||||
#if defined(BSD) && !defined(POSIX_TYPES)
|
||||
(void) time((long *)&urealtime.restored);
|
||||
#else
|
||||
|
||||
+9
-2
@@ -703,6 +703,14 @@ register xchar x, y;
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
beautiful()
|
||||
{
|
||||
return (ACURR(A_CHA) > 14) ?
|
||||
(poly_gender() == 1 ? "beautiful" : "handsome") : "ugly";
|
||||
}
|
||||
|
||||
|
||||
#define WEAK 3 /* from eat.c */
|
||||
|
||||
static const char look_str[] = "look %s.";
|
||||
@@ -720,8 +728,7 @@ struct obj *obj;
|
||||
if(!getdir((char *)0)) return 0;
|
||||
invis_mirror = Invis;
|
||||
useeit = !Blind && (!invis_mirror || See_invisible);
|
||||
uvisage = (ACURR(A_CHA) > 14) ?
|
||||
(poly_gender() == 1 ? "beautiful" : "handsome") : "ugly";
|
||||
uvisage = beautiful();
|
||||
mirror = simpleonames(obj); /* "mirror" or "looking glass" */
|
||||
if(obj->cursed && !rn2(2)) {
|
||||
if (!Blind)
|
||||
|
||||
@@ -372,15 +372,6 @@ boolean inc_or_dec;
|
||||
if (moves > 0 && (i == A_STR || i == A_CON)) (void)encumber_msg();
|
||||
}
|
||||
|
||||
/* hunger values - from eat.c */
|
||||
#define SATIATED 0
|
||||
#define NOT_HUNGRY 1
|
||||
#define HUNGRY 2
|
||||
#define WEAK 3
|
||||
#define FAINTING 4
|
||||
#define FAINTED 5
|
||||
#define STARVED 6
|
||||
|
||||
STATIC_OVL void
|
||||
exerper()
|
||||
{
|
||||
|
||||
+14
-8
@@ -564,15 +564,17 @@ feel_location(x, y)
|
||||
if (lev->typ != ROOM && lev->seenv) {
|
||||
map_background(x, y, 1);
|
||||
} else {
|
||||
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) :
|
||||
cmap_to_glyph(S_stone);
|
||||
lev->glyph = flags.dark_room ? cmap_to_glyph(S_darkroom) :
|
||||
(lev->waslit ? cmap_to_glyph(S_room) :
|
||||
cmap_to_glyph(S_stone));
|
||||
show_glyph(x,y,lev->glyph);
|
||||
}
|
||||
} else if ((lev->glyph >= cmap_to_glyph(S_stone) &&
|
||||
lev->glyph < cmap_to_glyph(S_room)) ||
|
||||
lev->glyph < cmap_to_glyph(S_darkroom)) ||
|
||||
glyph_is_invisible(levl[x][y].glyph)) {
|
||||
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) :
|
||||
cmap_to_glyph(S_stone);
|
||||
lev->glyph = flags.dark_room ? cmap_to_glyph(S_darkroom) :
|
||||
(lev->waslit ? cmap_to_glyph(S_room) :
|
||||
cmap_to_glyph(S_stone));
|
||||
show_glyph(x,y,lev->glyph);
|
||||
}
|
||||
} else {
|
||||
@@ -583,6 +585,9 @@ feel_location(x, y)
|
||||
if (lev->typ == CORR &&
|
||||
lev->glyph == cmap_to_glyph(S_litcorr) && !lev->waslit)
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
|
||||
else if (lev->typ == ROOM && flags.dark_room &&
|
||||
lev->glyph == cmap_to_glyph(S_room))
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_darkroom));
|
||||
}
|
||||
} else {
|
||||
_map_location(x, y, 1);
|
||||
@@ -610,9 +615,9 @@ feel_location(x, y)
|
||||
}
|
||||
|
||||
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
|
||||
if (lev->typ == ROOM &&
|
||||
lev->glyph == cmap_to_glyph(S_room) && !lev->waslit)
|
||||
show_glyph(x,y, lev->glyph = cmap_to_glyph(S_stone));
|
||||
if (lev->typ == ROOM && lev->glyph == cmap_to_glyph(S_room) &&
|
||||
(!lev->waslit || flags.dark_room))
|
||||
show_glyph(x,y, lev->glyph = cmap_to_glyph(flags.dark_room ? S_darkroom : S_stone));
|
||||
else if (lev->typ == CORR &&
|
||||
lev->glyph == cmap_to_glyph(S_litcorr) && !lev->waslit)
|
||||
show_glyph(x,y, lev->glyph = cmap_to_glyph(S_corr));
|
||||
@@ -900,6 +905,7 @@ tmp_at(x, y)
|
||||
break;
|
||||
|
||||
default: /* do it */
|
||||
if (!isok(x,y)) break;
|
||||
if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
|
||||
if (tglyph->style != DISP_ALL && !cansee(x,y)) break;
|
||||
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lev.h"
|
||||
|
||||
STATIC_DCL void FDECL(trycall, (struct obj *));
|
||||
STATIC_DCL void NDECL(polymorph_sink);
|
||||
STATIC_DCL boolean NDECL(teleport_sink);
|
||||
STATIC_DCL void FDECL(dosinkring, (struct obj *));
|
||||
|
||||
STATIC_PTR int FDECL(drop, (struct obj *));
|
||||
@@ -260,6 +262,72 @@ register struct obj *obj;
|
||||
docall(obj);
|
||||
}
|
||||
|
||||
/** Transforms the sink at the player's position into
|
||||
* a fountain, throne, altar or grave. */
|
||||
STATIC_DCL
|
||||
void
|
||||
polymorph_sink()
|
||||
{
|
||||
if (levl[u.ux][u.uy].typ != SINK) return;
|
||||
|
||||
level.flags.nsinks--;
|
||||
levl[u.ux][u.uy].doormask = 0;
|
||||
switch(rn2(4)) {
|
||||
default:
|
||||
case 0:
|
||||
levl[u.ux][u.uy].typ = FOUNTAIN;
|
||||
level.flags.nfountains++;
|
||||
break;
|
||||
case 1:
|
||||
levl[u.ux][u.uy].typ = THRONE;
|
||||
break;
|
||||
case 2:
|
||||
levl[u.ux][u.uy].typ = ALTAR;
|
||||
levl[u.ux][u.uy].altarmask = Align2amask(rn2((int)A_LAWFUL+2) - 1);
|
||||
break;
|
||||
case 3:
|
||||
levl[u.ux][u.uy].typ = ROOM;
|
||||
make_grave(u.ux, u.uy, (char *) 0);
|
||||
break;
|
||||
}
|
||||
pline_The("sink transforms into %s!",
|
||||
(levl[u.ux][u.uy].typ == THRONE) ?
|
||||
"a throne" : an(surface(u.ux, u.uy)));
|
||||
newsym(u.ux,u.uy);
|
||||
}
|
||||
|
||||
/** Teleports the sink at the player's position.
|
||||
* @return TRUE if sink teleported */
|
||||
STATIC_DCL
|
||||
boolean
|
||||
teleport_sink()
|
||||
{
|
||||
int cx, cy;
|
||||
int cnt = 0;
|
||||
struct trap *trp;
|
||||
struct engr *eng;
|
||||
do {
|
||||
cx = rnd(COLNO-1);
|
||||
cy = rn2(ROWNO);
|
||||
trp = t_at(cx,cy);
|
||||
eng = engr_at(cx,cy);
|
||||
} while (((levl[cx][cy].typ != ROOM) || (trp) || (eng) ||
|
||||
cansee(cx,cy)) && (cnt++ < 200));
|
||||
if ((levl[cx][cy].typ == ROOM) && !trp && !eng) {
|
||||
/* create sink at new position */
|
||||
levl[cx][cy].typ = SINK;
|
||||
levl[cx][cy].looted = levl[u.ux][u.uy].looted;
|
||||
newsym(cx,cy);
|
||||
/* remove old sink */
|
||||
levl[u.ux][u.uy].typ = ROOM;
|
||||
levl[u.ux][u.uy].looted = 0;
|
||||
newsym(u.ux,u.uy);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
STATIC_OVL
|
||||
void
|
||||
dosinkring(obj) /* obj is a ring being dropped over a kitchen sink */
|
||||
@@ -267,6 +335,7 @@ register struct obj *obj;
|
||||
{
|
||||
register struct obj *otmp,*otmp2;
|
||||
register boolean ideed = TRUE;
|
||||
boolean nosink = FALSE;
|
||||
|
||||
You("drop %s down the drain.", doname(obj));
|
||||
obj->in_use = TRUE; /* block free identification via interrupt */
|
||||
@@ -289,8 +358,9 @@ giveback:
|
||||
You("smell rotten %s.", makeplural(fruitname(FALSE)));
|
||||
break;
|
||||
case RIN_AGGRAVATE_MONSTER:
|
||||
pline("Several flies buzz angrily around the sink.");
|
||||
break;
|
||||
pline("Several %s buzz angrily around the sink.",
|
||||
Hallucination ? makeplural(rndmonnam(NULL)) : "flies");
|
||||
break;
|
||||
case RIN_SHOCK_RESISTANCE:
|
||||
pline("Static electricity surrounds the sink.");
|
||||
break;
|
||||
@@ -355,7 +425,8 @@ giveback:
|
||||
You_see("the ring slide right down the drain!");
|
||||
break;
|
||||
case RIN_SEE_INVISIBLE:
|
||||
You_see("some air in the sink.");
|
||||
You_see("some %s in the sink.",
|
||||
Hallucination ? "oxygen molecules" : "air");
|
||||
break;
|
||||
case RIN_STEALTH:
|
||||
pline_The("sink seems to blend into the floor for a moment.");
|
||||
@@ -377,13 +448,15 @@ giveback:
|
||||
pline_The("sink glows %s for a moment.", hcolor(NH_WHITE));
|
||||
break;
|
||||
case RIN_TELEPORTATION:
|
||||
pline_The("sink momentarily vanishes.");
|
||||
nosink = teleport_sink();
|
||||
pline_The("sink %svanishes.", nosink ? "" : "momentarily ");
|
||||
break;
|
||||
case RIN_TELEPORT_CONTROL:
|
||||
pline_The("sink looks like it is being beamed aboard somewhere.");
|
||||
break;
|
||||
case RIN_POLYMORPH:
|
||||
pline_The("sink momentarily looks like a fountain.");
|
||||
polymorph_sink();
|
||||
nosink = TRUE;
|
||||
break;
|
||||
case RIN_POLYMORPH_CONTROL:
|
||||
pline_The("sink momentarily looks like a regularly erupting geyser.");
|
||||
@@ -392,9 +465,9 @@ giveback:
|
||||
}
|
||||
if(ideed)
|
||||
trycall(obj);
|
||||
else
|
||||
else if (!nosink)
|
||||
You_hear("the ring bouncing down the drainpipe.");
|
||||
if (!rn2(20)) {
|
||||
if (!rn2(20) && !nosink) {
|
||||
pline_The("sink backs up, leaving %s.", doname(obj));
|
||||
obj->in_use = FALSE;
|
||||
dropx(obj);
|
||||
|
||||
+1
-4
@@ -421,10 +421,7 @@ do_mname()
|
||||
mtmp = u.usteed;
|
||||
else {
|
||||
pline("This %s creature is called %s and cannot be renamed.",
|
||||
ACURR(A_CHA) > 14 ?
|
||||
(flags.female ? "beautiful" : "handsome") :
|
||||
"ugly",
|
||||
plname);
|
||||
beautiful(), plname);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
|
||||
@@ -40,15 +40,6 @@ STATIC_DCL boolean FDECL(maybe_cannibal, (int,BOOLEAN_P));
|
||||
|
||||
char msgbuf[BUFSZ];
|
||||
|
||||
/* hunger texts used on bottom line (each 8 chars long) */
|
||||
#define SATIATED 0
|
||||
#define NOT_HUNGRY 1
|
||||
#define HUNGRY 2
|
||||
#define WEAK 3
|
||||
#define FAINTING 4
|
||||
#define FAINTED 5
|
||||
#define STARVED 6
|
||||
|
||||
/* also used to see if you're allowed to eat cats and dogs */
|
||||
#define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC))
|
||||
|
||||
@@ -76,6 +67,7 @@ STATIC_OVL NEARDATA const char allobj[] = {
|
||||
|
||||
STATIC_OVL boolean force_save_hs = FALSE;
|
||||
|
||||
/* see hunger states in hack.h - texts used on bottom line */
|
||||
const char *hu_stat[] = {
|
||||
"Satiated",
|
||||
" ",
|
||||
|
||||
@@ -916,7 +916,7 @@ die:
|
||||
topten figure it out separately and possibly getting different
|
||||
time or even day if player is slow responding to --More-- */
|
||||
endtime = getnow();
|
||||
urealtime.realtime += (endtime - urealtime.restored);
|
||||
urealtime.realtime += (long)(endtime - urealtime.restored);
|
||||
|
||||
/* Sometimes you die on the first move. Life's not fair.
|
||||
* On those rare occasions you get hosed immediately, go out
|
||||
|
||||
+14
-11
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1427337311 2015/03/26 02:35:11 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.141 $ */
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1428972596 2015/04/14 00:49:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */
|
||||
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -3331,13 +3331,17 @@ const char *filename;
|
||||
|
||||
/* ---------- BEGIN TRIBUTE ----------- */
|
||||
|
||||
/* 3.6 tribute code */
|
||||
/* 3.6 tribute code
|
||||
*
|
||||
* Returns TRUE if you were able to read something.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SECTIONSCOPE 1
|
||||
#define TITLESCOPE 2
|
||||
#define PASSAGESCOPE 3
|
||||
|
||||
void
|
||||
boolean
|
||||
read_tribute(tribsection, tribtitle, tribpassage)
|
||||
const char *tribsection, *tribtitle;
|
||||
int tribpassage;
|
||||
@@ -3346,19 +3350,18 @@ int tribpassage;
|
||||
char *endp;
|
||||
char line[BUFSZ];
|
||||
|
||||
int scopes[4] = {0, SECTIONSCOPE, TITLESCOPE, PASSAGESCOPE};
|
||||
int scope = 0, section = 0, passage = 0, book = 0;
|
||||
int linect = 0, passagecnt = 0, targetpassage = 0, textcnt = 0;
|
||||
char *sectionnm = "", *booknm = "";
|
||||
int scope = 0;
|
||||
int linect = 0, passagecnt = 0, targetpassage = 0;
|
||||
const char *badtranslation = "an incomprehensible foreign translation";
|
||||
boolean matchedsection = FALSE, matchedtitle = FALSE;
|
||||
winid tribwin = WIN_ERR;
|
||||
boolean grasped = FALSE;
|
||||
|
||||
/* check for mandatories */
|
||||
if (!tribsection || !tribtitle) {
|
||||
pline("It's %s of \"%s\"!",
|
||||
badtranslation, tribtitle);
|
||||
return;
|
||||
return grasped;
|
||||
}
|
||||
|
||||
debugpline3("read_tribute %s, %s, %d.", tribsection, tribtitle, tribpassage);
|
||||
@@ -3367,7 +3370,7 @@ int tribpassage;
|
||||
if (!fp) {
|
||||
/* this is actually an error - cannot open tribute file! */
|
||||
pline("You feel too overwhelmed to continue!");
|
||||
return;
|
||||
return grasped;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3467,13 +3470,13 @@ cleanup:
|
||||
display_nhwindow(tribwin, FALSE);
|
||||
destroy_nhwindow(tribwin);
|
||||
tribwin = WIN_ERR;
|
||||
u.uconduct.literate++;
|
||||
grasped = TRUE;
|
||||
} else {
|
||||
pline("It seems to be %s of \"%s\"!",
|
||||
badtranslation, tribtitle);
|
||||
}
|
||||
|
||||
return;
|
||||
return grasped;
|
||||
}
|
||||
/* ---------- END TRIBUTE ----------- */
|
||||
|
||||
|
||||
+49
-31
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 hack.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 hack.c $NHDT-Date: 1429412557 2015/04/19 03:02:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.143 $ */
|
||||
/* NetHack 3.5 hack.c $Date: 2013/10/26 21:33:47 $ $Revision: 1.120 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1336,49 +1336,67 @@ domove()
|
||||
if (context.forcefight ||
|
||||
/* remembered an 'I' && didn't use a move command */
|
||||
(glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
|
||||
struct obj *boulder = sobj_at(BOULDER, x, y);
|
||||
struct obj *boulder = 0;
|
||||
boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
|
||||
solid = !accessible(x, y);
|
||||
int glyph = glyph_at(x, y); /* might be monster */
|
||||
char buf[BUFSZ];
|
||||
|
||||
/* if a statue is displayed at the target location,
|
||||
player is attempting to attack it [and boulder
|
||||
handlng below is suitable for handling that] */
|
||||
if (glyph_is_statue(glyph) ||
|
||||
(Hallucination && glyph_is_monster(glyph)))
|
||||
boulder = sobj_at(STATUE, x, y);
|
||||
if (!Underwater) {
|
||||
boulder = sobj_at(BOULDER, x, y);
|
||||
/* if a statue is displayed at the target location,
|
||||
player is attempting to attack it [and boulder
|
||||
handlng below is suitable for handling that] */
|
||||
if (glyph_is_statue(glyph) ||
|
||||
(Hallucination && glyph_is_monster(glyph)))
|
||||
boulder = sobj_at(STATUE, x, y);
|
||||
|
||||
/* force fight at boulder/statue or wall/door while wielding
|
||||
pick: start digging to break the boulder or wall */
|
||||
if (context.forcefight &&
|
||||
/* can we dig? */
|
||||
uwep && dig_typ(uwep, x, y) &&
|
||||
/* should we dig? */
|
||||
!glyph_is_invisible(glyph) &&
|
||||
!glyph_is_monster(glyph)) {
|
||||
(void)use_pick_axe2(uwep);
|
||||
return;
|
||||
}
|
||||
/* force fight at boulder/statue or wall/door while wielding
|
||||
pick: start digging to break the boulder or wall */
|
||||
if (context.forcefight &&
|
||||
/* can we dig? */
|
||||
uwep && dig_typ(uwep, x, y) &&
|
||||
/* should we dig? */
|
||||
!glyph_is_invisible(glyph) &&
|
||||
!glyph_is_monster(glyph)) {
|
||||
(void)use_pick_axe2(uwep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* about to become known empty -- remove 'I' if present */
|
||||
unmap_object(x, y);
|
||||
if (boulder) map_object(boulder, TRUE);
|
||||
newsym(x, y);
|
||||
glyph = glyph_at(x, y); /* might have just changed */
|
||||
|
||||
if (boulder)
|
||||
Strcpy(buf, ansimpleoname(boulder));
|
||||
else if (Underwater && !is_pool(x, y))
|
||||
/* Underwater, targetting non-water; the map just shows blank
|
||||
because you don't see remembered terrain while underwater;
|
||||
although the hero can attack an adjacent monster this way,
|
||||
assume he can't reach out far enough to distinguish terrain */
|
||||
Sprintf(buf, (Is_waterlevel(&u.uz) && levl[x][y].typ == AIR) ?
|
||||
"an air bubble" : "nothing");
|
||||
else if (solid)
|
||||
Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
|
||||
else if (!Underwater)
|
||||
Strcpy(buf, "thin air");
|
||||
else if (is_pool(x, y))
|
||||
Strcpy(buf, "empty water");
|
||||
else /* Underwater, targetting non-water */
|
||||
Sprintf(buf, "a vacant spot on the %s", surface(x,y));
|
||||
/* glyph might indicate unseen terrain if hero is blind;
|
||||
unlike searching, this won't reveal what that terrain is
|
||||
(except for solid rock, where the glyph would otherwise
|
||||
yield ludicrous "dark part of a room") */
|
||||
Strcpy(buf, (levl[x][y].typ == STONE) ? "solid rock" :
|
||||
glyph_is_cmap(glyph) ?
|
||||
the(defsyms[glyph_to_cmap(glyph)].explanation) :
|
||||
(const char *)"an unknown obstacle");
|
||||
/* note: 'solid' is misleadingly named and catches pools
|
||||
of water and lava as well as rock and walls */
|
||||
else
|
||||
Strcpy(buf, "thin air");
|
||||
You("%s%s %s.",
|
||||
!(boulder || solid) ? "" :
|
||||
!explo ? "harmlessly " : "futilely ",
|
||||
!(boulder || solid) ? "" : !explo ? "harmlessly " : "futilely ",
|
||||
explo ? "explode at" : "attack",
|
||||
buf);
|
||||
unmap_object(x, y); /* known empty -- remove 'I' if present */
|
||||
if (boulder) map_object(boulder, TRUE);
|
||||
newsym(x, y);
|
||||
|
||||
nomul(0);
|
||||
if (explo) {
|
||||
wake_nearby();
|
||||
|
||||
+8
-1
@@ -783,6 +783,7 @@ time_t date;
|
||||
Sprintf(datestr, "%04ld%02d%02d%02d%02d%02d",
|
||||
datenum, lt->tm_mon + 1, lt->tm_mday,
|
||||
lt->tm_hour, lt->tm_min, lt->tm_sec);
|
||||
debugpline1("yyyymmddhhmmss() produced date string %s", datestr);
|
||||
return(datestr);
|
||||
}
|
||||
|
||||
@@ -791,6 +792,7 @@ time_from_yyyymmddhhmmss(buf)
|
||||
char *buf;
|
||||
{
|
||||
int k;
|
||||
time_t timeresult = (time_t)0;
|
||||
struct tm t, *lt;
|
||||
char *g, *p, y[5],mo[3],md[3],h[3],mi[3],s[3];
|
||||
if (buf && strlen(buf) == 14) {
|
||||
@@ -828,8 +830,13 @@ char *buf;
|
||||
t.tm_hour = atoi(h);
|
||||
t.tm_min = atoi(mi);
|
||||
t.tm_sec = atoi(s);
|
||||
return mktime(&t);
|
||||
timeresult = mktime(&t);
|
||||
}
|
||||
if ((int)timeresult == -1)
|
||||
debugpline1("time_from_yyyymmddhhmmss(%s) would have returned -1",
|
||||
buf ? buf : "");
|
||||
else
|
||||
return timeresult;
|
||||
}
|
||||
return (time_t)0;
|
||||
}
|
||||
|
||||
@@ -2540,6 +2540,7 @@ mergable(otmp, obj) /* returns TRUE if obj & otmp can be merged */
|
||||
register struct obj *otmp, *obj;
|
||||
{
|
||||
int objnamelth = 0, otmpnamelth = 0;
|
||||
if (obj == otmp) return FALSE; /* already the same object */
|
||||
if (obj->otyp != otmp->otyp) return FALSE;
|
||||
/* coins of the same kind will always merge */
|
||||
if (obj->oclass == COIN_CLASS) return TRUE;
|
||||
|
||||
+5
-1
@@ -692,6 +692,8 @@ doclose() /* try to close a door */
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (!isok(x,y)) goto nodoor;
|
||||
|
||||
if ((mtmp = m_at(x,y)) &&
|
||||
mtmp->m_ap_type == M_AP_FURNITURE &&
|
||||
(mtmp->mappearance == S_hcdoor ||
|
||||
@@ -723,8 +725,10 @@ doclose() /* try to close a door */
|
||||
pline_The("drawbridge is already closed.");
|
||||
else if (portcullis || door->typ == DRAWBRIDGE_DOWN)
|
||||
There("is no obvious way to close the drawbridge.");
|
||||
else
|
||||
else {
|
||||
nodoor:
|
||||
You("%s no door there.", Blind ? "feel" : "see");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -440,7 +440,7 @@ struct obj *obj; /* missile (or stack providing it) */
|
||||
tmp_at(bhitpos.x, bhitpos.y);
|
||||
delay_output();
|
||||
}
|
||||
tmp_at(bhitpos.x, bhitpos.y);
|
||||
if (isok(bhitpos.x, bhitpos.y)) tmp_at(bhitpos.x, bhitpos.y);
|
||||
delay_output();
|
||||
tmp_at(DISP_END, 0);
|
||||
|
||||
|
||||
+1
-1
@@ -453,7 +453,7 @@ struct obj *instr;
|
||||
if (do_spec && instr->spe > 0) {
|
||||
consume_obj_charge(instr, TRUE);
|
||||
|
||||
You("produce soft music.");
|
||||
You("produce %s music.", Hallucination ? "piped" : "soft");
|
||||
put_monsters_to_sleep(u.ulevel * 5);
|
||||
exercise(A_DEX, TRUE);
|
||||
break;
|
||||
|
||||
+1
-1
@@ -829,7 +829,7 @@ SPELL("freeze sphere", "hardcover", P_MATTER_SPELL, 20, 2, 1, 1, NODIR, CLR
|
||||
SPELL("blank paper", "plain", P_NONE, 18, 0, 0, 0, 0, HI_PAPER),
|
||||
/* tribute book for 3.6 */
|
||||
OBJECT(OBJ("novel", "paperback"), BITS(0,0,1,0,0,0,0,1,0,0,0,P_NONE,HI_PAPER), 0,
|
||||
SPBOOK_CLASS, 0, 0, 0, 1, 0, 0, 0, 1, 20, CLR_BRIGHT_BLUE),
|
||||
SPBOOK_CLASS, 0, 0, 0, 20, 0, 0, 0, 1, 20, CLR_BRIGHT_BLUE),
|
||||
/* a special, one of a kind, spellbook */
|
||||
OBJECT(OBJ("Book of the Dead", "papyrus"), BITS(0,0,1,0,1,0,1,1,0,0,0,P_NONE,PAPER), 0,
|
||||
SPBOOK_CLASS, 0, 0,20, 10000, 0, 0, 0, 7, 20, HI_PAPER),
|
||||
|
||||
+37
-1
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 objnam.c $NHDT-Date: 1426470349 2015/03/16 01:45:49 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.108 $ */
|
||||
/* NetHack 3.5 objnam.c $NHDT-Date: 1429413519 2015/04/19 03:18:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.128 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define NUMOBUF 12
|
||||
|
||||
STATIC_DCL char *FDECL(strprepend,(char *,const char *));
|
||||
STATIC_DCL short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P));
|
||||
STATIC_DCL boolean FDECL(wishymatch, (const char *,const char *,BOOLEAN_P));
|
||||
STATIC_DCL char *NDECL(nextobuf);
|
||||
STATIC_DCL void FDECL(releaseobuf, (char *));
|
||||
@@ -566,6 +567,10 @@ struct obj *obj;
|
||||
!objects[otyp].oc_uses_known;
|
||||
bareobj.quan = 1L; /* don't want plural */
|
||||
bareobj.corpsenm = NON_PM; /* suppress statue and figurine details */
|
||||
/* but suppressing fruit details leads to "bad fruit #0"
|
||||
[perhaps we should force "slime mold" rather than use xname?] */
|
||||
if (obj->otyp == SLIME_MOLD) bareobj.spe = obj->spe;
|
||||
|
||||
bufp = distant_name(&bareobj, xname); /* xname(&bareobj) */
|
||||
if (!strncmp(bufp, "uncursed ", 9)) bufp += 9; /* Role_if(PM_PRIEST) */
|
||||
|
||||
@@ -2277,6 +2282,27 @@ struct alt_spellings {
|
||||
{ (const char *)0, 0 },
|
||||
};
|
||||
|
||||
short
|
||||
rnd_otyp_by_wpnskill(skill)
|
||||
schar skill;
|
||||
{
|
||||
int i,n = 0;
|
||||
short otyp;
|
||||
for (i = bases[WEAPON_CLASS]; i < NUM_OBJECTS && objects[i].oc_class == WEAPON_CLASS; i++)
|
||||
if (objects[i].oc_skill == skill) {
|
||||
n++;
|
||||
otyp = i;
|
||||
}
|
||||
if (n > 0) {
|
||||
n = rn2(n);
|
||||
for (i = bases[WEAPON_CLASS]; i < NUM_OBJECTS && objects[i].oc_class == WEAPON_CLASS; i++)
|
||||
if (objects[i].oc_skill == skill)
|
||||
if (--n < 0) return i;
|
||||
}
|
||||
return STRANGE_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return something wished for. Specifying a null pointer for
|
||||
* the user request string results in a random object. Otherwise,
|
||||
@@ -3024,6 +3050,16 @@ wiztrap:
|
||||
}
|
||||
}
|
||||
|
||||
if (!oclass && !typ) {
|
||||
if (!strncmpi(bp, "polearm", 7)) {
|
||||
typ = rnd_otyp_by_wpnskill(P_POLEARMS);
|
||||
goto typfnd;
|
||||
} else if (!strncmpi(bp, "hammer", 6)) {
|
||||
typ = rnd_otyp_by_wpnskill(P_HAMMER);
|
||||
goto typfnd;
|
||||
}
|
||||
}
|
||||
|
||||
if(!oclass) return((struct obj *)0);
|
||||
any:
|
||||
if(!oclass) oclass = wrpsym[rn2((int)sizeof(wrpsym))];
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 pager.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 pager.c $NHDT-Date: 1429408230 2015/04/19 01:50:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
|
||||
/* NetHack 3.5 pager.c $Date: 2012/01/15 09:27:06 $ $Revision: 1.41 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
+4
-4
@@ -708,7 +708,7 @@ menu_item **pick_list; /* return list of items picked */
|
||||
int how; /* type of query */
|
||||
boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
{
|
||||
int i, n;
|
||||
int i, n, actualn;
|
||||
winid win;
|
||||
struct obj *curr, *last, fake_hero_object;
|
||||
struct obj **oarray;
|
||||
@@ -727,7 +727,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
last = curr;
|
||||
n++;
|
||||
}
|
||||
|
||||
actualn = n;
|
||||
if (engulfer) {
|
||||
++n;
|
||||
/* don't autoselect swallowed hero if it's the only choice */
|
||||
@@ -744,7 +744,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
return 1;
|
||||
}
|
||||
|
||||
oarray = objarr_init(n);
|
||||
oarray = objarr_init(actualn);
|
||||
/* Add objects to the array */
|
||||
i = 0;
|
||||
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
||||
@@ -767,7 +767,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
pack = flags.inv_order;
|
||||
do {
|
||||
printed_type_name = FALSE;
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < actualn; i++) {
|
||||
curr = oarray[i];
|
||||
if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE &&
|
||||
will_feel_cockatrice(curr, FALSE)) {
|
||||
|
||||
+1
-1
@@ -300,7 +300,7 @@ newman()
|
||||
enmax = rounddiv((long)enmax * (long)rn1(4, 8), 10);
|
||||
for (i = 0; (u.ulevel = i) < newlvl; i++) enmax += newpw();
|
||||
if (enmax < u.ulevel) enmax = u.ulevel;
|
||||
u.uen = rounddiv((long)u.uen * (long)enmax, u.uenmax);
|
||||
u.uen = rounddiv((long)u.uen * (long)enmax, ((u.uenmax < 1) ? 1 : u.uenmax));
|
||||
u.uenmax = enmax;
|
||||
/* [should alignment record be tweaked too?] */
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 potion.c $NHDT-Date: 1426953330 2015/03/21 15:55:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
|
||||
/* NetHack 3.5 potion.c $NHDT-Date: 1428972597 2015/04/14 00:49:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
|
||||
/* NetHack 3.5 potion.c $Date: 2013/11/05 00:57:55 $ $Revision: 1.91 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1820,7 +1820,7 @@ dodip()
|
||||
}
|
||||
|
||||
if(potion->otyp == POT_ACID && obj->otyp == CORPSE &&
|
||||
obj->corpsenm == PM_LICHEN & !Blind) {
|
||||
obj->corpsenm == PM_LICHEN && !Blind) {
|
||||
pline("%s %s %s around the edges.", The(cxname(obj)),
|
||||
otense(obj, "turn"), potion->odiluted ?
|
||||
hcolor(NH_ORANGE) : hcolor(NH_RED));
|
||||
|
||||
-10
@@ -149,16 +149,6 @@ in_trouble()
|
||||
struct obj *otmp;
|
||||
int i, j, count=0;
|
||||
|
||||
/* Borrowed from eat.c */
|
||||
|
||||
#define SATIATED 0
|
||||
#define NOT_HUNGRY 1
|
||||
#define HUNGRY 2
|
||||
#define WEAK 3
|
||||
#define FAINTING 4
|
||||
#define FAINTED 5
|
||||
#define STARVED 6
|
||||
|
||||
/*
|
||||
* major troubles
|
||||
*/
|
||||
|
||||
+1
-1
@@ -568,7 +568,7 @@ unsigned int *stuckid, *steedid;
|
||||
foo = time_from_yyyymmddhhmmss(timebuf);
|
||||
|
||||
ReadTimebuf(ubirthday);
|
||||
ReadTimebuf(urealtime.realtime);
|
||||
mread(fd, &urealtime.realtime, sizeof(urealtime.realtime));
|
||||
ReadTimebuf(urealtime.restored);
|
||||
#if defined(BSD) && !defined(POSIX_TYPES)
|
||||
(void) time((long *)&urealtime.restored);
|
||||
|
||||
+2
-2
@@ -307,10 +307,10 @@ register int fd, mode;
|
||||
#ifdef SYSFLAGS
|
||||
bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag));
|
||||
#endif
|
||||
urealtime.realtime += (getnow() - urealtime.restored);
|
||||
urealtime.realtime += (long)(getnow() - urealtime.restored);
|
||||
bwrite(fd, (genericptr_t) &u, sizeof(struct you));
|
||||
bwrite(fd, yyyymmddhhmmss(ubirthday), 14);
|
||||
bwrite(fd, yyyymmddhhmmss(urealtime.realtime), 14);
|
||||
bwrite(fd, (genericptr_t) &urealtime.realtime, sizeof(urealtime.realtime));
|
||||
bwrite(fd, yyyymmddhhmmss(urealtime.restored), 14);
|
||||
save_killers(fd, mode);
|
||||
|
||||
|
||||
@@ -67,9 +67,14 @@ dosit()
|
||||
register struct obj *obj;
|
||||
|
||||
obj = level.objects[u.ux][u.uy];
|
||||
You("sit on %s.", the(xname(obj)));
|
||||
if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
|
||||
pline("It's not very comfortable...");
|
||||
if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
|
||||
You("coil up around your %shoard.",
|
||||
(obj->quan + money_cnt(invent) < u.ulevel*1000) ? "meager " : "");
|
||||
} else {
|
||||
You("sit on %s.", the(xname(obj)));
|
||||
if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
|
||||
pline("It's not very comfortable...");
|
||||
}
|
||||
} else if (trap != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) {
|
||||
if (u.utrap) {
|
||||
exercise(A_WIS, FALSE); /* you're getting stuck longer */
|
||||
|
||||
@@ -1001,6 +1001,9 @@ dochat()
|
||||
}
|
||||
|
||||
tx = u.ux+u.dx; ty = u.uy+u.dy;
|
||||
|
||||
if (!isok(tx,ty)) return (0);
|
||||
|
||||
mtmp = m_at(tx, ty);
|
||||
|
||||
if ((!mtmp || mtmp->mundetected) &&
|
||||
|
||||
+12
-4
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 spell.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 spell.c $NHDT-Date: 1429513494 2015/04/20 07:04:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.57 $ */
|
||||
/* NetHack 3.5 spell.c $Date: 2011/12/29 22:01:25 $ $Revision: 1.44 $ */
|
||||
/* Copyright (c) M. Stephenson 1988 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -452,10 +452,18 @@ register struct obj *spellbook;
|
||||
|
||||
/* 3.6.0 tribute */
|
||||
if (booktype == SPE_NOVEL) {
|
||||
/* Obtain current Terry Pratchett book
|
||||
title for the current game. */
|
||||
/* Obtain current Terry Pratchett book title */
|
||||
const char *tribtitle = noveltitle(&spellbook->novelidx);
|
||||
read_tribute("books", tribtitle, 0);
|
||||
if (read_tribute("books", tribtitle, 0)) {
|
||||
u.uconduct.literate++;
|
||||
check_unpaid(spellbook);
|
||||
if (!u.uevent.read_tribute) {
|
||||
/* give bonus of 20 xp and 4*20+0 pts */
|
||||
more_experienced(20, 0);
|
||||
newexplevel();
|
||||
u.uevent.read_tribute = 1; /* only once */
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3470,7 +3470,7 @@ drown()
|
||||
}
|
||||
u.uinwater = 1;
|
||||
You("drown.");
|
||||
for (;;) {
|
||||
for (i = 0; i < 5; i++) { /* arbitrary number of loops */
|
||||
/* killer format and name are reconstructed every iteration
|
||||
because lifesaving resets them */
|
||||
pool_of_water = waterbody_name(u.ux, u.uy);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428590280 2015/04/09 14:38:00 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.0 $ */
|
||||
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428970913 2015/04/14 00:21:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
|
||||
/* Copyright (c) Sean Hunt 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
#include <hack.h>
|
||||
#include "hack.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@@ -50,7 +50,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *regex_init() {
|
||||
return malloc (sizeof (struct nhregex));
|
||||
return (struct nhregex *)alloc(sizeof (struct nhregex));
|
||||
}
|
||||
|
||||
boolean regex_compile(const char *s, struct nhregex *re) {
|
||||
@@ -65,7 +65,7 @@ const char *regex_error_desc(struct nhregex *re) {
|
||||
static char buf[BUFSZ];
|
||||
|
||||
if (!re || !re->err)
|
||||
return NULL;
|
||||
return (const char *)0;
|
||||
|
||||
/* FIXME: Using a static buffer here is not ideal, but avoids memory
|
||||
* leaks. Consider the allocation more carefully. */
|
||||
@@ -75,11 +75,12 @@ const char *regex_error_desc(struct nhregex *re) {
|
||||
}
|
||||
|
||||
boolean regex_match(const char *s, struct nhregex *re) {
|
||||
int result;
|
||||
|
||||
if (!re)
|
||||
return FALSE;
|
||||
|
||||
int result;
|
||||
if ((result = regexec(&re->re, s, 0, NULL, 0))) {
|
||||
if ((result = regexec(&re->re, s, 0, (genericptr_t)0, 0))) {
|
||||
if (result != REG_NOMATCH)
|
||||
re->err = result;
|
||||
return FALSE;
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
/* +-------------------------------------------------------------------+ */
|
||||
|
||||
/*
|
||||
* $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
|
||||
* $NHDT-Date: 1429464661 2015/04/19 17:31:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.2 $
|
||||
* $Date: 2002/01/05 21:06:02 $ $Revision: 1.1 $
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ static void FDECL(ReadTileStrip, (FILE *fd, int len));
|
||||
|
||||
/* These should be in gif.h, but there isn't one. */
|
||||
boolean FDECL(fopen_gif_file, (const char *, const char *));
|
||||
boolean FDECL(read_gif_tile, (pixel(*)[]));
|
||||
boolean FDECL(read_gif_tile, (pixel(*)[TILE_X]));
|
||||
int NDECL(fclose_gif_file);
|
||||
|
||||
static int
|
||||
|
||||
+6264
-6252
File diff suppressed because it is too large
Load Diff
+7040
-7028
File diff suppressed because it is too large
Load Diff
+2800
-2788
File diff suppressed because it is too large
Load Diff
+34
-15
@@ -1,6 +1,4 @@
|
||||
/* NetHack 3.5 tile2bmp.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 tile2bmp.c $Date: 2009/05/06 10:59:00 $ $Revision: 1.6 $ */
|
||||
/* SCCS Id: @(#)tile2bmp.c 3.5 2002/03/14 */
|
||||
/* Copyright (c) NetHack PC Development Team 1995 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -8,6 +6,7 @@
|
||||
* Edit History:
|
||||
*
|
||||
* Initial Creation M.Allison 1994/01/11
|
||||
* 256 colour bmp and statue support M.Allison 2015/04/19
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -19,27 +18,29 @@
|
||||
#include "win32api.h"
|
||||
#endif
|
||||
|
||||
/* #define COLORS_IN_USE MAXCOLORMAPSIZE /* 256 colors */
|
||||
#if (TILE_X==32)
|
||||
#define COLORS_IN_USE 256
|
||||
#else
|
||||
#define COLORS_IN_USE 16 /* 16 colors */
|
||||
/*#define COLORS_IN_USE 16 */ /* 16 colors */
|
||||
#define COLORS_IN_USE 256 /* 256 colors */
|
||||
#endif
|
||||
|
||||
#define BITCOUNT 8
|
||||
|
||||
extern char *FDECL(tilename, (int, int));
|
||||
|
||||
#define MAGICTILENO (340 + 440 + 231 + 340)
|
||||
|
||||
#if BITCOUNT==4
|
||||
#define MAX_X 320 /* 2 per byte, 4 bits per pixel */
|
||||
#define MAX_Y 480
|
||||
#else
|
||||
# if (TILE_X==32)
|
||||
#define MAX_X (32 * 40)
|
||||
#define MAX_Y 960
|
||||
#define MAX_Y ((MAGICTILENO * 32) / 40) * 2
|
||||
# else
|
||||
#define MAX_X 640 /* 1 per byte, 8 bits per pixel */
|
||||
#define MAX_Y 480
|
||||
#define MAX_X (16 * 40)
|
||||
#define MAX_Y ((MAGICTILENO * 16) / 40) * 2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -119,7 +120,8 @@ struct tagBMP{
|
||||
#if (TILE_X==32)
|
||||
#define RGBQUAD_COUNT 256
|
||||
#else
|
||||
#define RGBQUAD_COUNT 16
|
||||
/*#define RGBQUAD_COUNT 16 */
|
||||
#define RGBQUAD_COUNT 256
|
||||
#endif
|
||||
RGBQUAD bmaColors[RGBQUAD_COUNT];
|
||||
#endif
|
||||
@@ -146,11 +148,11 @@ char *tilefiles[] = {
|
||||
#if (TILE_X == 32)
|
||||
"../win/share/mon32.txt",
|
||||
"../win/share/obj32.txt",
|
||||
"../win/share/oth32.txt"
|
||||
"../win/share/oth32.txt",
|
||||
#else
|
||||
"../win/share/monsters.txt",
|
||||
"../win/share/objects.txt",
|
||||
"../win/share/other.txt"
|
||||
"../win/share/other.txt",
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -160,6 +162,7 @@ int max_tiles_in_row = 40;
|
||||
int tiles_in_row;
|
||||
int filenum;
|
||||
int initflag;
|
||||
int pass;
|
||||
int yoffset,xoffset;
|
||||
char bmpname[128];
|
||||
FILE *fp;
|
||||
@@ -190,12 +193,14 @@ char *argv[];
|
||||
xoffset = yoffset = 0;
|
||||
initflag = 0;
|
||||
filenum = 0;
|
||||
pass = 0;
|
||||
fp = fopen(bmpname,"wb");
|
||||
if (!fp) {
|
||||
printf("Error creating tile file %s, aborting.\n",bmpname);
|
||||
exit(1);
|
||||
}
|
||||
while (filenum < (sizeof(tilefiles) / sizeof(char *))) {
|
||||
while (pass < 4) {
|
||||
filenum =pass % (sizeof(tilefiles) / sizeof(char *));
|
||||
if (!fopen_text_file(tilefiles[filenum], RDTMODE)) {
|
||||
Fprintf(stderr,
|
||||
"usage: tile2bmp (from the util directory)\n");
|
||||
@@ -235,7 +240,7 @@ char *argv[];
|
||||
}
|
||||
}
|
||||
(void) fclose_text_file();
|
||||
++filenum;
|
||||
++pass;
|
||||
}
|
||||
fwrite(&bmp, sizeof(bmp), 1, fp);
|
||||
fclose(fp);
|
||||
@@ -303,18 +308,23 @@ BITMAPINFOHEADER *pbmih;
|
||||
#endif
|
||||
|
||||
#if (TILE_X==16)
|
||||
pbmih->biSizeImage = lelong(0);
|
||||
/* pbmih->biSizeImage = lelong(0); */
|
||||
pbmih->biSizeImage = lelong(((w * cClrBits +31) & ~31) /8 * h);
|
||||
#else
|
||||
pbmih->biSizeImage = lelong(((w * cClrBits +31) & ~31) /8 * h);
|
||||
#endif
|
||||
pbmih->biClrImportant = (DWORD)0;
|
||||
}
|
||||
|
||||
static int graymappings[] = {
|
||||
/* . A B C D E F G H I J K L M N O P */
|
||||
0, 1,17,18,19,20,27,22,23,24,25,26,21,15,13,14,14};
|
||||
|
||||
static void
|
||||
build_bmptile(pixels)
|
||||
pixel (*pixels)[TILE_X];
|
||||
{
|
||||
int cur_x, cur_y, cur_color;
|
||||
int cur_x, cur_y, cur_color, apply_color;
|
||||
int x,y;
|
||||
|
||||
for (cur_y = 0; cur_y < TILE_Y; cur_y++) {
|
||||
@@ -328,6 +338,15 @@ pixel (*pixels)[TILE_X];
|
||||
if (cur_color >= num_colors)
|
||||
Fprintf(stderr, "color not in colormap!\n");
|
||||
y = (MAX_Y - 1) - (cur_y + yoffset);
|
||||
apply_color = cur_color;
|
||||
if (pass == 3) {
|
||||
/* map to shades of gray */
|
||||
if (cur_color > (SIZE(graymappings)-1))
|
||||
Fprintf(stderr, "Gray mapping issue %d %d.\n",
|
||||
cur_color, SIZE(graymappings)-1);
|
||||
else
|
||||
apply_color = graymappings[cur_color];
|
||||
}
|
||||
#if BITCOUNT==4
|
||||
x = (cur_x / 2) + xoffset;
|
||||
bmp.packtile[y][x] = cur_x%2 ?
|
||||
@@ -335,7 +354,7 @@ pixel (*pixels)[TILE_X];
|
||||
(uchar)(cur_color<<4);
|
||||
#else
|
||||
x = cur_x + xoffset;
|
||||
bmp.packtile[y][x] = (uchar)cur_color;
|
||||
bmp.packtile[y][x] = (uchar)apply_color;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+20
-9
@@ -1,5 +1,4 @@
|
||||
/* NetHack 3.5 tilemap.c $NHDT-Date: 1425082379 2015/02/28 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */
|
||||
/* NetHack 3.5 tilemap.c $Date: 2009/05/06 10:59:02 $ $Revision: 1.7 $ */
|
||||
/* NetHack 3.5 tilemap.c $NHDT-Date: 1429464668 2015/04/19 17:31:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
|
||||
/* SCCS Id: @(#)tilemap.c 3.5 2000/06/04 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -238,7 +237,7 @@ int set, entry;
|
||||
#endif
|
||||
|
||||
short tilemap[MAX_GLYPH];
|
||||
int lastmontile, lastobjtile, lastothtile;
|
||||
int lastmontile, lastobjtile, lastothtile, laststatuetile;
|
||||
|
||||
/* Number of tiles for invisible monsters */
|
||||
#define NUM_INVIS_TILES 1
|
||||
@@ -357,13 +356,25 @@ init_tilemap()
|
||||
tilenum++;
|
||||
}
|
||||
|
||||
/* statue patch: statues still use the same glyph as in vanilla */
|
||||
|
||||
for ( i = 0; i < NUMMONS; i++) {
|
||||
tilemap[GLYPH_STATUE_OFF+i] = tilemap[GLYPH_OBJ_OFF+STATUE];
|
||||
}
|
||||
|
||||
lastothtile = tilenum - 1;
|
||||
|
||||
/* skip over the substitutes to get to the grayscale statues */
|
||||
for (i = 0; i < SIZE(substitutes); i++) {
|
||||
tilenum += substitutes[i].last_glyph - substitutes[i].first_glyph + 1;
|
||||
}
|
||||
|
||||
/* statue patch: statues look more like the monster */
|
||||
condnum = 0; /* doing monsters again, so reset */
|
||||
for (i = 0; i < NUMMONS; i++) {
|
||||
tilemap[GLYPH_STATUE_OFF+i] = tilenum;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == MON_GLYPH &&
|
||||
conditionals[condnum].predecessor == i) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
}
|
||||
}
|
||||
laststatuetile = tilenum - 1;
|
||||
}
|
||||
|
||||
const char *prolog[] = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 tiletext.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 tiletext.c $NHDT-Date: 1429484196 2015/04/19 22:56:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */
|
||||
/* NetHack 3.5 tiletext.c $Date: 2009/05/06 10:59:03 $ $Revision: 1.4 $ */
|
||||
/* SCCS Id: @(#)tiletext.c 3.5 1999/10/24 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -33,7 +33,7 @@ static void FDECL(write_txttile, (FILE *, pixel(*)[TILE_X]));
|
||||
|
||||
/* Ugh. DICE doesn't like %[A-Z], so we have to spell it out... */
|
||||
#define FORMAT_STRING \
|
||||
"%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789] = (%d, %d, %d) "
|
||||
"%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.] = (%d, %d, %d) "
|
||||
|
||||
static void
|
||||
read_text_colormap(txtfile)
|
||||
|
||||
Reference in New Issue
Block a user