Merge branch 'master' into nhmall-booktribute

Conflicts:
	doc/fixes35.0
	include/extern.h
	src/mkobj.c
	src/mon.c
	src/objnam.c
	win/share/objects.txt
This commit is contained in:
nhmall
2015-04-12 10:02:17 -04:00
41 changed files with 16487 additions and 15871 deletions

View File

@@ -1244,7 +1244,7 @@ char resultbuf[]; /* should be at least [7] to hold "18/100\0" */
void
enlightenment(mode, final)
int mode; /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */
int final; /* ENL_GAMEINPROGRESS:0, ENL_GAVEOVERALIVE, ENL_GAMEOVERDEAD */
int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
{
char buf[BUFSZ], tmpbuf[BUFSZ];

View File

@@ -160,7 +160,7 @@ magic_map_background(x, y, show)
if (!cansee(x,y) && !lev->waslit) {
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
if (lev->typ == ROOM && glyph == cmap_to_glyph(S_room))
glyph = cmap_to_glyph(S_stone);
glyph = cmap_to_glyph((flags.dark_room && iflags.use_color) ? (DARKROOMSYM) : S_stone);
else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
glyph = cmap_to_glyph(S_corr);
}

2600
src/do.c

File diff suppressed because it is too large Load Diff

View File

@@ -1612,7 +1612,7 @@ start_eating(otmp) /* called as you start to eat */
context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE;
if (otmp->otyp == CORPSE) {
if (otmp->otyp == CORPSE || otmp->globby) {
cprefx(context.victual.piece->corpsenm);
if (!context.victual.piece || !context.victual.eating) {
/* rider revived, or died and lifesaved */
@@ -2127,7 +2127,7 @@ struct obj *otmp;
!Stone_resistance &&
!poly_when_stoned(youmonst.data));
if (mnum == PM_GREEN_SLIME)
if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
stoneorslime = (!Unchanging && !slimeproof(youmonst.data));
if (cadaver && !nonrotting_corpse(mnum)) {
@@ -2397,7 +2397,7 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
* for normal vs. rotten food. The reqtime and nutrit values are
* then adjusted in accordance with the amount of food left.
*/
if(otmp->otyp == CORPSE) {
if(otmp->otyp == CORPSE || otmp->globby) {
int tmp = eatcorpse(otmp);
if (tmp == 2) {
/* used up */

View File

@@ -1238,7 +1238,7 @@ boolean identified, all_containers, reportempty;
{
register struct obj *box, *obj;
struct obj **oarray;
int i,j,n;
int i,n;
char *invlet;
char buf[BUFSZ];
boolean cat, deadcat;
@@ -1437,43 +1437,72 @@ num_genocides()
return n;
}
int
num_extinct()
{
int i, n = 0;
for (i = LOW_PM; i < NUMMONS; ++i)
if (!(mvitals[i].mvflags & G_GENOD) &&
(mvitals[i].mvflags & G_GONE) &&
!(mons[i].geno & G_UNIQ)) ++n;
return n;
}
STATIC_OVL void
list_genocided(defquery, ask)
char defquery;
boolean ask;
{
register int i;
int ngenocided;
int ngenocided, nextinct;
char c;
winid klwin;
char buf[BUFSZ];
ngenocided = num_genocides();
nextinct = num_extinct();
/* genocided species list */
if (ngenocided != 0) {
c = ask ? yn_function("Do you want a list of species genocided?",
ynqchars, defquery) : defquery;
/* genocided or extinct species list */
if (ngenocided != 0 || nextinct != 0) {
Sprintf(buf, "Do you want a list of %sspecies%s%s?",
(nextinct && !ngenocided) ? "extinct " : "",
(ngenocided) ? " genocided" : "",
(nextinct && ngenocided) ? " and extinct" : "");
c = ask ? yn_function(buf, ynqchars, defquery) : defquery;
if (c == 'q') done_stopprint++;
if (c == 'y') {
klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Genocided species:");
Sprintf(buf, "%s%s species:",
(ngenocided) ? "Genocided" : "Extinct",
(nextinct && ngenocided) ? " or extinct" : "");
putstr(klwin, 0, buf);
putstr(klwin, 0, "");
for (i = LOW_PM; i < NUMMONS; i++)
if (mvitals[i].mvflags & G_GENOD) {
if (mvitals[i].mvflags & G_GONE && !(mons[i].geno & G_UNIQ)) {
if ((mons[i].geno & G_UNIQ) && i != PM_HIGH_PRIEST)
Sprintf(buf, "%s%s",
!type_is_pname(&mons[i]) ? "" : "the ",
mons[i].mname);
else
Strcpy(buf, makeplural(mons[i].mname));
if (!(mvitals[i].mvflags & G_GENOD))
Strcat(buf, " (extinct)");
putstr(klwin, 0, buf);
}
putstr(klwin, 0, "");
Sprintf(buf, "%d species genocided.", ngenocided);
putstr(klwin, 0, buf);
if (ngenocided > 0) {
Sprintf(buf, "%d species genocided.", ngenocided);
putstr(klwin, 0, buf);
}
if (nextinct > 0) {
Sprintf(buf, "%d species extinct.", nextinct);
putstr(klwin, 0, buf);
}
display_nhwindow(klwin, TRUE);
destroy_nhwindow(klwin);

File diff suppressed because it is too large Load Diff

3836
src/hack.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,15 @@
/* NetHack 3.5 hacklib.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 hacklib.c $NHDT-Date: 1428806394 2015/04/12 02:39:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.5 hacklib.c $Date: 2009/05/06 10:46:32 $ $Revision: 1.23 $ */
/* SCCS Id: @(#)hacklib.c 3.5 2007/04/30 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* Copyright (c) Robert Patrick Rankin, 1991 */
/* NetHack may be freely redistributed. See license for details. */
/* We could include only config.h, except for the overlay definitions... */
#include "hack.h"
#include "hack.h" /* for config.h+extern.h */
/*=
Assorted 'small' utility routines. They're virtually independent of
NetHack, except that rounddiv may call panic().
NetHack, except that rounddiv may call panic(). setrandom calls one of
srandom(), srand48(), or srand() depending upon configuration.
return type routine name argument type(s)
boolean digit (char)
@@ -40,9 +40,12 @@ NetHack, except that rounddiv may call panic().
int dist2 (int, int, int, int)
boolean online2 (int, int)
boolean pmatch (const char *, const char *)
boolean pmatchi (const char *, const char *)
boolean pmatchz (const char *, const char *)
int strncmpi (const char *, const char *, int)
char * strstri (const char *, const char *)
boolean fuzzymatch (const char *,const char *,const char *,boolean)
boolean fuzzymatch (const char *,const char *,
const char *,boolean)
void setrandom (void)
time_t getnow (void)
int getyear (void)
@@ -62,6 +65,9 @@ NetHack, except that rounddiv may call panic().
# define Static static
#endif
static boolean FDECL(pmatch_internal, (const char *,const char *,
BOOLEAN_P,const char *));
boolean
digit(c) /* is 'c' a digit? */
char c;
@@ -465,9 +471,12 @@ online2(x0, y0, x1, y1) /* are two points lined up (on a straight line)? */
return((boolean)(!dy || !dx || (dy == dx) || (dy + dx == 0))); /* (dy == -dx) */
}
boolean
pmatch(patrn, strng) /* match a string against a pattern */
/* guts of pmatch(), pmatchi(), and pmatchz() */
static boolean
pmatch_internal(patrn, strng, ci, sk) /* match a string against a pattern */
const char *patrn, *strng;
boolean ci; /* True => case-insensitive, False => case-sensitive */
const char *sk; /* set of characters to skip */
{
char s, p;
/*
@@ -475,18 +484,53 @@ pmatch(patrn, strng) /* match a string against a pattern */
: any single character. Returns TRUE if 'strng' matches 'patrn'.
*/
pmatch_top:
s = *strng++; p = *patrn++; /* get next chars and pre-advance */
if (!sk) {
s = *strng++; p = *patrn++; /* get next chars and pre-advance */
} else {
/* fuzzy match variant of pmatch; particular characters are ignored */
do { s = *strng++; } while (index(sk, s));
do { p = *patrn++; } while (index(sk, p));
}
if (!p) /* end of pattern */
return((boolean)(s == '\0')); /* matches iff end of string too */
return (boolean)(s == '\0'); /* matches iff end of string too */
else if (p == '*') /* wildcard reached */
return((boolean)((!*patrn || pmatch(patrn, strng-1)) ? TRUE :
s ? pmatch(patrn-1, strng) : FALSE));
else if (p != s && (p != '?' || !s)) /* check single character */
return (boolean)
((!*patrn || pmatch_internal(patrn, strng-1, ci, sk)) ? TRUE :
s ? pmatch_internal(patrn-1, strng, ci, sk) : FALSE);
else if ((ci ? lowc(p) != lowc(s) : p != s) /* check single character */
&& (p != '?' || !s)) /* & single-char wildcard */
return FALSE; /* doesn't match */
else /* return pmatch(patrn, strng); */
else /* return pmatch_internal(patrn, strng, ci, sk); */
goto pmatch_top; /* optimize tail recursion */
}
/* case-sensitive wildcard match */
boolean
pmatch(patrn, strng)
const char *patrn, *strng;
{
return pmatch_internal(patrn, strng, FALSE, (const char *)0);
}
/* case-insensitive wildcard match */
boolean
pmatchi(patrn, strng)
const char *patrn, *strng;
{
return pmatch_internal(patrn, strng, TRUE, (const char *)0);
}
/* case-insensitive wildcard fuzzymatch */
boolean
pmatchz(patrn, strng)
const char *patrn, *strng;
{
/* ignore spaces, tabs (just in case), dashes, and underscores */
static const char fuzzychars[] = " \t-_";
return pmatch_internal(patrn, strng, TRUE, fuzzychars);
}
#ifndef STRNCMPI
int
strncmpi(s1, s2, n) /* case insensitive counted string comparison */
@@ -603,7 +647,7 @@ STATIC_DCL struct tm *NDECL(getlt);
void
setrandom()
{
unsigned long seed = getnow(); /* time((TIME_type) 0) */
unsigned long seed = (unsigned long)getnow(); /* time((TIME_type) 0) */
#ifdef UNIX
/* Quick dirty band-aid to prevent PRNG prediction */
seed *= getpid();

File diff suppressed because it is too large Load Diff

View File

@@ -519,7 +519,7 @@ int spellnum;
destroy_item(SCROLL_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
destroy_item(SPBOOK_CLASS, AD_FIRE);
(void) burn_floor_paper(u.ux, u.uy, TRUE, FALSE);
(void) burn_floor_objects(u.ux, u.uy, TRUE, FALSE);
break;
case CLC_LIGHTNING:
{

View File

@@ -879,7 +879,6 @@ fumaroles()
for (n = rn2(3)+2; n; n--) {
xchar x = rn1(COLNO-4,3);
xchar y = rn1(ROWNO-4,3);
struct trap *ttmp = t_at(x,y);
if (levl[x][y].typ == LAVAPOOL) {
NhRegion *r = create_gas_cloud(x,y, 4+rn2(5), rn1(10,5));
clear_heros_fault(r);

File diff suppressed because it is too large Load Diff

4658
src/mon.c

File diff suppressed because it is too large Load Diff

View File

@@ -1820,7 +1820,7 @@ struct permonst _mons2[] = {
* Puddings
*/
MON("gray ooze", S_PUDDING,
LVL(3, 1, 8, 0, 0), (G_GENO|2),
LVL(3, 1, 8, 0, 0), (G_GENO|G_NOCORPSE|2),
A(ATTK(AT_BITE, AD_RUST, 2, 8),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(500, 250, MS_SILENT, MZ_MEDIUM),
@@ -1829,7 +1829,7 @@ struct permonst _mons2[] = {
M1_MINDLESS|M1_OMNIVORE|M1_ACID,
M2_HOSTILE|M2_NEUTER, 0, CLR_GRAY),
MON("brown pudding", S_PUDDING,
LVL(5, 3, 8, 0, 0), (G_GENO|1),
LVL(5, 3, 8, 0, 0), (G_GENO|G_NOCORPSE|1),
A(ATTK(AT_BITE, AD_DCAY, 0, 0),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(500, 250, MS_SILENT, MZ_MEDIUM),
@@ -1838,7 +1838,7 @@ struct permonst _mons2[] = {
M1_MINDLESS|M1_OMNIVORE|M1_ACID,
M2_HOSTILE|M2_NEUTER, 0, CLR_BROWN),
MON("green slime", S_PUDDING,
LVL(6, 6, 6, 0, 0), (G_HELL|G_GENO|1),
LVL(6, 6, 6, 0, 0), (G_HELL|G_GENO|G_NOCORPSE|1),
A(ATTK(AT_TUCH, AD_SLIM, 1, 4), ATTK(AT_NONE, AD_SLIM, 0, 0),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(400, 150, MS_SILENT, MZ_LARGE),
@@ -1847,7 +1847,7 @@ struct permonst _mons2[] = {
M1_MINDLESS|M1_OMNIVORE|M1_ACID|M1_POIS,
M2_HOSTILE|M2_NEUTER, 0, CLR_GREEN),
MON("black pudding", S_PUDDING,
LVL(10, 6, 6, 0, 0), (G_GENO|1),
LVL(10, 6, 6, 0, 0), (G_GENO|G_NOCORPSE|1),
A(ATTK(AT_BITE, AD_CORR, 3, 8), ATTK(AT_NONE, AD_CORR, 0, 0),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(900, 250, MS_SILENT, MZ_LARGE),

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 objects.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 objects.c $Date: 2011/07/28 04:00:20 $ $Revision: 1.23 $ */
/* NetHack 3.5 objects.c $NHDT-Date: 1428802519 2015/04/12 01:35:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
/* Copyright (c) Mike Threepoint, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -374,9 +373,9 @@ ARMOR("splint mail", (char *)0,
ARMOR("banded mail", (char *)0,
1, 0, 1, 0, 72, 5, 350, 90, 4, 1, ARM_SUIT, IRON, HI_METAL),
ARMOR("dwarvish mithril-coat", (char *)0,
1, 0, 0, 0, 10, 1, 150, 240, 4, 2, ARM_SUIT, MITHRIL, HI_METAL),
1, 0, 0, 0, 10, 1, 150, 240, 4, 2, ARM_SUIT, MITHRIL, HI_SILVER),
ARMOR("elven mithril-coat", (char *)0,
1, 0, 0, 0, 15, 1, 150, 240, 5, 2, ARM_SUIT, MITHRIL, HI_METAL),
1, 0, 0, 0, 15, 1, 150, 240, 5, 2, ARM_SUIT, MITHRIL, HI_SILVER),
ARMOR("chain mail", (char *)0,
1, 0, 0, 0, 72, 5, 300, 75, 5, 1, ARM_SUIT, IRON, HI_METAL),
ARMOR("orcish chain mail", "crude chain mail",
@@ -670,11 +669,18 @@ FOOD("egg", 85, 1, 1, 1, FLESH, 80, CLR_WHITE),
FOOD("meatball", 0, 1, 1, 0, FLESH, 5, CLR_BROWN),
FOOD("meat stick", 0, 1, 1, 0, FLESH, 5, CLR_BROWN),
FOOD("huge chunk of meat", 0,20,400, 0, FLESH,2000, CLR_BROWN),
/* special case because it's not mergable */
OBJECT(OBJ("meat ring", (char *)0),
BITS(1,0,0,0,0,0,0,0,0,0,0,0,FLESH),
0, FOOD_CLASS, 0, 1, 5, 1, 0, 0, 0, 0, 5, CLR_BROWN),
/* pudding 'corpses' will turn into these and combine */
FOOD("glob of gray ooze", 0, 2, 20, 0, FLESH, 20, CLR_GRAY),
FOOD("glob of brown pudding", 0, 2, 20, 0, FLESH, 20, CLR_BROWN),
FOOD("glob of green slime", 0, 2, 20, 0, FLESH, 20, CLR_GREEN),
FOOD("glob of black pudding", 0, 2, 20, 0, FLESH, 20, CLR_BLACK),
/* fruits & veggies */
FOOD("kelp frond", 0, 1, 1, 0, VEGGY, 30, CLR_GREEN),
FOOD("eucalyptus leaf", 3, 1, 1, 0, VEGGY, 30, CLR_GREEN),

File diff suppressed because it is too large Load Diff

View File

@@ -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, j, n;
int i, n;
winid win;
struct obj *curr, *last, fake_hero_object;
struct obj **oarray;
@@ -823,7 +823,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
if (n > 0) {
menu_item *mi;
int i, k;
int k;
/* fix up counts: -1 means no count used => pick all;
if fake_hero_object was picked, discard that choice */

View File

@@ -502,6 +502,13 @@ register struct obj *otmp;
else otmp->spe = fruitadd(oldf->fname, (struct fruit *)0);
}
#ifdef SYSCF
#define SYSOPT_CHECK_SAVE_UID sysopt.check_save_uid
#else
#define SYSOPT_CHECK_SAVE_UID TRUE
#endif
STATIC_OVL
boolean
restgamestate(fd, stuckid, steedid)
@@ -517,7 +524,7 @@ unsigned int *stuckid, *steedid;
unsigned long uid;
mread(fd, (genericptr_t) &uid, sizeof uid);
if (uid != (unsigned long)getuid()) { /* strange ... */
if (SYSOPT_CHECK_SAVE_UID && uid != (unsigned long)getuid()) { /* strange ... */
/* for wizard mode, issue a reminder; for others, treat it
as an attempt to cheat and refuse to restore this file */
pline("Saved game was not yours.");

View File

@@ -15,6 +15,11 @@
#include "sp_lev.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4244)
#endif
typedef void (*select_iter_func)(int, int, genericptr_t);
extern void FDECL(mkmap, (lev_init *));
@@ -5032,7 +5037,7 @@ sp_lev *lvl;
break;
case SPO_SEL_LINE:
{
struct opvar *tmp, *tmp2, *pt = selection_opvar(NULL);
struct opvar *tmp = NULL, *tmp2 = NULL, *pt = selection_opvar(NULL);
schar x1,y1,x2,y2;
if (!OV_pop_c(tmp)) panic("no ter sel linecoord1");
if (!OV_pop_c(tmp2)) panic("no ter sel linecoord2");
@@ -5050,7 +5055,7 @@ sp_lev *lvl;
break;
case SPO_SEL_RNDLINE:
{
struct opvar *tmp, *tmp2, *tmp3, *pt = selection_opvar(NULL);
struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3, *pt = selection_opvar(NULL);
schar x1,y1,x2,y2;
if (!OV_pop_i(tmp3)) panic("no ter sel randline1");
if (!OV_pop_c(tmp)) panic("no ter sel randline2");
@@ -5222,4 +5227,8 @@ const char *name;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/*sp_lev.c*/

View File

@@ -67,6 +67,7 @@ sys_early_init()
# endif
#endif
sysopt.check_save_uid = 1;
sysopt.seduce = 1; /* if it's compiled in, default to on */
sysopt_seduce_set(sysopt.seduce);
}

View File

@@ -2215,7 +2215,7 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
(void) destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
(void) destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
}
if (burn_floor_paper(mtmp->mx, mtmp->my, see_it, FALSE) &&
if (burn_floor_objects(mtmp->mx, mtmp->my, see_it, FALSE) &&
!see_it && distu(mtmp->mx, mtmp->my) <= 3*3)
You("smell smoke.");
if (is_ice(mtmp->mx,mtmp->my))
@@ -2853,7 +2853,7 @@ struct obj *box; /* null for floor trap */
boolean see_it = !Blind;
int num, alt;
/* Bug: for box case, the equivalent of burn_floor_paper() ought
/* Bug: for box case, the equivalent of burn_floor_objects() ought
* to be done upon its contents.
*/
@@ -2898,7 +2898,7 @@ struct obj *box; /* null for floor trap */
destroy_item(SPBOOK_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
}
if (!box && burn_floor_paper(u.ux, u.uy, see_it, TRUE) && !see_it)
if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it)
You("smell paper burning.");
if (is_ice(u.ux, u.uy))
melt_ice(u.ux, u.uy, (char *)0);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 vision.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 vision.c $NHDT-Date: 1426449474 2015/03/15 19:57:54 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.14 $ */
/* NetHack 3.5 vision.c $Date: 2009/05/06 10:48:10 $ $Revision: 1.12 $ */
/* SCCS Id: @(#)vision.c 3.5 2007/11/05 */
/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
@@ -499,7 +499,7 @@ vision_recalc(control)
char *next_rmin; /* min pointer for the new array */
char *next_rmax; /* max pointer for the new array */
char *ranges; /* circle ranges -- used for xray & night vision */
int row; /* row counter (outer loop) */
int row = 0; /* row counter (outer loop) */
int start, stop; /* inner loop starting/stopping index */
int dx, dy; /* one step from a lit door or lit wall (see below) */
register int col; /* inner loop counter */
@@ -513,10 +513,6 @@ vision_recalc(control)
vision_full_recalc = 0; /* reset flag */
if (in_mklev || !iflags.vision_inited) return;
#ifdef GCC_WARN
row = 0;
#endif
/*
* Either the light sources have been taken care of, or we must
* recalculate them here.
@@ -1655,18 +1651,15 @@ right_side(row, cb_row, cb_col, fb_row, fb_col, left, right_mark, limits)
char *limits; /* points at range limit for current row, or NULL */
{
register int i;
register char *rowp;
register char *rowp = NULL;
int hit_stone = 0;
int left_shadow, right_shadow, loc_right;
int lblock_col; /* local block column (current row) */
int nrow, deeper;
char *row_min; /* left most */
char *row_max; /* right most */
char *row_min = NULL; /* left most */
char *row_max = NULL; /* right most */
int lim_max; /* right most limit of circle */
#ifdef GCC_WARN
rowp = 0;
#endif
nrow = row + step;
deeper = good_row(nrow) && (!limits || (*limits >= *(limits+1)));
if(!vis_func) {
@@ -1910,18 +1903,15 @@ left_side(row, cb_row, cb_col, fb_row, fb_col, left_mark, right, limits)
char *limits;
{
register int i;
register char *rowp;
register char *rowp = NULL;
int hit_stone = 0;
int left_shadow, right_shadow, loc_left;
int lblock_col; /* local block column (current row) */
int nrow, deeper;
char *row_min; /* left most */
char *row_max; /* right most */
char *row_min = NULL; /* left most */
char *row_max = NULL; /* right most */
int lim_min;
#ifdef GCC_WARN
rowp = 0;
#endif
nrow = row + step;
deeper = good_row(nrow) && (!limits || (*limits >= *(limits+1)));
if(!vis_func) {
@@ -2192,20 +2182,17 @@ right_side(row, left, right_mark, limits)
int right_mark; /* last (right side) visible spot on prev row */
char *limits; /* points at range limit for current row, or NULL */
{
int right; /* right limit of "could see" */
int right_edge; /* right edge of an opening */
int nrow; /* new row (calculate once) */
int deeper; /* if TRUE, call self as needed */
int result; /* set by q?_path() */
register int i; /* loop counter */
int right; /* right limit of "could see" */
int right_edge; /* right edge of an opening */
int nrow; /* new row (calculate once) */
int deeper; /* if TRUE, call self as needed */
int result; /* set by q?_path() */
register int i; /* loop counter */
register char *rowp = NULL; /* row optimization */
char *row_min = NULL; /* left most [used by macro set_min()] */
char *row_max = NULL; /* right most [used by macro set_max()] */
int lim_max; /* right most limit of circle */
int lim_max; /* right most limit of circle */
#ifdef GCC_WARN
rowp = row_min = row_max = 0;
#endif
nrow = row + step;
/*
* Can go deeper if the row is in bounds and the next row is within
@@ -2372,11 +2359,12 @@ left_side(row, left_mark, right, limits)
int row, left_mark, right;
char *limits;
{
int left, left_edge, nrow, deeper, result;
register int i;
int left, left_edge, nrow, deeper, result;
register int i;
register char *rowp = NULL;
char *row_min = NULL, *row_max = NULL;
int lim_min;
char *row_min = NULL;
char *row_max = NULL;
int lim_min;
#ifdef GCC_WARN
rowp = row_min = row_max = 0;

331
src/zap.c
View File

@@ -2112,18 +2112,19 @@ boolean ordinary;
case FIRE_HORN:
learn_it = TRUE;
if (Fire_resistance) {
shieldeff(u.ux, u.uy);
You_feel("rather warm.");
ugolemeffects(AD_FIRE, d(12,6));
} else {
pline("You've set yourself afire!");
damage = d(12,6);
shieldeff(u.ux, u.uy);
You_feel("rather warm.");
ugolemeffects(AD_FIRE, d(12,6));
} else {
pline("You've set yourself afire!");
damage = d(12,6);
}
burn_away_slime();
(void) burnarmor(&youmonst);
destroy_item(SCROLL_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
destroy_item(SPBOOK_CLASS, AD_FIRE);
destroy_item(FOOD_CLASS, AD_FIRE); /* only slime for now */
break;
case WAN_COLD:
@@ -3329,6 +3330,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
if (!rn2(3)) (void)destroy_mitem(mon, POTION_CLASS, AD_FIRE);
if (!rn2(3)) (void)destroy_mitem(mon, SCROLL_CLASS, AD_FIRE);
if (!rn2(5)) (void)destroy_mitem(mon, SPBOOK_CLASS, AD_FIRE);
destroy_mitem(mon, FOOD_CLASS, AD_FIRE); /* carried slime */
}
break;
case ZT_COLD:
@@ -3473,6 +3475,7 @@ xchar sx, sy;
if (!rn2(3)) destroy_item(POTION_CLASS, AD_FIRE);
if (!rn2(3)) destroy_item(SCROLL_CLASS, AD_FIRE);
if (!rn2(5)) destroy_item(SPBOOK_CLASS, AD_FIRE);
destroy_item(FOOD_CLASS, AD_FIRE);
}
break;
case ZT_COLD:
@@ -3569,11 +3572,11 @@ xchar sx, sy;
}
/*
* burn scrolls and spellbooks on floor at position x,y
* return the number of scrolls and spellbooks burned
* burn objects (such as scrolls and spellbooks) on floor
* at position x,y; return the number of objects burned
*/
int
burn_floor_paper(x, y, give_feedback, u_caused)
burn_floor_objects(x, y, give_feedback, u_caused)
int x, y;
boolean give_feedback; /* caller needs to decide about visibility checks */
boolean u_caused;
@@ -3585,37 +3588,39 @@ boolean u_caused;
for (obj = level.objects[x][y]; obj; obj = obj2) {
obj2 = obj->nexthere;
if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS) {
if (obj->otyp == SCR_FIRE || obj->otyp == SPE_FIREBALL ||
obj_resists(obj, 2, 100))
continue;
scrquan = obj->quan; /* number present */
delquan = 0L; /* number to destroy */
for (i = scrquan; i > 0L; i--)
if (!rn2(3)) delquan++;
if (delquan) {
/* save name before potential delobj() */
if (give_feedback) {
obj->quan = 1L;
Strcpy(buf1, (x == u.ux && y == u.uy) ?
xname(obj) : distant_name(obj, xname));
obj->quan = 2L;
Strcpy(buf2, (x == u.ux && y == u.uy) ?
xname(obj) : distant_name(obj, xname));
obj->quan = scrquan;
}
/* useupf(), which charges, only if hero caused damage */
if (u_caused) useupf(obj, delquan);
else if (delquan < scrquan) obj->quan -= delquan;
else delobj(obj);
cnt += delquan;
if (give_feedback) {
if (delquan > 1L)
pline("%ld %s burn.", delquan, buf2);
else
pline("%s burns.", An(buf1));
}
}
if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS
|| (obj->oclass == FOOD_CLASS
&& obj->otyp == GLOB_OF_GREEN_SLIME)) {
if (obj->otyp == SCR_FIRE || obj->otyp == SPE_FIREBALL ||
obj_resists(obj, 2, 100))
continue;
scrquan = obj->quan; /* number present */
delquan = 0L; /* number to destroy */
for (i = scrquan; i > 0L; i--)
if (!rn2(3)) delquan++;
if (delquan) {
/* save name before potential delobj() */
if (give_feedback) {
obj->quan = 1L;
Strcpy(buf1, (x == u.ux && y == u.uy) ?
xname(obj) : distant_name(obj, xname));
obj->quan = 2L;
Strcpy(buf2, (x == u.ux && y == u.uy) ?
xname(obj) : distant_name(obj, xname));
obj->quan = scrquan;
}
/* useupf(), which charges, only if hero caused damage */
if (u_caused) useupf(obj, delquan);
else if (delquan < scrquan) obj->quan -= delquan;
else delobj(obj);
cnt += delquan;
if (give_feedback) {
if (delquan > 1L)
pline("%ld %s burn.", delquan, buf2);
else
pline("%s burns.", An(buf1));
}
}
}
}
return cnt;
@@ -4255,7 +4260,7 @@ short exploding_wand_typ;
}
if(OBJ_AT(x, y) && abstype == ZT_FIRE)
if (burn_floor_paper(x, y, FALSE, type > 0) && couldsee(x, y)) {
if (burn_floor_objects(x, y, FALSE, type > 0) && couldsee(x, y)) {
newsym(x,y);
You("%s of smoke.",
!Blind ? "see a puff" : "smell a whiff");
@@ -4365,129 +4370,137 @@ const char * const destroy_strings[][3] = { /* also used in trap.c */
void
destroy_item(osym, dmgtyp)
register int osym, dmgtyp;
register int osym, dmgtyp;
{
register struct obj *obj, *obj2;
register int dmg, xresist, skip;
register long i, cnt, quan;
register int dindx;
const char *mult;
boolean physical_damage;
register struct obj *obj, *obj2;
register int dmg, xresist, skip;
register long i, cnt, quan;
register int dindx;
const char *mult;
boolean physical_damage;
for(obj = invent; obj; obj = obj2) {
obj2 = obj->nobj;
physical_damage = FALSE;
if(obj->oclass != osym) continue; /* test only objs of type osym */
if(obj->oartifact) continue; /* don't destroy artifacts */
if(obj->in_use && obj->quan == 1L) continue; /* not available */
xresist = skip = 0;
/* lint suppression */
dmg = dindx = 0;
quan = 0L;
for(obj = invent; obj; obj = obj2) {
obj2 = obj->nobj;
physical_damage = FALSE;
if(obj->oclass != osym) continue; /* test only objs of type osym */
if(obj->oartifact) continue; /* don't destroy artifacts */
if(obj->in_use && obj->quan == 1L) continue; /* not available */
xresist = skip = 0;
/* lint suppression */
dmg = dindx = 0;
quan = 0L;
switch(dmgtyp) {
case AD_COLD:
if(osym == POTION_CLASS && obj->otyp != POT_OIL) {
quan = obj->quan;
dindx = 0;
dmg = rnd(4);
} else skip++;
break;
case AD_FIRE:
xresist = (Fire_resistance && obj->oclass != POTION_CLASS);
switch(dmgtyp) {
case AD_COLD:
if(osym == POTION_CLASS && obj->otyp != POT_OIL) {
quan = obj->quan;
dindx = 0;
dmg = rnd(4);
} else skip++;
break;
case AD_FIRE:
xresist = (Fire_resistance
&& obj->oclass != POTION_CLASS
&& obj->otyp != GLOB_OF_GREEN_SLIME);
if (obj->otyp == SCR_FIRE || obj->otyp == SPE_FIREBALL)
skip++;
if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
skip++;
if (!Blind)
pline("%s glows a strange %s, but remains intact.",
The(xname(obj)), hcolor("dark red"));
}
quan = obj->quan;
switch(osym) {
case POTION_CLASS:
dindx = (obj->otyp != POT_OIL) ? 1 : 2;
dmg = rnd(6);
break;
case SCROLL_CLASS:
dindx = 3;
dmg = 1;
break;
case SPBOOK_CLASS:
dindx = 4;
dmg = 1;
break;
default:
skip++;
break;
}
break;
case AD_ELEC:
xresist = (Shock_resistance && obj->oclass != RING_CLASS);
quan = obj->quan;
switch(osym) {
case RING_CLASS:
if(obj->otyp == RIN_SHOCK_RESISTANCE)
{ skip++; break; }
dindx = 5;
dmg = 0;
break;
case WAND_CLASS:
if(obj->otyp == WAN_LIGHTNING) { skip++; break; }
if (obj->otyp == SCR_FIRE || obj->otyp == SPE_FIREBALL)
skip++;
if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
skip++;
if (!Blind)
pline("%s glows a strange %s, but remains intact.",
The(xname(obj)), hcolor("dark red"));
}
quan = obj->quan;
switch(osym) {
case POTION_CLASS:
dindx = (obj->otyp != POT_OIL) ? 1 : 2;
dmg = rnd(6);
break;
case SCROLL_CLASS:
dindx = 3;
dmg = 1;
break;
case SPBOOK_CLASS:
dindx = 4;
dmg = 1;
break;
case FOOD_CLASS:
if (obj->otyp == GLOB_OF_GREEN_SLIME) {
dindx = obj->owt / 20;
dmg = 1;
} else { skip++; }
break;
default:
skip++;
break;
}
break;
case AD_ELEC:
xresist = (Shock_resistance && obj->oclass != RING_CLASS);
quan = obj->quan;
switch(osym) {
case RING_CLASS:
if(obj->otyp == RIN_SHOCK_RESISTANCE)
{ skip++; break; }
dindx = 5;
dmg = 0;
break;
case WAND_CLASS:
if(obj->otyp == WAN_LIGHTNING) { skip++; break; }
#if 0
if (obj == current_wand) { skip++; break; }
if (obj == current_wand) { skip++; break; }
#endif
dindx = 6;
dmg = rnd(10);
break;
default:
skip++;
break;
}
break;
default:
skip++;
break;
}
if(!skip) {
if (obj->in_use) --quan; /* one will be used up elsewhere */
for(i = cnt = 0L; i < quan; i++)
if(!rn2(3)) cnt++;
dindx = 6;
dmg = rnd(10);
break;
default:
skip++;
break;
}
break;
default:
skip++;
break;
}
if(!skip) {
if (obj->in_use) --quan; /* one will be used up elsewhere */
for(i = cnt = 0L; i < quan; i++)
if(!rn2(3)) cnt++;
if(!cnt) continue;
mult = (cnt == quan) ? "Your" :
(cnt == 1L) ? "One of your" : "Some of your";
pline("%s %s %s!", mult, xname(obj),
destroy_strings[dindx][(cnt > 1L)]);
if(osym == POTION_CLASS && dmgtyp != AD_COLD) {
if (!breathless(youmonst.data) || haseyes(youmonst.data))
potionbreathe(obj);
}
if (obj->owornmask) {
if (obj->owornmask & W_RING) /* ring being worn */
Ring_gone(obj);
else
setnotworn(obj);
}
if (obj == current_wand) current_wand = 0; /* destroyed */
for (i = 0; i < cnt; i++)
useup(obj);
if(dmg) {
if(xresist) You("aren't hurt!");
else {
const char *how = destroy_strings[dindx][2];
boolean one = (cnt == 1L);
if(!cnt) continue;
mult = (cnt == quan) ? (quan > 1) ? "All of your " : "Your" :
(cnt == 1L) ? "One of your" : "Some of your";
pline("%s %s %s!", mult, xname(obj),
destroy_strings[dindx][(cnt > 1L)]);
if(osym == POTION_CLASS && dmgtyp != AD_COLD) {
if (!breathless(youmonst.data) || haseyes(youmonst.data))
potionbreathe(obj);
}
if (obj->owornmask) {
if (obj->owornmask & W_RING) /* ring being worn */
Ring_gone(obj);
else
setnotworn(obj);
}
if (obj == current_wand) current_wand = 0; /* destroyed */
for (i = 0; i < cnt; i++)
useup(obj);
if(dmg) {
if(xresist) You("aren't hurt!");
else {
const char *how = destroy_strings[dindx][2];
boolean one = (cnt == 1L);
if (physical_damage) dmg = Maybe_Half_Phys(dmg);
losehp(dmg, one ? how : (const char *)makeplural(how),
one ? KILLED_BY_AN : KILLED_BY);
exercise(A_STR, FALSE);
}
}
}
}
return;
if (physical_damage) dmg = Maybe_Half_Phys(dmg);
losehp(dmg, one ? how : (const char *)makeplural(how),
one ? KILLED_BY_AN : KILLED_BY);
exercise(A_STR, FALSE);
}
}
}
}
return;
}
int
@@ -4546,6 +4559,12 @@ int osym, dmgtyp;
dindx = 4;
tmp++;
break;
case FOOD_CLASS:
if (obj->otyp == GLOB_OF_GREEN_SLIME) {
dindx = obj->owt / 20;
tmp++;
} else { skip++; }
break;
default:
skip++;
break;