more src reformatting

Fixing up mis-indented block comments, but hit some files that hadn't
had the earlier mixture of tab replacement, etc, so it's bigger than I
expected.  If I get to it, they'll be another round of this tomorrow.
This commit is contained in:
PatR
2015-11-06 03:14:50 -08:00
parent 102e427ca7
commit 915dd89270
14 changed files with 811 additions and 752 deletions
+7 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1446369459 2015/11/01 09:17:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.208 $ */ /* NetHack 3.6 apply.c $NHDT-Date: 1446808436 2015/11/06 11:13:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.210 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1471,7 +1471,7 @@ boolean showmsg;
return TRUE; return TRUE;
} }
int jumping_is_magic; static int jumping_is_magic;
void void
display_jump_positions(state) display_jump_positions(state)
@@ -1481,6 +1481,7 @@ int state;
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) { } else if (state == 1) {
int x, y, dx, dy; int x, y, dx, dy;
for (dx = -4; dx <= 4; dx++) for (dx = -4; dx <= 4; dx++)
for (dy = -4; dy <= 4; dy++) { for (dy = -4; dy <= 4; dy++) {
x = dx + (int) u.ux; x = dx + (int) u.ux;
@@ -1508,8 +1509,7 @@ int magic; /* 0=Physical, otherwise skill level */
} else if (!magic && !Jumping) { } else if (!magic && !Jumping) {
You_cant("jump very far."); You_cant("jump very far.");
return 0; return 0;
/* if steed is immobile, can't do physical jump but can do spell one /* if steed is immobile, can't do physical jump but can do spell one */
*/
} else if (!magic && u.usteed && stucksteed(FALSE)) { } else if (!magic && u.usteed && stucksteed(FALSE)) {
/* stucksteed gave "<steed> won't move" message */ /* stucksteed gave "<steed> won't move" message */
return 0; return 0;
@@ -1587,7 +1587,8 @@ int magic; /* 0=Physical, otherwise skill level */
if (u.utrap) if (u.utrap)
switch (u.utraptype) { switch (u.utraptype) {
case TT_BEARTRAP: { case TT_BEARTRAP: {
register long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE; long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
You("rip yourself free of the bear trap! Ouch!"); You("rip yourself free of the bear trap! Ouch!");
losehp(Maybe_Half_Phys(rnd(10)), "jumping out of a bear trap", losehp(Maybe_Half_Phys(rnd(10)), "jumping out of a bear trap",
KILLED_BY); KILLED_BY);
@@ -2718,7 +2719,7 @@ coord *pos;
int min_range, max_range; int min_range, max_range;
{ {
struct monst *mtmp; struct monst *mtmp;
struct monst *selmon = NULL; struct monst *selmon = (struct monst *) 0;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 ball.c $NHDT-Date: 1445301116 2015/10/20 00:31:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */ /* NetHack 3.6 ball.c $NHDT-Date: 1446808438 2015/11/06 11:13:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -694,7 +694,8 @@ drop_ball(x, y)
xchar x, y; xchar x, y;
{ {
if (Blind) { if (Blind) {
u.bc_order = bc_order(); /* get the order */ /* get the order */
u.bc_order = bc_order();
/* pick up glyph */ /* pick up glyph */
u.bglyph = (u.bc_order) ? u.cglyph : levl[x][y].glyph; u.bglyph = (u.bc_order) ? u.cglyph : levl[x][y].glyph;
} }
@@ -803,7 +804,6 @@ drag_down()
* not wielding any weapon), or * not wielding any weapon), or
* c) (perhaps) it falls forward out of his non-weapon hand * c) (perhaps) it falls forward out of his non-weapon hand
*/ */
forward = carried(uball) && (uwep == uball || !uwep || !rn2(3)); forward = carried(uball) && (uwep == uball || !uwep || !rn2(3));
if (carried(uball)) if (carried(uball))
+42 -38
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1445301119 2015/10/20 00:31:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */ /* NetHack 3.6 display.c $NHDT-Date: 1446808439 2015/11/06 11:13:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */ /* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -106,8 +106,7 @@
* seenv - A vector of bits representing the directions from which the * seenv - A vector of bits representing the directions from which the
* hero has seen this position. The vector's primary use is * hero has seen this position. The vector's primary use is
* determining how walls are seen. E.g. a wall sometimes looks * determining how walls are seen. E.g. a wall sometimes looks
* like stone on one side, but is seen as a wall from the * like stone on one side, but is seen as wall from the other.
*other.
* Other uses are for unmapping detected objects and felt * Other uses are for unmapping detected objects and felt
* locations, where we need to know if the hero has ever * locations, where we need to know if the hero has ever
* seen the location. * seen the location.
@@ -360,13 +359,13 @@ STATIC_OVL void
display_monster(x, y, mon, sightflags, worm_tail) display_monster(x, y, mon, sightflags, worm_tail)
register xchar x, y; /* display position */ register xchar x, y; /* display position */
register struct monst *mon; /* monster to display */ register struct monst *mon; /* monster to display */
int sightflags; /* 1 if the monster is physically seen */ int sightflags; /* 1 if the monster is physically seen;
/* 2 if detected using Detect_monsters */ 2 if detected using Detect_monsters */
register xchar worm_tail; /* mon is actually a worm tail */ xchar worm_tail; /* mon is actually a worm tail */
{ {
register boolean mon_mimic = (mon->m_ap_type != M_AP_NOTHING); boolean mon_mimic = (mon->m_ap_type != M_AP_NOTHING);
register int sensed = int sensed = (mon_mimic && (Protection_from_shape_changers
mon_mimic && (Protection_from_shape_changers || sensemon(mon)); || sensemon(mon)));
/* /*
* We must do the mimic check first. If the mimic is mimicing something, * We must do the mimic check first. If the mimic is mimicing something,
* and the location is in sight, we have to change the hero's memory * and the location is in sight, we have to change the hero's memory
@@ -405,8 +404,9 @@ register xchar worm_tail; /* mon is actually a worm tail */
} }
case M_AP_OBJECT: { case M_AP_OBJECT: {
struct obj obj; /* Make a fake object to send */ /* Make a fake object to send to map_object(). */
/* to map_object(). */ struct obj obj;
obj = zeroobj; obj = zeroobj;
obj.ox = x; obj.ox = x;
obj.oy = y; obj.oy = y;
@@ -520,8 +520,8 @@ xchar x, y;
if (Underwater && !Is_waterlevel(&u.uz) && !is_pool(x, y)) if (Underwater && !Is_waterlevel(&u.uz) && !is_pool(x, y))
return; return;
/* Set the seen vector as if the hero had seen it. It doesn't matter */ /* Set the seen vector as if the hero had seen it.
/* if the hero is levitating or not. */ It doesn't matter if the hero is levitating or not. */
set_seenv(lev, u.ux, u.uy, x, y); set_seenv(lev, u.ux, u.uy, x, y);
if (!can_reach_floor(FALSE)) { if (!can_reach_floor(FALSE)) {
@@ -578,7 +578,8 @@ xchar x, y;
if (lev->typ != ROOM && lev->seenv) { if (lev->typ != ROOM && lev->seenv) {
map_background(x, y, 1); map_background(x, y, 1);
} else { } else {
lev->glyph = (flags.dark_room && iflags.use_color && !Is_rogue_level(&u.uz)) lev->glyph = (flags.dark_room && iflags.use_color
&& !Is_rogue_level(&u.uz))
? cmap_to_glyph(S_darkroom) ? cmap_to_glyph(S_darkroom)
: (lev->waslit ? cmap_to_glyph(S_room) : (lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone)); : cmap_to_glyph(S_stone));
@@ -587,7 +588,8 @@ xchar x, y;
} else if ((lev->glyph >= cmap_to_glyph(S_stone) } else if ((lev->glyph >= cmap_to_glyph(S_stone)
&& lev->glyph < cmap_to_glyph(S_darkroom)) && lev->glyph < cmap_to_glyph(S_darkroom))
|| glyph_is_invisible(levl[x][y].glyph)) { || glyph_is_invisible(levl[x][y].glyph)) {
lev->glyph = (flags.dark_room && iflags.use_color && !Is_rogue_level(&u.uz)) lev->glyph = (flags.dark_room && iflags.use_color
&& !Is_rogue_level(&u.uz))
? cmap_to_glyph(S_darkroom) ? cmap_to_glyph(S_darkroom)
: (lev->waslit ? cmap_to_glyph(S_room) : (lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone)); : cmap_to_glyph(S_stone));
@@ -749,30 +751,30 @@ register int x, y;
display_monster(x, y, mon, display_monster(x, y, mon,
see_it ? PHYSICALLY_SEEN : DETECTED, see_it ? PHYSICALLY_SEEN : DETECTED,
worm_tail); worm_tail);
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) } else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon); display_warning(mon);
else if (glyph_is_invisible(levl[x][y].glyph)) } else if (glyph_is_invisible(levl[x][y].glyph)) {
map_invisible(x, y); map_invisible(x, y);
else } else
_map_location(x, y, 1); /* map the location */ _map_location(x, y, 1); /* map the location */\
}
} }
/* Can't see the location. */ /* Can't see the location. */
else { } else {
if (x == u.ux && y == u.uy) { if (x == u.ux && y == u.uy) {
feel_location(u.ux, u.uy); /* forces an update */ feel_location(u.ux, u.uy); /* forces an update */
if (canspotself()) if (canspotself())
display_self(); display_self();
} else if ((mon = m_at(x, y)) } else if ((mon = m_at(x, y))
&& ((see_it = && ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
(tp_sensemon(mon) || MATCH_WARN_OF_MON(mon) || (see_with_infrared(mon)
|| (see_with_infrared(mon) && mon_visible(mon)))) && mon_visible(mon))))
|| Detect_monsters)) { || Detect_monsters)) {
/* Monsters are printed every time. */ /* Monsters are printed every time. */
/* This also gets rid of any invisibility glyph */ /* This also gets rid of any invisibility glyph */
display_monster(x, y, mon, see_it ? 0 : DETECTED, is_worm_tail(mon) ? TRUE : FALSE); 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) } else if ((mon = m_at(x, y)) && mon_warning(mon)
&& !is_worm_tail(mon)) { && !is_worm_tail(mon)) {
display_warning(mon); display_warning(mon);
@@ -803,7 +805,8 @@ register int x, y;
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) if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM && !lev->waslit) else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM
&& !lev->waslit)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
else else
goto show_mem; goto show_mem;
@@ -1063,19 +1066,20 @@ int mode;
if (mode == 1 || dela) { if (mode == 1 || dela) {
cls(); cls();
dela = FALSE; dela = FALSE;
}
/* delayed full update */ /* delayed full update */
else if (mode == 2) { } else if (mode == 2) {
dela = TRUE; dela = TRUE;
return; return;
}
/* limited update */ /* limited update */
else { } else {
for (y = lasty - 1; y <= lasty + 1; y++) for (y = lasty - 1; y <= lasty + 1; y++)
for (x = lastx - 1; x <= lastx + 1; x++) for (x = lastx - 1; x <= lastx + 1; x++)
if (isok(x, y)) if (isok(x, y))
show_glyph(x, y, cmap_to_glyph(S_stone)); show_glyph(x, y, cmap_to_glyph(S_stone));
} }
for (x = u.ux - 1; x <= u.ux + 1; x++) for (x = u.ux - 1; x <= u.ux + 1; x++)
for (y = u.uy - 1; y <= u.uy + 1; y++) for (y = u.uy - 1; y <= u.uy + 1; y++)
if (isok(x, y) && is_pool(x, y)) { if (isok(x, y) && is_pool(x, y)) {
@@ -1107,15 +1111,16 @@ int mode;
if (mode == 1 || dela) { if (mode == 1 || dela) {
cls(); cls();
dela = FALSE; dela = FALSE;
}
/* delayed full update */ /* delayed full update */
else if (mode == 2) { } else if (mode == 2) {
dela = TRUE; dela = TRUE;
return; return;
}
/* limited update */ /* limited update */
else } else {
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
}
} }
/* ========================================================================= /* =========================================================================
@@ -1646,8 +1651,7 @@ int loc;
impossible("swallow_to_glyph: bad swallow location"); impossible("swallow_to_glyph: bad swallow location");
loc = S_sw_br; loc = S_sw_br;
} }
return ((int) (what_mon(mnum) << 3) | (loc - S_sw_tl)) return ((int) (what_mon(mnum) << 3) | (loc - S_sw_tl)) + GLYPH_SWALLOW_OFF;
+ GLYPH_SWALLOW_OFF;
} }
/* /*
@@ -1783,8 +1787,8 @@ error4(x, y, a, b, c, dd)
int x, y, a, b, c, dd; int x, y, a, b, c, dd;
{ {
pline("set_wall_state: %s @ (%d,%d) %s%s%s%s", pline("set_wall_state: %s @ (%d,%d) %s%s%s%s",
type_to_name(levl[x][y].typ), x, y, a ? "1" : "", b ? "2" : "", type_to_name(levl[x][y].typ), x, y,
c ? "3" : "", dd ? "4" : ""); a ? "1" : "", b ? "2" : "", c ? "3" : "", dd ? "4" : "");
bad_count[levl[x][y].typ]++; bad_count[levl[x][y].typ]++;
} }
#endif /* WA_VERBOSE */ #endif /* WA_VERBOSE */
+39 -37
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1444617209 2015/10/12 02:33:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */ /* NetHack 3.6 do_name.c $NHDT-Date: 1446808440 2015/11/06 11:14:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -29,10 +29,11 @@ nextmbuf()
/* function for getpos() to highlight desired map locations. /* function for getpos() to highlight desired map locations.
* parameter value 0 = initialize, 1 = highlight, 2 = done * parameter value 0 = initialize, 1 = highlight, 2 = done
*/ */
void (*getpos_hilitefunc)(int) = NULL; void FDECL((*getpos_hilitefunc), (int)) = (void FDECL((*), (int))) 0;
void void
getpos_sethilite(f) getpos_sethilite(f)
void (*f)(int); void FDECL((*f), (int));
{ {
getpos_hilitefunc = f; getpos_hilitefunc = f;
} }
@@ -244,8 +245,7 @@ const char *goal;
|| glyph_to_cmap(k) == S_darkroom || glyph_to_cmap(k) == S_darkroom
|| glyph_to_cmap(k) == S_corr || glyph_to_cmap(k) == S_corr
|| glyph_to_cmap(k) == S_litcorr)) { || glyph_to_cmap(k) == S_litcorr)) {
/* what the hero remembers to be at tx,ty /* what hero remembers to be at tx,ty */
*/
k = glyph_at(tx, ty); k = glyph_at(tx, ty);
} }
if (glyph_is_cmap(k) if (glyph_is_cmap(k)
@@ -384,7 +384,6 @@ struct obj *obj;
{ {
if (has_oname(obj)) if (has_oname(obj))
return ONAME(obj); return ONAME(obj);
else
return ""; return "";
} }
@@ -821,13 +820,13 @@ rndghostname()
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) plname; return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) plname;
} }
/* Monster naming functions: /*
* Monster naming functions:
* x_monnam is the generic monster-naming function. * x_monnam is the generic monster-naming function.
* seen unseen detected named * seen unseen detected named
* mon_nam: the newt it the invisible orc Fido * mon_nam: the newt it the invisible orc Fido
* noit_mon_nam:the newt (as if detected) the invisible orc Fido * noit_mon_nam:the newt (as if detected) the invisible orc Fido
* l_monnam: newt it invisible orc dog called * l_monnam: newt it invisible orc dog called Fido
*fido
* Monnam: The newt It The invisible orc Fido * Monnam: The newt It The invisible orc Fido
* noit_Monnam: The newt (as if detected) The invisible orc Fido * noit_Monnam: The newt (as if detected) The invisible orc Fido
* Adjmonnam: The poor newt It The poor invisible orc The poor Fido * Adjmonnam: The poor newt It The poor invisible orc The poor Fido
@@ -953,6 +952,7 @@ boolean called;
if (do_hallu) { if (do_hallu) {
char rnamecode; char rnamecode;
char *rname = rndmonnam(&rnamecode); char *rname = rndmonnam(&rnamecode);
Strcat(buf, rname); Strcat(buf, rname);
name_at_start = bogon_is_pname(rnamecode); name_at_start = bogon_is_pname(rnamecode);
} else if (has_mname(mtmp)) { } else if (has_mname(mtmp)) {
@@ -982,6 +982,7 @@ boolean called;
} }
} else if (is_mplayer(mdat) && !In_endgame(&u.uz)) { } else if (is_mplayer(mdat) && !In_endgame(&u.uz)) {
char pbuf[BUFSZ]; char pbuf[BUFSZ];
Strcpy(pbuf, rank_of((int) mtmp->m_lev, monsndx(mdat), Strcpy(pbuf, rank_of((int) mtmp->m_lev, monsndx(mdat),
(boolean) mtmp->female)); (boolean) mtmp->female));
Strcat(buf, lcase(pbuf)); Strcat(buf, lcase(pbuf));
@@ -1015,7 +1016,7 @@ boolean called;
Strcpy(buf, buf2); Strcpy(buf, buf2);
return buf; return buf;
case ARTICLE_A: case ARTICLE_A:
return (an(buf)); return an(buf);
case ARTICLE_NONE: case ARTICLE_NONE:
default: default:
return buf; return buf;
@@ -1025,18 +1026,18 @@ boolean called;
char * char *
l_monnam(mtmp) l_monnam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
return (x_monnam(mtmp, ARTICLE_NONE, (char *) 0, return x_monnam(mtmp, ARTICLE_NONE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE)); (has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE);
} }
char * char *
mon_nam(mtmp) mon_nam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
return (x_monnam(mtmp, ARTICLE_THE, (char *) 0, return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE)); (has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
} }
/* print the name as if mon_nam() was called, but assume that the player /* print the name as if mon_nam() was called, but assume that the player
@@ -1045,32 +1046,32 @@ register struct monst *mtmp;
*/ */
char * char *
noit_mon_nam(mtmp) noit_mon_nam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
return (x_monnam(mtmp, ARTICLE_THE, (char *) 0, return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT) (has_mname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT)
: SUPPRESS_IT, : SUPPRESS_IT,
FALSE)); FALSE);
} }
char * char *
Monnam(mtmp) Monnam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
register char *bp = mon_nam(mtmp); register char *bp = mon_nam(mtmp);
*bp = highc(*bp); *bp = highc(*bp);
return (bp); return bp;
} }
char * char *
noit_Monnam(mtmp) noit_Monnam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
register char *bp = noit_mon_nam(mtmp); register char *bp = noit_mon_nam(mtmp);
*bp = highc(*bp); *bp = highc(*bp);
return (bp); return bp;
} }
/* monster's own name */ /* monster's own name */
@@ -1100,33 +1101,32 @@ struct monst *mtmp;
char * char *
Adjmonnam(mtmp, adj) Adjmonnam(mtmp, adj)
register struct monst *mtmp; struct monst *mtmp;
register const char *adj; const char *adj;
{ {
register char *bp = char *bp = x_monnam(mtmp, ARTICLE_THE, adj,
x_monnam(mtmp, ARTICLE_THE, adj, has_mname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE);
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
*bp = highc(*bp); *bp = highc(*bp);
return (bp); return bp;
} }
char * char *
a_monnam(mtmp) a_monnam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
return x_monnam(mtmp, ARTICLE_A, (char *) 0, return x_monnam(mtmp, ARTICLE_A, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE); has_mname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE);
} }
char * char *
Amonnam(mtmp) Amonnam(mtmp)
register struct monst *mtmp; struct monst *mtmp;
{ {
register char *bp = a_monnam(mtmp); char *bp = a_monnam(mtmp);
*bp = highc(*bp); *bp = highc(*bp);
return (bp); return bp;
} }
/* used for monster ID by the '/', ';', and 'C' commands to block remote /* used for monster ID by the '/', ';', and 'C' commands to block remote
@@ -1170,7 +1170,6 @@ char *buf, *code;
return mname; return mname;
} }
#define BOGUSMONSIZE 100 /* arbitrary */
/* return a random monster name, for hallucination */ /* return a random monster name, for hallucination */
char * char *
rndmonnam(code) rndmonnam(code)
@@ -1179,6 +1178,7 @@ char *code;
static char buf[BUFSZ]; static char buf[BUFSZ];
char *mname; char *mname;
int name; int name;
#define BOGUSMONSIZE 100 /* arbitrary */
if (code) if (code)
*code = '\0'; *code = '\0';
@@ -1194,8 +1194,8 @@ char *code;
mname = strcpy(buf, mons[name].mname); mname = strcpy(buf, mons[name].mname);
} }
return mname; return mname;
}
#undef BOGUSMONSIZE #undef BOGUSMONSIZE
}
/* check bogusmon prefix to decide whether it's a personal name */ /* check bogusmon prefix to decide whether it's a personal name */
boolean boolean
@@ -1249,8 +1249,10 @@ const char *
rndcolor() rndcolor()
{ {
int k = rn2(CLR_MAX); int k = rn2(CLR_MAX);
return Hallucination ? hcolor((char *) 0) return Hallucination ? hcolor((char *) 0)
: (k == NO_COLOR) ? "colorless" : c_obj_colors[k]; : (k == NO_COLOR) ? "colorless"
: c_obj_colors[k];
} }
/* Aliases for road-runner nemesis /* Aliases for road-runner nemesis
+37 -31
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dog.c $NHDT-Date: 1445301120 2015/10/20 00:32:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */ /* NetHack 3.6 dog.c $NHDT-Date: 1446808440 2015/11/06 11:14:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.52 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -56,13 +56,13 @@ STATIC_OVL int
pet_type() pet_type()
{ {
if (urole.petnum != NON_PM) if (urole.petnum != NON_PM)
return (urole.petnum); return urole.petnum;
else if (preferred_pet == 'c') else if (preferred_pet == 'c')
return (PM_KITTEN); return PM_KITTEN;
else if (preferred_pet == 'd') else if (preferred_pet == 'd')
return (PM_LITTLE_DOG); return PM_LITTLE_DOG;
else else
return (rn2(2) ? PM_KITTEN : PM_LITTLE_DOG); return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG;
} }
struct monst * struct monst *
@@ -200,7 +200,7 @@ makedog()
mtmp = christen_monst(mtmp, petname); mtmp = christen_monst(mtmp, petname);
initedog(mtmp); initedog(mtmp);
return (mtmp); return mtmp;
} }
/* record `last move time' for all monsters prior to level save so that /* record `last move time' for all monsters prior to level save so that
@@ -743,7 +743,7 @@ register struct obj *obj;
boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), starving; boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), starving;
if (is_quest_artifact(obj) || obj_resists(obj, 0, 95)) if (is_quest_artifact(obj) || obj_resists(obj, 0, 95))
return (obj->cursed ? TABU : APPORT); return obj->cursed ? TABU : APPORT;
switch (obj->oclass) { switch (obj->oclass) {
case FOOD_CLASS: case FOOD_CLASS:
@@ -771,7 +771,9 @@ register struct obj *obj;
&& fptr != &mons[PM_LIZARD] && fptr != &mons[PM_LIZARD]
&& fptr != &mons[PM_LICHEN]) && fptr != &mons[PM_LICHEN])
? DOGFOOD ? DOGFOOD
: (starving && !vegan(fptr)) ? ACCFOOD : POISON; : (starving && !vegan(fptr))
? ACCFOOD
: POISON;
if (obj->otyp == EGG) if (obj->otyp == EGG)
return stale_egg(obj) ? CADAVER : starving ? ACCFOOD : POISON; return stale_egg(obj) ? CADAVER : starving ? ACCFOOD : POISON;
return TABU; return TABU;
@@ -783,9 +785,9 @@ register struct obj *obj;
case MEAT_RING: case MEAT_RING:
case MEAT_STICK: case MEAT_STICK:
case HUGE_CHUNK_OF_MEAT: case HUGE_CHUNK_OF_MEAT:
return (carni ? DOGFOOD : MANFOOD); return carni ? DOGFOOD : MANFOOD;
case EGG: case EGG:
return (carni ? CADAVER : MANFOOD); return carni ? CADAVER : MANFOOD;
case CORPSE: case CORPSE:
if ((peek_at_iced_corpse_age(obj) + 50L <= monstermoves if ((peek_at_iced_corpse_age(obj) + 50L <= monstermoves
&& obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN && obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN
@@ -795,57 +797,61 @@ register struct obj *obj;
return POISON; return POISON;
/* turning into slime is preferable to starvation */ /* turning into slime is preferable to starvation */
else if (fptr == &mons[PM_GREEN_SLIME] && !slimeproof(mon->data)) else if (fptr == &mons[PM_GREEN_SLIME] && !slimeproof(mon->data))
return (starving ? ACCFOOD : POISON); return starving ? ACCFOOD : POISON;
else if (vegan(fptr)) else if (vegan(fptr))
return (herbi ? CADAVER : MANFOOD); return herbi ? CADAVER : MANFOOD;
/* most humanoids will avoid cannibalism unless starving; /* most humanoids will avoid cannibalism unless starving;
arbitrary: elves won't eat other elves even then */ arbitrary: elves won't eat other elves even then */
else if (humanoid(mptr) && same_race(mptr, fptr) else if (humanoid(mptr) && same_race(mptr, fptr)
&& (!is_undead(mptr) && fptr->mlet != S_KOBOLD && (!is_undead(mptr) && fptr->mlet != S_KOBOLD
&& fptr->mlet != S_ORC && fptr->mlet != S_OGRE)) && fptr->mlet != S_ORC && fptr->mlet != S_OGRE))
return ((starving && carni && !is_elf(mptr)) ? ACCFOOD return (starving && carni && !is_elf(mptr)) ? ACCFOOD : TABU;
: TABU);
else else
return (carni ? CADAVER : MANFOOD); return carni ? CADAVER : MANFOOD;
case CLOVE_OF_GARLIC: case CLOVE_OF_GARLIC:
return ((is_undead(mptr) || is_vampshifter(mon)) return (is_undead(mptr) || is_vampshifter(mon))
? TABU ? TABU
: ((herbi || starving) ? ACCFOOD : MANFOOD)); : (herbi || starving)
? ACCFOOD
: MANFOOD;
case TIN: case TIN:
return (metallivorous(mptr) ? ACCFOOD : MANFOOD); return metallivorous(mptr) ? ACCFOOD : MANFOOD;
case APPLE: case APPLE:
case CARROT: case CARROT:
return (herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD); return herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD;
case BANANA: case BANANA:
return ((mptr->mlet == S_YETI) return (mptr->mlet == S_YETI)
? DOGFOOD ? DOGFOOD
: ((herbi || starving) ? ACCFOOD : MANFOOD)); : (herbi || starving)
? ACCFOOD
: MANFOOD;
default: default:
if (starving) if (starving)
return ACCFOOD; return ACCFOOD;
return (obj->otyp > SLIME_MOLD ? (carni ? ACCFOOD : MANFOOD) return (obj->otyp > SLIME_MOLD) ? (carni ? ACCFOOD : MANFOOD)
: (herbi ? ACCFOOD : MANFOOD)); : (herbi ? ACCFOOD : MANFOOD);
} }
default: default:
if (obj->otyp == AMULET_OF_STRANGULATION if (obj->otyp == AMULET_OF_STRANGULATION
|| obj->otyp == RIN_SLOW_DIGESTION) || obj->otyp == RIN_SLOW_DIGESTION)
return TABU; return TABU;
if (mon_hates_silver(mon) && objects[obj->otyp].oc_material == SILVER) if (mon_hates_silver(mon) && objects[obj->otyp].oc_material == SILVER)
return (TABU); return TABU;
if (mptr == &mons[PM_GELATINOUS_CUBE] && is_organic(obj)) if (mptr == &mons[PM_GELATINOUS_CUBE] && is_organic(obj))
return (ACCFOOD); return ACCFOOD;
if (metallivorous(mptr) && is_metallic(obj) if (metallivorous(mptr) && is_metallic(obj)
&& (is_rustprone(obj) || mptr != &mons[PM_RUST_MONSTER])) { && (is_rustprone(obj) || mptr != &mons[PM_RUST_MONSTER])) {
/* Non-rustproofed ferrous based metals are preferred. */ /* Non-rustproofed ferrous based metals are preferred. */
return ((is_rustprone(obj) && !obj->oerodeproof) ? DOGFOOD return (is_rustprone(obj) && !obj->oerodeproof) ? DOGFOOD
: ACCFOOD); : ACCFOOD;
} }
if (!obj->cursed && obj->oclass != BALL_CLASS if (!obj->cursed
&& obj->oclass != BALL_CLASS
&& obj->oclass != CHAIN_CLASS) && obj->oclass != CHAIN_CLASS)
return (APPORT); return APPORT;
/* fall into next case */ /*FALLTHRU*/
case ROCK_CLASS: case ROCK_CLASS:
return (UNDEF); return UNDEF;
} }
} }
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dokick.c $NHDT-Date: 1446191875 2015/10/30 07:57:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.102 $ */ /* NetHack 3.6 dokick.c $NHDT-Date: 1446808441 2015/11/06 11:14:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -17,8 +17,8 @@ static NEARDATA const char *gate_str;
extern boolean notonhead; /* for long worms */ extern boolean notonhead; /* for long worms */
STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P)); STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P));
STATIC_DCL boolean STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *,
FDECL(maybe_kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); XCHAR_P, XCHAR_P));
STATIC_DCL void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); STATIC_DCL void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P));
STATIC_DCL int FDECL(kick_object, (XCHAR_P, XCHAR_P)); STATIC_DCL int FDECL(kick_object, (XCHAR_P, XCHAR_P));
STATIC_DCL int FDECL(really_kick_object, (XCHAR_P, XCHAR_P)); STATIC_DCL int FDECL(really_kick_object, (XCHAR_P, XCHAR_P));
+118 -83
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1445301123 2015/10/20 00:32:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */ /* NetHack 3.6 dungeon.c $NHDT-Date: 1446808442 2015/11/06 11:14:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -24,10 +24,11 @@ struct proto_dungeon {
int n_brs; /* number of tmpbranch entries */ int n_brs; /* number of tmpbranch entries */
}; };
int n_dgns; /* number of dungeons (also used */ int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
/* in mklev.c and do.c) */
static branch *branches = (branch *) 0; /* dungeon branch list */ static branch *branches = (branch *) 0; /* dungeon branch list */
mapseen *mapseenchn = (struct mapseen *) 0; /*DUNGEON_OVERVIEW*/
struct lchoice { struct lchoice {
int idx; int idx;
schar lev[MAXLINFO]; schar lev[MAXLINFO];
@@ -40,15 +41,15 @@ static void FDECL(Fread, (genericptr_t, int, int, dlb *));
STATIC_DCL xchar FDECL(dname_to_dnum, (const char *)); STATIC_DCL xchar FDECL(dname_to_dnum, (const char *));
STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *)); STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *));
STATIC_DCL xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); STATIC_DCL xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *));
STATIC_DCL int FDECL(level_range, STATIC_DCL int FDECL(level_range, (XCHAR_P, int, int, int,
(XCHAR_P, int, int, int, struct proto_dungeon *, int *)); struct proto_dungeon *, int *));
STATIC_DCL xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *)); STATIC_DCL xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *));
STATIC_DCL int FDECL(correct_branch_type, (struct tmpbranch *)); STATIC_DCL int FDECL(correct_branch_type, (struct tmpbranch *));
STATIC_DCL branch *FDECL(add_branch, (int, int, struct proto_dungeon *)); STATIC_DCL branch *FDECL(add_branch, (int, int, struct proto_dungeon *));
STATIC_DCL void FDECL(add_level, (s_level *)); STATIC_DCL void FDECL(add_level, (s_level *));
STATIC_DCL void FDECL(init_level, (int, int, struct proto_dungeon *)); STATIC_DCL void FDECL(init_level, (int, int, struct proto_dungeon *));
STATIC_DCL int FDECL(possible_places, STATIC_DCL int FDECL(possible_places, (int, boolean *,
(int, boolean *, struct proto_dungeon *)); struct proto_dungeon *));
STATIC_DCL xchar FDECL(pick_level, (boolean *, int)); STATIC_DCL xchar FDECL(pick_level, (boolean *, int));
STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *)); STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *));
STATIC_DCL boolean FDECL(unplaced_floater, (struct dungeon *)); STATIC_DCL boolean FDECL(unplaced_floater, (struct dungeon *));
@@ -56,17 +57,15 @@ STATIC_DCL boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P));
STATIC_DCL void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *, STATIC_DCL void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *,
BOOLEAN_P)); BOOLEAN_P));
STATIC_DCL const char *FDECL(br_string, (int)); STATIC_DCL const char *FDECL(br_string, (int));
STATIC_DCL void FDECL(print_branch, STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P,
(winid, int, int, int, BOOLEAN_P, struct lchoice *)); struct lchoice *));
mapseen *mapseenchn = (struct mapseen *) 0;
STATIC_DCL mapseen *FDECL(load_mapseen, (int)); STATIC_DCL mapseen *FDECL(load_mapseen, (int));
STATIC_DCL void FDECL(save_mapseen, (int, mapseen *)); STATIC_DCL void FDECL(save_mapseen, (int, mapseen *));
STATIC_DCL mapseen *FDECL(find_mapseen, (d_level *)); STATIC_DCL mapseen *FDECL(find_mapseen, (d_level *));
STATIC_DCL void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P)); STATIC_DCL void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P));
STATIC_DCL boolean FDECL(interest_mapseen, (mapseen *)); STATIC_DCL boolean FDECL(interest_mapseen, (mapseen *));
STATIC_DCL void FDECL(traverse_mapseenchn, STATIC_DCL void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid,
(BOOLEAN_P, winid, int, int, int *)); int, int, int *));
STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *)); STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *));
STATIC_DCL const char *FDECL(br_string2, (branch *)); STATIC_DCL const char *FDECL(br_string2, (branch *));
STATIC_DCL const char *FDECL(endgamelevelname, (char *, int)); STATIC_DCL const char *FDECL(endgamelevelname, (char *, int));
@@ -326,7 +325,7 @@ struct proto_dungeon *pd;
*/ */
for (pdnum = 0; strcmp(pd->tmpdungeon[pdnum].name, s); pdnum++) for (pdnum = 0; strcmp(pd->tmpdungeon[pdnum].name, s); pdnum++)
if ((i -= pd->tmpdungeon[pdnum].branches) < 0) if ((i -= pd->tmpdungeon[pdnum].branches) < 0)
return (pdnum); return pdnum;
panic("parent_dnum: couldn't resolve branch."); panic("parent_dnum: couldn't resolve branch.");
/*NOT REACHED*/ /*NOT REACHED*/
@@ -704,7 +703,9 @@ struct level_map {
{ X_GOAL, &nemesis_level }, { X_GOAL, &nemesis_level },
{ "", (d_level *) 0 } }; { "", (d_level *) 0 } };
void init_dungeons() /* initialize the "dungeon" structs */ /* initialize the "dungeon" structs */
void
init_dungeons()
{ {
dlb *dgn_file; dlb *dgn_file;
register int i, cl = 0, cb = 0; register int i, cl = 0, cb = 0;
@@ -970,21 +971,25 @@ void init_dungeons() /* initialize the "dungeon" structs */
#endif #endif
} }
xchar dunlev(lev) /* return the level number for lev in *this* dungeon */ /* return the level number for lev in *this* dungeon */
xchar
dunlev(lev)
d_level *lev; d_level *lev;
{ {
return (lev->dlevel); return lev->dlevel;
} }
/* return the lowest level number for *this* dungeon */
xchar xchar
dunlevs_in_dungeon(lev) /* return the lowest level number for *this* dungeon*/ dunlevs_in_dungeon(lev)
d_level *lev; d_level *lev;
{ {
return (dungeons[lev->dnum].num_dunlevs); return dungeons[lev->dnum].num_dunlevs;
} }
/* return the lowest level explored in the game*/
xchar xchar
deepest_lev_reached(noquest) /* return the lowest level explored in the game*/ deepest_lev_reached(noquest)
boolean noquest; boolean noquest;
{ {
/* this function is used for three purposes: to provide a factor /* this function is used for three purposes: to provide a factor
@@ -1016,16 +1021,16 @@ boolean noquest;
if (depth(&tmp) > ret) if (depth(&tmp) > ret)
ret = depth(&tmp); ret = depth(&tmp);
} }
return ((xchar) ret); return (xchar) ret;
} }
/* return a bookkeeping level number for purpose of comparisons and /* return a bookkeeping level number for purpose of comparisons and
* save/restore */ save/restore */
xchar xchar
ledger_no(lev) ledger_no(lev)
d_level *lev; d_level *lev;
{ {
return ((xchar)(lev->dlevel + dungeons[lev->dnum].ledger_start)); return (xchar) (lev->dlevel + dungeons[lev->dnum].ledger_start);
} }
/* /*
@@ -1041,7 +1046,7 @@ d_level *lev;
xchar xchar
maxledgerno() maxledgerno()
{ {
return (xchar)(dungeons[n_dgns - 1].ledger_start return (xchar) (dungeons[n_dgns - 1].ledger_start
+ dungeons[n_dgns - 1].num_dunlevs); + dungeons[n_dgns - 1].num_dunlevs);
} }
@@ -1068,11 +1073,12 @@ xchar
ledger_to_dlev(ledgerno) ledger_to_dlev(ledgerno)
xchar ledgerno; xchar ledgerno;
{ {
return (xchar)(ledgerno - dungeons[ledger_to_dnum(ledgerno)].ledger_start); return (xchar) (ledgerno
- dungeons[ledger_to_dnum(ledgerno)].ledger_start);
} }
/* returns the depth of a level, in floors below the surface */ /* returns the depth of a level, in floors below the surface
/* (note levels in different dungeons can have the same depth). */ (note levels in different dungeons can have the same depth) */
schar schar
depth(lev) depth(lev)
d_level *lev; d_level *lev;
@@ -1085,8 +1091,8 @@ boolean
on_level(lev1, lev2) on_level(lev1, lev2)
d_level *lev1, *lev2; d_level *lev1, *lev2;
{ {
return (boolean) ((lev1->dnum == lev2->dnum) return (boolean) (lev1->dnum == lev2->dnum
&& (lev1->dlevel == lev2->dlevel)); && lev1->dlevel == lev2->dlevel);
} }
/* is this level referenced in the special level chain? */ /* is this level referenced in the special level chain? */
@@ -1098,7 +1104,7 @@ d_level *lev;
for (levtmp = sp_levchn; levtmp; levtmp = levtmp->next) for (levtmp = sp_levchn; levtmp; levtmp = levtmp->next)
if (on_level(lev, &levtmp->dlevel)) if (on_level(lev, &levtmp->dlevel))
return (levtmp); return levtmp;
return (s_level *) 0; return (s_level *) 0;
} }
@@ -1192,7 +1198,9 @@ int x, y;
u.ux0 = u.ux, u.uy0 = u.uy; u.ux0 = u.ux, u.uy0 = u.uy;
} }
void u_on_rndspot(upflag) /* place you on a random location */ /* place you on a random location */
void
u_on_rndspot(upflag)
int upflag; int upflag;
{ {
int up = (upflag & 1), was_in_W_tower = (upflag & 2); int up = (upflag & 1), was_in_W_tower = (upflag & 2);
@@ -1220,7 +1228,9 @@ int upflag;
(d_level *) 0); (d_level *) 0);
} }
void u_on_sstairs(upflag) /* place you on the special staircase */ /* place you on the special staircase */
void
u_on_sstairs(upflag)
int upflag; int upflag;
{ {
if (sstairs.sx) if (sstairs.sx)
@@ -1229,7 +1239,9 @@ int upflag;
u_on_rndspot(upflag); u_on_rndspot(upflag);
} }
void u_on_upstairs() /* place you on upstairs (or special equivalent) */ /* place you on upstairs (or special equivalent) */
void
u_on_upstairs()
{ {
if (xupstair) if (xupstair)
u_on_newpos(xupstair, yupstair); u_on_newpos(xupstair, yupstair);
@@ -1237,7 +1249,9 @@ void u_on_upstairs() /* place you on upstairs (or special equivalent) */
u_on_sstairs(0); /* destination upstairs implies moving down */ u_on_sstairs(0); /* destination upstairs implies moving down */
} }
void u_on_dnstairs() /* place you on dnstairs (or special equivalent) */ /* place you on dnstairs (or special equivalent) */
void
u_on_dnstairs()
{ {
if (xdnstair) if (xdnstair)
u_on_newpos(xdnstair, ydnstair); u_on_newpos(xdnstair, ydnstair);
@@ -1249,26 +1263,27 @@ boolean
On_stairs(x, y) On_stairs(x, y)
xchar x, y; xchar x, y;
{ {
return ((boolean)((x == xupstair && y == yupstair) return (boolean) ((x == xupstair && y == yupstair)
|| (x == xdnstair && y == ydnstair) || (x == xdnstair && y == ydnstair)
|| (x == xdnladder && y == ydnladder) || (x == xdnladder && y == ydnladder)
|| (x == xupladder && y == yupladder) || (x == xupladder && y == yupladder)
|| (x == sstairs.sx && y == sstairs.sy))); || (x == sstairs.sx && y == sstairs.sy));
} }
boolean boolean
Is_botlevel(lev) Is_botlevel(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(lev->dlevel == dungeons[lev->dnum].num_dunlevs)); return (boolean) (lev->dlevel == dungeons[lev->dnum].num_dunlevs);
} }
boolean boolean
Can_dig_down(lev) Can_dig_down(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(!level.flags.hardfloor && !Is_botlevel(lev) return (boolean) (!level.flags.hardfloor
&& !Invocation_lev(lev))); && !Is_botlevel(lev)
&& !Invocation_lev(lev));
} }
/* /*
@@ -1280,7 +1295,7 @@ boolean
Can_fall_thru(lev) Can_fall_thru(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(Can_dig_down(lev) || Is_stronghold(lev))); return (boolean) (Can_dig_down(lev) || Is_stronghold(lev));
} }
/* /*
@@ -1299,9 +1314,10 @@ d_level *lev;
if (In_endgame(lev) || In_sokoban(lev) if (In_endgame(lev) || In_sokoban(lev)
|| (Is_wiz1_level(lev) && In_W_tower(x, y, lev))) || (Is_wiz1_level(lev) && In_W_tower(x, y, lev)))
return FALSE; return FALSE;
return (boolean)(lev->dlevel > 1 return (boolean) (lev->dlevel > 1
|| (dungeons[lev->dnum].entry_lev == 1 || (dungeons[lev->dnum].entry_lev == 1
&& ledger_no(lev) != 1 && sstairs.sx && sstairs.up)); && ledger_no(lev) != 1
&& sstairs.sx && sstairs.up));
} }
boolean boolean
@@ -1309,7 +1325,7 @@ has_ceiling(lev)
d_level *lev; d_level *lev;
{ {
/* [what about level 1 of the quest?] */ /* [what about level 1 of the quest?] */
return (!Is_airlevel(lev) && !Is_waterlevel(lev)); return (boolean) (!Is_airlevel(lev) && !Is_waterlevel(lev));
} }
/* /*
@@ -1371,16 +1387,20 @@ int levnum;
newlevel->dlevel = levnum; newlevel->dlevel = levnum;
} }
boolean In_quest(lev) /* are you in the quest dungeon? */ /* are you in the quest dungeon? */
boolean
In_quest(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(lev->dnum == quest_dnum)); return (boolean) (lev->dnum == quest_dnum);
} }
boolean In_mines(lev) /* are you in the mines dungeon? */ /* are you in the mines dungeon? */
boolean
In_mines(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(lev->dnum == mines_dnum)); return (boolean) (lev->dnum == mines_dnum);
} }
/* /*
@@ -1426,25 +1446,30 @@ const char *s;
branch *br; branch *br;
br = dungeon_branch(s); br = dungeon_branch(s);
return ((boolean)(on_level(&u.uz, &br->end1) ? TRUE : FALSE)); return on_level(&u.uz, &br->end1) ? TRUE : FALSE;
}
boolean In_V_tower(lev) /* is `lev' part of Vlad's tower? */
d_level *lev;
{
return ((boolean)(lev->dnum == tower_dnum));
} }
/* is `lev' part of Vlad's tower? */
boolean boolean
On_W_tower_level(lev) /* is `lev' a level containing the Wizard's tower? */ In_V_tower(lev)
d_level *lev; d_level *lev;
{ {
return (boolean)(Is_wiz1_level(lev) || Is_wiz2_level(lev) return (boolean) (lev->dnum == tower_dnum);
}
/* is `lev' a level containing the Wizard's tower? */
boolean
On_W_tower_level(lev)
d_level *lev;
{
return (boolean) (Is_wiz1_level(lev)
|| Is_wiz2_level(lev)
|| Is_wiz3_level(lev)); || Is_wiz3_level(lev));
} }
boolean In_W_tower(x, y, /* is <x,y> of `lev' inside the Wizard's tower? */
lev) /* is <x,y> of `lev' inside the Wizard's tower? */ boolean
In_W_tower(x, y, lev)
int x, y; int x, y;
d_level *lev; d_level *lev;
{ {
@@ -1463,20 +1488,26 @@ d_level *lev;
return FALSE; return FALSE;
} }
boolean In_hell(lev) /* are you in one of the Hell levels? */ /* are you in one of the Hell levels? */
boolean
In_hell(lev)
d_level *lev; d_level *lev;
{ {
return ((boolean)(dungeons[lev->dnum].flags.hellish)); return (boolean) (dungeons[lev->dnum].flags.hellish);
} }
void find_hell(lev) /* sets *lev to be the gateway to Gehennom... */ /* sets *lev to be the gateway to Gehennom... */
void
find_hell(lev)
d_level *lev; d_level *lev;
{ {
lev->dnum = valley_level.dnum; lev->dnum = valley_level.dnum;
lev->dlevel = 1; lev->dlevel = 1;
} }
void goto_hell(at_stairs, falling) /* go directly to hell... */ /* go directly to hell... */
void
goto_hell(at_stairs, falling)
boolean at_stairs, falling; boolean at_stairs, falling;
{ {
d_level lev; d_level lev;
@@ -1485,14 +1516,18 @@ boolean at_stairs, falling;
goto_level(&lev, at_stairs, falling, FALSE); goto_level(&lev, at_stairs, falling, FALSE);
} }
void assign_level(dest, src) /* equivalent to dest = source */ /* equivalent to dest = source */
void
assign_level(dest, src)
d_level *dest, *src; d_level *dest, *src;
{ {
dest->dnum = src->dnum; dest->dnum = src->dnum;
dest->dlevel = src->dlevel; dest->dlevel = src->dlevel;
} }
void assign_rnd_level(dest, src, range) /* dest = src + rn1(range) */ /* dest = src + rn1(range) */
void
assign_rnd_level(dest, src, range)
d_level *dest, *src; d_level *dest, *src;
int range; int range;
{ {
@@ -1514,23 +1549,22 @@ int pct;
if (lev && lev->flags.align) if (lev && lev->flags.align)
if (rn2(100) < pct) if (rn2(100) < pct)
return (lev->flags.align); return lev->flags.align;
if (dungeons[u.uz.dnum].flags.align) if (dungeons[u.uz.dnum].flags.align)
if (rn2(100) < pct) if (rn2(100) < pct)
return (dungeons[u.uz.dnum].flags.align); return dungeons[u.uz.dnum].flags.align;
al = rn2(3) - 1; al = rn2(3) - 1;
return (Align2amask(al)); return Align2amask(al);
} }
boolean boolean
Invocation_lev(lev) Invocation_lev(lev)
d_level *lev; d_level *lev;
{ {
return ( return (boolean) (In_hell(lev)
(boolean)(In_hell(lev) && lev->dlevel == dungeons[lev->dnum].num_dunlevs - 1);
&& lev->dlevel == (dungeons[lev->dnum].num_dunlevs - 1)));
} }
/* use instead of depth() wherever a degree of difficulty is made /* use instead of depth() wherever a degree of difficulty is made
@@ -2155,11 +2189,7 @@ d_level *lev;
#define INTEREST(feat) \ #define INTEREST(feat) \
((feat).nfount || (feat).nsink || (feat).nthrone || (feat).naltar \ ((feat).nfount || (feat).nsink || (feat).nthrone || (feat).naltar \
|| (feat).ngrave || (feat).ntree || (feat).nshop || (feat).ntemple) || (feat).ngrave || (feat).ntree || (feat).nshop || (feat).ntemple)
/* /* || (feat).water || (feat).ice || (feat).lava */
|| ((feat).water) || \
((feat).ice) || \
((feat).lava)
*/
/* returns true if this level has something interesting to print out */ /* returns true if this level has something interesting to print out */
STATIC_OVL boolean STATIC_OVL boolean
@@ -2187,14 +2217,16 @@ mapseen *mptr;
have annotations or not, so that #overview doesn't become extremely have annotations or not, so that #overview doesn't become extremely
sparse once the rest of the dungeon has been flagged as unreachable */ sparse once the rest of the dungeon has been flagged as unreachable */
if (In_endgame(&u.uz)) if (In_endgame(&u.uz))
return In_endgame(&mptr->lev); return (boolean) In_endgame(&mptr->lev);
/* level is of interest if it has non-zero feature count or known bones /* level is of interest if it has non-zero feature count or known bones
or user annotation or known connection to another dungeon branch or user annotation or known connection to another dungeon branch
or is the furthest level reached in its branch */ or is the furthest level reached in its branch */
return (INTEREST(mptr->feat) || (mptr->final_resting_place return (boolean) (INTEREST(mptr->feat)
|| (mptr->final_resting_place
&& (mptr->flags.knownbones || wizard)) && (mptr->flags.knownbones || wizard))
|| mptr->custom || mptr->br || mptr->custom || mptr->br
|| mptr->lev.dlevel == dungeons[mptr->lev.dnum].dunlev_ureached); || (mptr->lev.dlevel
== dungeons[mptr->lev.dnum].dunlev_ureached));
} }
/* recalculate mapseen for the current level */ /* recalculate mapseen for the current level */
@@ -2331,17 +2363,20 @@ recalc_mapseen()
#if 0 #if 0
case ICE: case ICE:
count = mptr->feat.ice + 1; count = mptr->feat.ice + 1;
if (count <= 3) mptr->feat.ice = count; if (count <= 3)
mptr->feat.ice = count;
break; break;
case POOL: case POOL:
case MOAT: case MOAT:
case WATER: case WATER:
count = mptr->feat.water + 1; count = mptr->feat.water + 1;
if (count <= 3) mptr->feat.water = count; if (count <= 3)
mptr->feat.water = count;
break; break;
case LAVAPOOL: case LAVAPOOL:
count = mptr->feat.lava + 1; count = mptr->feat.lava + 1;
if (count <= 3) mptr->feat.lava = count; if (count <= 3)
mptr->feat.lava = count;
break; break;
#endif #endif
case TREE: case TREE:
@@ -2547,9 +2582,9 @@ branch *br;
case BR_NO_END1: case BR_NO_END1:
return "Connection"; return "Connection";
case BR_NO_END2: case BR_NO_END2:
return (br->end1_up) ? "One way stairs up" : "One way stairs down"; return br->end1_up ? "One way stairs up" : "One way stairs down";
case BR_STAIR: case BR_STAIR:
return (br->end1_up) ? "Stairs up" : "Stairs down"; return br->end1_up ? "Stairs up" : "Stairs down";
} }
return "(unknown)"; return "(unknown)";
+33 -33
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1446189655 2015/10/30 07:20:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.150 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1446808443 2015/11/06 11:14:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -653,6 +653,7 @@ register int pm;
case PM_KITTEN: case PM_KITTEN:
case PM_HOUSECAT: case PM_HOUSECAT:
case PM_LARGE_CAT: case PM_LARGE_CAT:
/* cannibals are allowed to eat domestic animals without penalty */
if (!CANNIBAL_ALLOWED()) { if (!CANNIBAL_ALLOWED()) {
You_feel("that eating the %s was a bad idea.", mons[pm].mname); You_feel("that eating the %s was a bad idea.", mons[pm].mname);
HAggravate_monster |= FROMOUTSIDE; HAggravate_monster |= FROMOUTSIDE;
@@ -956,21 +957,20 @@ register int pm;
HSee_invisible |= FROMOUTSIDE; HSee_invisible |= FROMOUTSIDE;
} }
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
/* fall into next case */ /*FALLTHRU*/
case PM_YELLOW_LIGHT: case PM_YELLOW_LIGHT:
/* fall into next case */
case PM_GIANT_BAT: case PM_GIANT_BAT:
make_stunned((HStun & TIMEOUT) + 30L, FALSE); make_stunned((HStun & TIMEOUT) + 30L, FALSE);
/* fall into next case */ /*FALLTHRU*/
case PM_BAT: case PM_BAT:
make_stunned((HStun & TIMEOUT) + 30L, FALSE); make_stunned((HStun & TIMEOUT) + 30L, FALSE);
break; break;
case PM_GIANT_MIMIC: case PM_GIANT_MIMIC:
tmp += 10; tmp += 10;
/* fall into next case */ /*FALLTHRU*/
case PM_LARGE_MIMIC: case PM_LARGE_MIMIC:
tmp += 20; tmp += 20;
/* fall into next case */ /*FALLTHRU*/
case PM_SMALL_MIMIC: case PM_SMALL_MIMIC:
tmp += 20; tmp += 20;
if (youmonst.data->mlet != S_MIMIC && !Unchanging) { if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
@@ -984,8 +984,7 @@ register int pm;
dismount_steed(DISMOUNT_FELL); dismount_steed(DISMOUNT_FELL);
nomul(-tmp); nomul(-tmp);
multi_reason = "pretending to be a pile of gold"; multi_reason = "pretending to be a pile of gold";
Sprintf( Sprintf(buf,
buf,
Hallucination Hallucination
? "You suddenly dread being peeled and mimic %s again!" ? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.", : "You now prefer mimicking %s again.",
@@ -1548,6 +1547,7 @@ struct obj *otmp;
if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) { if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
boolean cannibal = maybe_cannibal(mnum, FALSE); boolean cannibal = maybe_cannibal(mnum, FALSE);
pline("Ulch - that %s was tainted%s!", pline("Ulch - that %s was tainted%s!",
mons[mnum].mlet == S_FUNGUS mons[mnum].mlet == S_FUNGUS
? "fungoid vegetation" ? "fungoid vegetation"
@@ -1619,15 +1619,15 @@ struct obj *otmp;
You("peck the eyeball with delight."); You("peck the eyeball with delight.");
} else { } else {
/* [is this right? omnivores end up always disliking the taste] */ /* [is this right? omnivores end up always disliking the taste] */
boolean yummy = boolean yummy = vegan(&mons[mnum])
(vegan(&mons[mnum]) ? (!carnivorous(youmonst.data)
? (!carnivorous(youmonst.data) && herbivorous(youmonst.data)) && herbivorous(youmonst.data))
: (carnivorous(youmonst.data) : (carnivorous(youmonst.data)
&& !herbivorous(youmonst.data))); && !herbivorous(youmonst.data));
pline("%s%s %s!", type_is_pname(&mons[mnum]) pline("%s%s %s!",
? "" type_is_pname(&mons[mnum])
: the_unique_pm(&mons[mnum]) ? "The " : "This ", ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
food_xname(otmp, FALSE), food_xname(otmp, FALSE),
Hallucination Hallucination
? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat" ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
@@ -1886,8 +1886,9 @@ struct obj *otmp;
makeknown(typ); makeknown(typ);
} }
break; break;
} } /* inner switch */
break; break; /* default case of outer switch */
case RIN_ADORNMENT: case RIN_ADORNMENT:
accessory_has_effect(otmp); accessory_has_effect(otmp);
if (adjattrib(A_CHA, otmp->spe, -1)) if (adjattrib(A_CHA, otmp->spe, -1))
@@ -1916,8 +1917,8 @@ struct obj *otmp;
case RIN_PROTECTION: case RIN_PROTECTION:
accessory_has_effect(otmp); accessory_has_effect(otmp);
HProtection |= FROMOUTSIDE; HProtection |= FROMOUTSIDE;
u.ublessed = u.ublessed = bounded_increase(u.ublessed, otmp->spe,
bounded_increase(u.ublessed, otmp->spe, RIN_PROTECTION); RIN_PROTECTION);
context.botl = 1; context.botl = 1;
break; break;
case RIN_FREE_ACTION: case RIN_FREE_ACTION:
@@ -1948,8 +1949,7 @@ struct obj *otmp;
/* no message--this gives no permanent effect */ /* no message--this gives no permanent effect */
choke(otmp); choke(otmp);
break; break;
case AMULET_OF_RESTFUL_SLEEP: /* another bad idea! */ case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
{
long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT); long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
if (!(HSleepy & FROMOUTSIDE)) if (!(HSleepy & FROMOUTSIDE))
@@ -1958,7 +1958,8 @@ struct obj *otmp;
/* might also be wearing one; use shorter of two timeouts */ /* might also be wearing one; use shorter of two timeouts */
if (newnap < oldnap || oldnap == 0L) if (newnap < oldnap || oldnap == 0L)
HSleepy = (HSleepy & ~TIMEOUT) | newnap; HSleepy = (HSleepy & ~TIMEOUT) | newnap;
} break; break;
}
case RIN_SUSTAIN_ABILITY: case RIN_SUSTAIN_ABILITY:
case AMULET_OF_LIFE_SAVING: case AMULET_OF_LIFE_SAVING:
case AMULET_OF_REFLECTION: /* nice try */ case AMULET_OF_REFLECTION: /* nice try */
@@ -2171,12 +2172,12 @@ STATIC_OVL int
edibility_prompts(otmp) edibility_prompts(otmp)
struct obj *otmp; struct obj *otmp;
{ {
/* blessed food detection granted you a one-use /* Blessed food detection grants hero a one-use
ability to detect food that is unfit for consumption * ability to detect food that is unfit for consumption
or dangerous and avoid it. */ * or dangerous and avoid it.
*/
char buf[BUFSZ], foodsmell[BUFSZ], it_or_they[QBUFSZ], char buf[BUFSZ], foodsmell[BUFSZ],
eat_it_anyway[QBUFSZ]; it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE; boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm; int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
long rotted = 0L; long rotted = 0L;
@@ -2210,7 +2211,6 @@ struct obj *otmp;
* These problems with food should be checked in * These problems with food should be checked in
* order from most detrimental to least detrimental. * order from most detrimental to least detrimental.
*/ */
if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) { if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
/* Tainted meat */ /* Tainted meat */
Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they, Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
@@ -2334,8 +2334,8 @@ doeat()
if (u.uedibility) { if (u.uedibility) {
int res = edibility_prompts(otmp); int res = edibility_prompts(otmp);
if (res) { if (res) {
Your("%s stops tingling and your sense of smell returns to " Your(
"normal.", "%s stops tingling and your sense of smell returns to normal.",
body_part(NOSE)); body_part(NOSE));
u.uedibility = 0; u.uedibility = 0;
if (res == 1) if (res == 1)
@@ -2564,8 +2564,8 @@ doeat()
/* possible if most has been eaten before */ /* possible if most has been eaten before */
context.victual.nmod = 0; context.victual.nmod = 0;
else if ((int) otmp->oeaten >= context.victual.reqtime) else if ((int) otmp->oeaten >= context.victual.reqtime)
context.victual.nmod = context.victual.nmod = -((int) otmp->oeaten
-((int) otmp->oeaten / context.victual.reqtime); / context.victual.reqtime);
else else
context.victual.nmod = context.victual.reqtime % otmp->oeaten; context.victual.nmod = context.victual.reqtime % otmp->oeaten;
context.victual.canchoke = (u.uhs == SATIATED); context.victual.canchoke = (u.uhs == SATIATED);
+15 -14
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1446604112 2015/11/04 02:28:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */ /* NetHack 3.6 lock.c $NHDT-Date: 1446808444 2015/11/06 11:14:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -45,10 +45,12 @@ STATIC_OVL const char *
lock_action() lock_action()
{ {
/* "unlocking"+2 == "locking" */ /* "unlocking"+2 == "locking" */
static const char *actions[] = { /* [0] */ "unlocking the door", static const char *actions[] = {
/* [1] */ "unlocking the chest", "unlocking the door", /* [0] */
/* [2] */ "unlocking the box", "unlocking the chest", /* [1] */
/* [3] */ "picking the lock" }; "unlocking the box", /* [2] */
"picking the lock" /* [3] */
};
/* if the target is currently unlocked, we're trying to lock it now */ /* if the target is currently unlocked, we're trying to lock it now */
if (xlock.door && !(xlock.door->doormask & D_LOCKED)) if (xlock.door && !(xlock.door->doormask & D_LOCKED))
@@ -191,7 +193,6 @@ forcelock(VOID_ARGS)
} }
if (xlock.picktyp) { /* blade */ if (xlock.picktyp) { /* blade */
if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10) if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10)
&& !uwep->cursed && !obj_resists(uwep, 0, 99)) { && !uwep->cursed && !obj_resists(uwep, 0, 99)) {
/* for a +0 weapon, probability that it survives an unsuccessful /* for a +0 weapon, probability that it survives an unsuccessful
@@ -530,13 +531,6 @@ doforce()
return 1; return 1;
} }
/* try to open a door */
int
doopen()
{
return doopen_indir(0, 0);
}
boolean boolean
stumble_on_door_mimic(x, y) stumble_on_door_mimic(x, y)
int x, y; int x, y;
@@ -551,6 +545,13 @@ int x, y;
return FALSE; return FALSE;
} }
/* the 'O' command - try to open a door */
int
doopen()
{
return doopen_indir(0, 0);
}
/* try to open a door in direction u.dx/u.dy */ /* try to open a door in direction u.dx/u.dy */
int int
doopen_indir(x, y) doopen_indir(x, y)
@@ -694,7 +695,7 @@ boolean quietly;
return FALSE; return FALSE;
} }
/* try to close a door */ /* the 'C' command - try to close a door */
int int
doclose() doclose()
{ {
+79 -76
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1445556868 2015/10/22 23:34:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */ /* NetHack 3.6 makemon.c $NHDT-Date: 1446808445 2015/11/06 11:14:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.100 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -33,7 +33,7 @@ extern const int monstr[];
boolean boolean
is_home_elemental(ptr) is_home_elemental(ptr)
register struct permonst *ptr; struct permonst *ptr;
{ {
if (ptr->mlet == S_ELEMENTAL) if (ptr->mlet == S_ELEMENTAL)
switch (monsndx(ptr)) { switch (monsndx(ptr)) {
@@ -54,10 +54,10 @@ register struct permonst *ptr;
*/ */
STATIC_OVL boolean STATIC_OVL boolean
wrong_elem_type(ptr) wrong_elem_type(ptr)
register struct permonst *ptr; struct permonst *ptr;
{ {
if (ptr->mlet == S_ELEMENTAL) { if (ptr->mlet == S_ELEMENTAL) {
return ((boolean)(!is_home_elemental(ptr))); return (boolean) !is_home_elemental(ptr);
} else if (Is_earthlevel(&u.uz)) { } else if (Is_earthlevel(&u.uz)) {
/* no restrictions? */ /* no restrictions? */
} else if (Is_waterlevel(&u.uz)) { } else if (Is_waterlevel(&u.uz)) {
@@ -75,7 +75,9 @@ register struct permonst *ptr;
return FALSE; return FALSE;
} }
STATIC_OVL void m_initgrp(mtmp, x, y, n) /* make a group just like mtmp */ /* make a group just like mtmp */
STATIC_OVL void
m_initgrp(mtmp, x, y, n)
register struct monst *mtmp; register struct monst *mtmp;
register int x, y, n; register int x, y, n;
{ {
@@ -165,17 +167,17 @@ register struct monst *mtmp;
register struct permonst *ptr = mtmp->data; register struct permonst *ptr = mtmp->data;
register int mm = monsndx(ptr); register int mm = monsndx(ptr);
struct obj *otmp; struct obj *otmp;
int bias, spe2, w1, w2;
if (Is_rogue_level(&u.uz)) if (Is_rogue_level(&u.uz))
return; return;
/* /*
* first a few special cases: * First a few special cases:
* * giants get a boulder to throw sometimes
* giants get a boulder to throw sometimes.
* ettins get clubs * ettins get clubs
* kobolds get darts to throw * kobolds get darts to throw
* centaurs get some sort of bow & arrows or bolts * centaurs get some sort of bow & arrows or bolts
* soldiers get all sorts of things. * soldiers get all sorts of things
* kops get clubs & cream pies. * kops get clubs & cream pies.
*/ */
switch (ptr->mlet) { switch (ptr->mlet) {
@@ -185,7 +187,7 @@ register struct monst *mtmp;
break; break;
case S_HUMAN: case S_HUMAN:
if (is_mercenary(ptr)) { if (is_mercenary(ptr)) {
int w1 = 0, w2 = 0; w1 = w2 = 0;
switch (mm) { switch (mm) {
case PM_WATCHMAN: case PM_WATCHMAN:
case PM_SOLDIER: case PM_SOLDIER:
@@ -272,8 +274,6 @@ register struct monst *mtmp;
case S_ANGEL: case S_ANGEL:
if (humanoid(ptr)) { if (humanoid(ptr)) {
int spe2;
/* create minion stuff; can't use mongets */ /* create minion stuff; can't use mongets */
otmp = mksobj(LONG_SWORD, FALSE, FALSE); otmp = mksobj(LONG_SWORD, FALSE, FALSE);
@@ -336,9 +336,9 @@ register struct monst *mtmp;
} }
} }
break; break;
case S_KOP: /* create Keystone Kops with cream pies to case S_KOP:
* throw. As suggested by KAA. [MRS] /* create Keystone Kops with cream pies to
*/ throw. As suggested by KAA. [MRS] */
if (!rn2(4)) if (!rn2(4))
m_initthrow(mtmp, CREAM_PIE, 2); m_initthrow(mtmp, CREAM_PIE, 2);
if (!rn2(3)) if (!rn2(3))
@@ -347,8 +347,8 @@ register struct monst *mtmp;
case S_ORC: case S_ORC:
if (rn2(2)) if (rn2(2))
(void) mongets(mtmp, ORCISH_HELM); (void) mongets(mtmp, ORCISH_HELM);
switch (mm != PM_ORC_CAPTAIN ? mm : rn2(2) ? PM_MORDOR_ORC switch ((mm != PM_ORC_CAPTAIN) ? mm
: PM_URUK_HAI) { : rn2(2) ? PM_MORDOR_ORC : PM_URUK_HAI) {
case PM_MORDOR_ORC: case PM_MORDOR_ORC:
if (!rn2(3)) if (!rn2(3))
(void) mongets(mtmp, SCIMITAR); (void) mongets(mtmp, SCIMITAR);
@@ -458,15 +458,13 @@ register struct monst *mtmp;
*/ */
if (!is_demon(ptr)) if (!is_demon(ptr))
break; break;
/* fall thru */ /*FALLTHRU*/
default:
/* /*
* Now the general case, Some chance of getting some type * Now the general case, some chance of getting some type
* of weapon for "normal" monsters. Certain special types * of weapon for "normal" monsters. Certain special types
* of monsters will get a bonus chance or different selections. * of monsters will get a bonus chance or different selections.
*/ */
default: {
int bias;
bias = is_lord(ptr) + is_prince(ptr) * 2 + extra_nasty(ptr); bias = is_lord(ptr) + is_prince(ptr) * 2 + extra_nasty(ptr);
switch (rnd(14 - (2 * bias))) { switch (rnd(14 - (2 * bias))) {
case 1: case 1:
@@ -502,8 +500,9 @@ register struct monst *mtmp;
default: default:
break; break;
} }
} break; break;
} }
if ((int) mtmp->m_lev > rn2(75)) if ((int) mtmp->m_lev > rn2(75))
(void) mongets(mtmp, rnd_offensive_item(mtmp)); (void) mongets(mtmp, rnd_offensive_item(mtmp));
} }
@@ -518,6 +517,7 @@ struct monst *mtmp;
long amount; long amount;
{ {
struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE); struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE);
gold->quan = amount; gold->quan = amount;
add_to_minv(mtmp, gold); add_to_minv(mtmp, gold);
} }
@@ -529,6 +529,7 @@ register struct monst *mtmp;
register int cnt; register int cnt;
register struct obj *otmp; register struct obj *otmp;
register struct permonst *ptr = mtmp->data; register struct permonst *ptr = mtmp->data;
if (Is_rogue_level(&u.uz)) if (Is_rogue_level(&u.uz))
return; return;
/* /*
@@ -842,8 +843,7 @@ boolean ghostly;
{ {
boolean result; boolean result;
uchar lim = mbirth_limit(mndx); uchar lim = mbirth_limit(mndx);
boolean gone = boolean gone = (mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
(mvitals[mndx].mvflags & G_GONE); /* genocided or extinct */
result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE; result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE;
@@ -944,7 +944,6 @@ newmextra()
return mextra; return mextra;
} }
boolean boolean
makemon_rnd_goodpos(mon, gpflags, cc) makemon_rnd_goodpos(mon, gpflags, cc)
struct monst *mon; struct monst *mon;
@@ -954,12 +953,14 @@ coord *cc;
int tryct = 0; int tryct = 0;
int nx,ny; int nx,ny;
boolean good; boolean good;
do { do {
nx = rn1(COLNO - 3, 2); nx = rn1(COLNO - 3, 2);
ny = rn2(ROWNO); ny = rn2(ROWNO);
if (!in_mklev && cansee(nx,ny)) good = FALSE; good = (!in_mklev && cansee(nx,ny)) ? FALSE
else good = goodpos(nx, ny, mon, gpflags); : goodpos(nx, ny, mon, gpflags);
} while ((++tryct < 50) && !good); } while ((++tryct < 50) && !good);
if (!good) { if (!good) {
/* else go through all map positions, twice, first round /* else go through all map positions, twice, first round
ignoring positions in sight, and pick first good one. ignoring positions in sight, and pick first good one.
@@ -968,12 +969,14 @@ coord *cc;
int yofs = ny; int yofs = ny;
int dx,dy; int dx,dy;
int bl = (in_mklev || Blind) ? 1 : 0; int bl = (in_mklev || Blind) ? 1 : 0;
for ( ; bl < 2; bl++) { for ( ; bl < 2; bl++) {
for (dx = 0; dx < COLNO; dx++) for (dx = 0; dx < COLNO; dx++)
for (dy = 0; dy < ROWNO; dy++) { for (dy = 0; dy < ROWNO; dy++) {
nx = ((dx + xofs) % (COLNO - 1)) + 1; nx = ((dx + xofs) % (COLNO - 1)) + 1;
ny = ((dy + yofs) % (ROWNO - 1)) + 1; ny = ((dy + yofs) % (ROWNO - 1)) + 1;
if ((bl == 0) && cansee(nx,ny)) continue; if (bl == 0 && cansee(nx,ny))
continue;
if (goodpos(nx, ny, mon, gpflags)) if (goodpos(nx, ny, mon, gpflags))
goto gotgood; goto gotgood;
} }
@@ -1017,7 +1020,7 @@ struct monst *
makemon(ptr, x, y, mmflags) makemon(ptr, x, y, mmflags)
register struct permonst *ptr; register struct permonst *ptr;
register int x, y; register int x, y;
register int mmflags; int mmflags;
{ {
register struct monst *mtmp; register struct monst *mtmp;
int mndx, mcham, ct, mitem; int mndx, mcham, ct, mitem;
@@ -1033,8 +1036,9 @@ register int mmflags;
struct monst fakemon; struct monst fakemon;
fakemon.data = ptr; /* set up for goodpos */ fakemon.data = ptr; /* set up for goodpos */
if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0, gpflags, &cc)) if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0,
return ((struct monst *) 0); gpflags, &cc))
return (struct monst *) 0;
x = cc.x; x = cc.x;
y = cc.y; y = cc.y;
} else if (byyou && !in_mklev) { } else if (byyou && !in_mklev) {
@@ -1044,7 +1048,7 @@ register int mmflags;
x = bypos.x; x = bypos.x;
y = bypos.y; y = bypos.y;
} else } else
return ((struct monst *) 0); return (struct monst *) 0;
} }
/* Does monster already exist at the position? */ /* Does monster already exist at the position? */
@@ -1055,9 +1059,9 @@ register int mmflags;
x = bypos.x; x = bypos.x;
y = bypos.y; y = bypos.y;
} else } else
return ((struct monst *) 0); return (struct monst *) 0;
} else } else
return ((struct monst *) 0); return (struct monst *) 0;
} }
if (ptr) { if (ptr) {
@@ -1065,7 +1069,7 @@ register int mmflags;
/* if you are to make a specific monster and it has /* if you are to make a specific monster and it has
already been genocided, return */ already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) if (mvitals[mndx].mvflags & G_GENOD)
return ((struct monst *) 0); return (struct monst *) 0;
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT)) if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
debugpline1("Explicitly creating extinct monster %s.", debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname); mons[mndx].mname);
@@ -1081,7 +1085,7 @@ register int mmflags;
do { do {
if (!(ptr = rndmonst())) { if (!(ptr = rndmonst())) {
debugpline0("Warning: no monster."); debugpline0("Warning: no monster.");
return ((struct monst *) 0); /* no more monsters! */ return (struct monst *) 0; /* no more monsters! */
} }
fakemon.data = ptr; /* set up for goodpos */ fakemon.data = ptr; /* set up for goodpos */
} while (++tryct <= 50 } while (++tryct <= 50
@@ -1227,8 +1231,9 @@ register int mmflags;
(void) mongets(mtmp, mitem); (void) mongets(mtmp, mitem);
if (in_mklev) { if (in_mklev) {
if (((is_ndemon(ptr)) || (mndx == PM_WUMPUS) || (mndx == PM_LONG_WORM) if ((is_ndemon(ptr) || mndx == PM_WUMPUS
|| (mndx == PM_GIANT_EEL)) && !u.uhave.amulet && rn2(5)) || mndx == PM_LONG_WORM || mndx == PM_GIANT_EEL)
&& !u.uhave.amulet && rn2(5))
mtmp->msleeping = TRUE; mtmp->msleeping = TRUE;
} else { } else {
if (byyou) { if (byyou) {
@@ -1246,8 +1251,7 @@ register int mmflags;
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0) if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0)
#else #else
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the /* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
* same expression. same expression. */
*/
if (mndx == PM_LONG_WORM if (mndx == PM_LONG_WORM
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0)) && (mtmp->wormno = get_wormno(), mtmp->wormno != 0))
#endif #endif
@@ -1310,7 +1314,7 @@ register int mmflags;
if (!in_mklev) if (!in_mklev)
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */ newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
return (mtmp); return mtmp;
} }
int int
@@ -1365,9 +1369,9 @@ int mndx;
if (mvitals[mndx].mvflags & G_GONE) if (mvitals[mndx].mvflags & G_GONE)
return TRUE; return TRUE;
if (Inhell) if (Inhell)
return (mons[mndx].maligntyp > A_NEUTRAL); return (boolean) (mons[mndx].maligntyp > A_NEUTRAL);
else else
return ((mons[mndx].geno & G_HELL) != 0); return (boolean) ((mons[mndx].geno & G_HELL) != 0);
} }
/* /*
@@ -1446,11 +1450,9 @@ rndmonst()
elemlevel = In_endgame(&u.uz) && !Is_astralevel(&u.uz); elemlevel = In_endgame(&u.uz) && !Is_astralevel(&u.uz);
/* /*
* Find out how many monsters exist in the range we have * Find out how many monsters exist in the range we have selected.
*selected.
*/ */
/* (`mndx' initialized above) */ for ( ; mndx < SPECIAL_PM; mndx++) { /* (`mndx' initialized above) */
for (; mndx < SPECIAL_PM; mndx++) {
ptr = &mons[mndx]; ptr = &mons[mndx];
rndmonst_state.mchoices[mndx] = 0; rndmonst_state.mchoices[mndx] = 0;
if (tooweak(mndx, minmlev) || toostrong(mndx, maxmlev)) if (tooweak(mndx, minmlev) || toostrong(mndx, maxmlev))
@@ -1532,13 +1534,11 @@ int mndx, mvflagsmask, genomask;
return TRUE; return TRUE;
} }
/* The routine below is used to make one of the multiple types /* Make one of the multiple types of a given monster class.
* of a given monster class. The second parameter specifies a * The second parameter specifies a special casing bit mask
* special casing bit mask to allow the normal genesis * to allow the normal genesis masks to be deactivated.
* masks to be deactivated. Returns 0 if no monsters * Returns Null if no monsters in that class can be made.
* in that class can be made.
*/ */
struct permonst * struct permonst *
mkclass(class, spc) mkclass(class, spc)
char class; char class;
@@ -1550,7 +1550,7 @@ int spc;
maxmlev = level_difficulty() >> 1; maxmlev = level_difficulty() >> 1;
if (class < 1 || class >= MAXMCLASSES) { if (class < 1 || class >= MAXMCLASSES) {
impossible("mkclass called with bad class!"); impossible("mkclass called with bad class!");
return ((struct permonst *) 0); return (struct permonst *) 0;
} }
/* Assumption #1: monsters of a given class are contiguous in the /* Assumption #1: monsters of a given class are contiguous in the
* mons[] array. * mons[] array.
@@ -1569,9 +1569,8 @@ int spc;
break; break;
num += mons[last].geno & G_FREQ; num += mons[last].geno & G_FREQ;
} }
if (!num) if (!num)
return ((struct permonst *) 0); return (struct permonst *) 0;
/* Assumption #2: monsters of a given class are presented in ascending /* Assumption #2: monsters of a given class are presented in ascending
* order of strength. * order of strength.
@@ -1588,14 +1587,15 @@ int spc;
} }
first--; /* correct an off-by-one error */ first--; /* correct an off-by-one error */
return (&mons[first]); return &mons[first];
} }
/* like mkclass(), but excludes difficulty considerations; used when /* like mkclass(), but excludes difficulty considerations; used when
player with polycontrol picks a class instead of a specific type; player with polycontrol picks a class instead of a specific type;
genocided types are avoided but extinct ones are acceptable; we don't genocided types are avoided but extinct ones are acceptable; we don't
check polyok() here--caller accepts some choices !polyok() would reject */ check polyok() here--caller accepts some choices !polyok() would reject */
int mkclass_poly(class) int
mkclass_poly(class)
int class; int class;
{ {
register int first, last, num = 0; register int first, last, num = 0;
@@ -1620,7 +1620,9 @@ int class;
return first; return first;
} }
int adj_lev(ptr) /* adjust strength of monsters based on u.uz and u.ulevel */ /* adjust strength of monsters based on u.uz and u.ulevel */
int
adj_lev(ptr)
register struct permonst *ptr; register struct permonst *ptr;
{ {
int tmp, tmp2; int tmp, tmp2;
@@ -1636,7 +1638,7 @@ register struct permonst *ptr;
} }
if ((tmp = ptr->mlevel) > 49) if ((tmp = ptr->mlevel) > 49)
return (50); /* "special" demons/devils */ return 50; /* "special" demons/devils */
tmp2 = (level_difficulty() - tmp); tmp2 = (level_difficulty() - tmp);
if (tmp2 < 0) if (tmp2 < 0)
tmp--; /* if mlevel > u.uz decrement tmp */ tmp--; /* if mlevel > u.uz decrement tmp */
@@ -1653,8 +1655,10 @@ register struct permonst *ptr;
return ((tmp > tmp2) ? tmp2 : (tmp > 0 ? tmp : 0)); /* 0 lower limit */ return ((tmp > tmp2) ? tmp2 : (tmp > 0 ? tmp : 0)); /* 0 lower limit */
} }
/* monster earned experience and will gain some hit points; it might also
grow into a bigger monster (baby to adult, soldier to officer, etc) */
struct permonst * struct permonst *
grow_up(mtmp, victim) /* `mtmp' might "grow up" into a bigger version */ grow_up(mtmp, victim)
struct monst *mtmp, *victim; struct monst *mtmp, *victim;
{ {
int oldtype, newtype, max_increase, cur_increase, lev_limit, hp_threshold; int oldtype, newtype, max_increase, cur_increase, lev_limit, hp_threshold;
@@ -1663,7 +1667,7 @@ struct monst *mtmp, *victim;
/* monster died after killing enemy but before calling this function */ /* monster died after killing enemy but before calling this function */
/* currently possible if killing a gas spore */ /* currently possible if killing a gas spore */
if (mtmp->mhp <= 0) if (mtmp->mhp <= 0)
return ((struct permonst *) 0); return (struct permonst *) 0;
/* note: none of the monsters with special hit point calculations /* note: none of the monsters with special hit point calculations
have both little and big forms */ have both little and big forms */
@@ -1755,7 +1759,7 @@ struct monst *mtmp, *victim;
int int
mongets(mtmp, otyp) mongets(mtmp, otyp)
register struct monst *mtmp; register struct monst *mtmp;
register int otyp; int otyp;
{ {
register struct obj *otmp; register struct obj *otmp;
int spe; int spe;
@@ -1800,9 +1804,9 @@ register int otyp;
spe = otmp->spe; spe = otmp->spe;
(void) mpickobj(mtmp, otmp); /* might free otmp */ (void) mpickobj(mtmp, otmp); /* might free otmp */
return (spe); return spe;
} else }
return (0); return 0;
} }
int int
@@ -1839,7 +1843,7 @@ int type;
/* /*
* Alignment vs. yours determines monster's attitude to you. * Alignment vs. yours determines monster's attitude to you.
* ( some "animal" types are co-aligned, but also hungry ) * (Some "animal" types are co-aligned, but also hungry.)
*/ */
boolean boolean
peace_minded(ptr) peace_minded(ptr)
@@ -1872,15 +1876,15 @@ register struct permonst *ptr;
/* minions are hostile to players that have strayed at all */ /* minions are hostile to players that have strayed at all */
if (is_minion(ptr)) if (is_minion(ptr))
return ((boolean)(u.ualign.record >= 0)); return (boolean) (u.ualign.record >= 0);
/* Last case: a chance of a co-aligned monster being /* Last case: a chance of a co-aligned monster being
* hostile. This chance is greater if the player has strayed * hostile. This chance is greater if the player has strayed
* (u.ualign.record negative) or the monster is not strongly aligned. * (u.ualign.record negative) or the monster is not strongly aligned.
*/ */
return ( return (boolean) (!!rn2(16 + (u.ualign.record < -15 ? -15
(boolean)(!!rn2(16 + (u.ualign.record < -15 ? -15 : u.ualign.record)) : u.ualign.record))
&& !!rn2(2 + abs(mal)))); && !!rn2(2 + abs(mal)));
} }
/* Set malign to have the proper effect on player alignment if monster is /* Set malign to have the proper effect on player alignment if monster is
@@ -1890,8 +1894,8 @@ register struct permonst *ptr;
* greater than the bonus for killing a hostile monster to maintain balance. * greater than the bonus for killing a hostile monster to maintain balance.
* Rules: * Rules:
* it's bad to kill peaceful monsters, potentially worse to kill always- * it's bad to kill peaceful monsters, potentially worse to kill always-
* peaceful monsters * peaceful monsters;
* it's never bad to kill a hostile monster, although it may not be good * it's never bad to kill a hostile monster, although it may not be good.
*/ */
void void
set_malign(mtmp) set_malign(mtmp)
@@ -2085,8 +2089,7 @@ register struct monst *mtmp;
} }
} }
/* release a monster from a bag of tricks; return number of monsters created /* release monster frome bag of tricks; return number of monsters created */
*/
int int
bagotricks(bag, tipping, seencount) bagotricks(bag, tipping, seencount)
struct obj *bag; struct obj *bag;
+3 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 monmove.c $NHDT-Date: 1446604115 2015/11/04 02:28:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */ /* NetHack 3.6 monmove.c $NHDT-Date: 1446808446 2015/11/06 11:14:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.78 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -567,13 +567,11 @@ toofar:
if (tmp != 2) if (tmp != 2)
distfleeck(mtmp, &inrange, &nearby, &scared); /* recalc */ distfleeck(mtmp, &inrange, &nearby, &scared); /* recalc */
switch (tmp) { switch (tmp) { /* for pets, cases 0 and 3 are equivalent */
case 0: /* no movement, but it can still attack you */ case 0: /* no movement, but it can still attack you */
case 3: /* absolutely no movement */ case 3: /* absolutely no movement */
/* for pets, case 0 and 3 are equivalent */
/* vault guard might have vanished */ /* vault guard might have vanished */
if (mtmp->isgd if (mtmp->isgd && (mtmp->mhp < 1 || !mtmp->mx == 0))
&& (mtmp->mhp < 1 || (mtmp->mx == 0 && mtmp->my == 0)))
return 1; /* behave as if it died */ return 1; /* behave as if it died */
/* During hallucination, monster appearance should /* During hallucination, monster appearance should
* still change - even if it doesn't move. * still change - even if it doesn't move.
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mthrowu.c $NHDT-Date: 1446604116 2015/11/04 02:28:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */ /* NetHack 3.6 mthrowu.c $NHDT-Date: 1446808447 2015/11/06 11:14:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -135,9 +135,9 @@ int
ohitmon(mtmp, otmp, range, verbose) ohitmon(mtmp, otmp, range, verbose)
struct monst *mtmp; /* accidental target, located at <bhitpos.x,.y> */ struct monst *mtmp; /* accidental target, located at <bhitpos.x,.y> */
struct obj *otmp; /* missile; might be destroyed by drop_throw */ struct obj *otmp; /* missile; might be destroyed by drop_throw */
int range; /* how much farther will object travel if it misses */ int range; /* how much farther will object travel if it misses;
/* Use -1 to signify to keep going even after hit, */ use -1 to signify to keep going even after hit,
/* unless its gone (used for rolling_boulder_traps) */ unless it's gone (used for rolling_boulder_traps) */
boolean verbose; /* give message(s) even when you can't see what happened */ boolean verbose; /* give message(s) even when you can't see what happened */
{ {
int damage, tmp; int damage, tmp;
+17 -18
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 music.c $NHDT-Date: 1432512773 2015/05/25 00:12:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */ /* NetHack 3.6 music.c $NHDT-Date: 1446808448 2015/11/06 11:14:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -12,8 +12,7 @@
* magic flute may put monsters to sleep: area of effect depends * magic flute may put monsters to sleep: area of effect depends
* on player level. * on player level.
* (tooled) horn Will awaken monsters: area of effect depends on * (tooled) horn Will awaken monsters: area of effect depends on
*player * player level. May also scare monsters.
* level. May also scare monsters.
* fire horn Acts like a wand of fire. * fire horn Acts like a wand of fire.
* frost horn Acts like a wand of cold. * frost horn Acts like a wand of cold.
* bugle Will awaken soldiers (if any): area of effect depends * bugle Will awaken soldiers (if any): area of effect depends
@@ -73,7 +72,8 @@ int distance;
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
mtmp->mfrozen = 0; mtmp->mfrozen = 0;
/* may scare some monsters -- waiting monsters excluded */ /* may scare some monsters -- waiting monsters excluded */
if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0) if (!unique_corpstat(mtmp->data)
&& (mtmp->mstrategy & STRAT_WAITMASK) != 0)
mtmp->mstrategy &= ~STRAT_WAITMASK; mtmp->mstrategy &= ~STRAT_WAITMASK;
else if (distm < distance / 3 else if (distm < distance / 3
&& !resist(mtmp, TOOL_CLASS, 0, NOTELL)) && !resist(mtmp, TOOL_CLASS, 0, NOTELL))
@@ -195,7 +195,8 @@ struct monst *bugler; /* monster that played instrument */
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
mtmp->mfrozen = 0; mtmp->mfrozen = 0;
/* may scare some monsters -- waiting monsters excluded */ /* may scare some monsters -- waiting monsters excluded */
if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0) if (!unique_corpstat(mtmp->data)
&& (mtmp->mstrategy & STRAT_WAITMASK) != 0)
mtmp->mstrategy &= ~STRAT_WAITMASK; mtmp->mstrategy &= ~STRAT_WAITMASK;
else if (distm < distance / 3 else if (distm < distance / 3
&& !resist(mtmp, TOOL_CLASS, 0, NOTELL)) && !resist(mtmp, TOOL_CLASS, 0, NOTELL))
@@ -207,7 +208,6 @@ struct monst *bugler; /* monster that played instrument */
/* Charm monsters in range. Note that they may resist the spell. /* Charm monsters in range. Note that they may resist the spell.
* If swallowed, range is reduced to 0. * If swallowed, range is reduced to 0.
*/ */
STATIC_OVL void STATIC_OVL void
charm_monsters(distance) charm_monsters(distance)
int distance; int distance;
@@ -234,7 +234,6 @@ int distance;
/* Generate earthquake :-) of desired force. /* Generate earthquake :-) of desired force.
* That is: create random chasms (pits). * That is: create random chasms (pits).
*/ */
STATIC_OVL void STATIC_OVL void
do_earthquake(force) do_earthquake(force)
int force; int force;
@@ -338,7 +337,6 @@ int force;
/* We have to check whether monsters or player /* We have to check whether monsters or player
falls in a chasm... */ falls in a chasm... */
if (mtmp) { if (mtmp) {
if (!is_flyer(mtmp->data) if (!is_flyer(mtmp->data)
&& !is_clinger(mtmp->data)) { && !is_clinger(mtmp->data)) {
@@ -431,7 +429,6 @@ int force;
/* /*
* The player is trying to extract something from his/her instrument. * The player is trying to extract something from his/her instrument.
*/ */
STATIC_OVL int STATIC_OVL int
do_improvisation(instr) do_improvisation(instr)
struct obj *instr; struct obj *instr;
@@ -497,9 +494,9 @@ struct obj *instr;
} else if (!u.dx && !u.dy && !u.dz) { } else if (!u.dx && !u.dy && !u.dz) {
if ((damage = zapyourself(instr, TRUE)) != 0) { if ((damage = zapyourself(instr, TRUE)) != 0) {
char buf[BUFSZ]; char buf[BUFSZ];
Sprintf(buf, "using a magical horn on %sself", uhim()); Sprintf(buf, "using a magical horn on %sself", uhim());
losehp(damage, buf, KILLED_BY); /* frost damage */ losehp(damage, buf, KILLED_BY); /* fire or frost damage */
/* fire damage */
} }
} else { } else {
buzz((instr->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1, buzz((instr->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1,
@@ -563,7 +560,6 @@ struct obj *instr;
/* /*
* So you want music... * So you want music...
*/ */
int int
do_play_instrument(instr) do_play_instrument(instr)
struct obj *instr; struct obj *instr;
@@ -575,13 +571,13 @@ struct obj *instr;
if (Underwater) { if (Underwater) {
You_cant("play music underwater!"); You_cant("play music underwater!");
return (0); return 0;
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE } else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN || instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE) || instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
&& !can_blow(&youmonst)) { && !can_blow(&youmonst)) {
You("are incapable of playing %s.", the(distant_name(instr, xname))); You("are incapable of playing %s.", the(distant_name(instr, xname)));
return (0); return 0;
} }
if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) { if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) {
c = ynq("Improvise?"); c = ynq("Improvise?");
@@ -634,6 +630,7 @@ struct obj *instr;
{ {
char nbuf[20]; char nbuf[20];
int i; int i;
for (i = 0; buf[i] && i < 5; ++i) { for (i = 0; buf[i] && i < 5; ++i) {
nbuf[i * 2] = buf[i]; nbuf[i * 2] = buf[i];
nbuf[(i * 2) + 1] = 'h'; nbuf[(i * 2) + 1] = 'h';
@@ -799,9 +796,9 @@ char *buf;
#define noDEBUG #define noDEBUG
/* emit tone of frequency hz for given number of ticks */
STATIC_OVL void STATIC_OVL void
tone(hz, ticks) tone(hz, ticks)
/* emit tone of frequency hz for given number of ticks */
unsigned int hz, ticks; unsigned int hz, ticks;
{ {
ioctl(0, KDMKTONE, hz | ((ticks * 10) << 16)); ioctl(0, KDMKTONE, hz | ((ticks * 10) << 16));
@@ -811,9 +808,9 @@ unsigned int hz, ticks;
nap(ticks * 10); nap(ticks * 10);
} }
/* rest for given number of ticks */
STATIC_OVL void STATIC_OVL void
rest(ticks) rest(ticks)
/* rest for given number of ticks */
int ticks; int ticks;
{ {
nap(ticks * 10); nap(ticks * 10);
@@ -852,8 +849,10 @@ char *buf;
playstring(buf, strlen(buf)); playstring(buf, strlen(buf));
} }
#ifdef DEBUG #ifdef VPIX_DEBUG
main(argc, argv) char *argv[]; main(argc, argv)
int argc;
char *argv[];
{ {
if (argc == 2) { if (argc == 2) {
playinit(); playinit();
+96 -86
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1446336796 2015/11/01 00:13:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.234 $ */ /* NetHack 3.6 options.c $NHDT-Date: 1446808448 2015/11/06 11:14:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.235 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -493,8 +493,8 @@ STATIC_DCL int FDECL(change_inv_order, (char *));
STATIC_DCL void FDECL(oc_to_str, (char *, char *)); STATIC_DCL void FDECL(oc_to_str, (char *, char *));
STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *)); STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *)); STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
STATIC_DCL boolean STATIC_DCL boolean FDECL(special_handling, (const char *,
FDECL(special_handling, (const char *, BOOLEAN_P, BOOLEAN_P)); BOOLEAN_P, BOOLEAN_P));
STATIC_DCL void FDECL(warning_opts, (char *, const char *)); STATIC_DCL void FDECL(warning_opts, (char *, const char *));
STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int)); STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int)); STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
@@ -525,7 +525,8 @@ reglyph_darkroom()
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
struct rm *lev = &levl[x][y]; struct rm *lev = &levl[x][y];
if (!flags.dark_room || !iflags.use_color || Is_rogue_level(&u.uz)) { if (!flags.dark_room || !iflags.use_color
|| Is_rogue_level(&u.uz)) {
if (lev->glyph == cmap_to_glyph(S_darkroom)) if (lev->glyph == cmap_to_glyph(S_darkroom))
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) lev->glyph = lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone); : cmap_to_glyph(S_stone);
@@ -1069,8 +1070,8 @@ const char *optn;
if (!initial) { if (!initial) {
Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ, Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH); FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
pline("Feature change alerts disabled for NetHack %s features and " pline(
"prior.", "Feature change alerts disabled for NetHack %s features and prior.",
buf); buf);
} }
return 1; return 1;
@@ -1240,7 +1241,7 @@ int clr;
for (i = 0; i < SIZE(colornames); i++) for (i = 0; i < SIZE(colornames); i++)
if (colornames[i].color == clr) if (colornames[i].color == clr)
return colornames[i].name; return colornames[i].name;
return NULL; return (char *) 0;
} }
const char * const char *
@@ -1252,7 +1253,7 @@ int attr;
for (i = 0; i < SIZE(attrnames); i++) for (i = 0; i < SIZE(attrnames); i++)
if (attrnames[i].attr == attr) if (attrnames[i].attr == attr)
return attrnames[i].name; return attrnames[i].name;
return NULL; return (char *) 0;
} }
int int
@@ -1334,7 +1335,7 @@ int typ;
for (i = 0; i < SIZE(msgtype_names); i++) for (i = 0; i < SIZE(msgtype_names); i++)
if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ) if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ)
return msgtype_names[i].name; return msgtype_names[i].name;
return NULL; return (char *) 0;
} }
int int
@@ -1379,6 +1380,7 @@ char *pattern;
tmp->regex = regex_init(); tmp->regex = regex_init();
if (!regex_compile(pattern, tmp->regex)) { if (!regex_compile(pattern, tmp->regex)) {
static const char *re_error = "MSGTYPE regex error"; static const char *re_error = "MSGTYPE regex error";
if (!iflags.window_inited) if (!iflags.window_inited)
raw_printf("\n%s: %s\n", re_error, regex_error_desc(tmp->regex)); raw_printf("\n%s: %s\n", re_error, regex_error_desc(tmp->regex));
else else
@@ -1397,17 +1399,15 @@ char *pattern;
void void
msgtype_free() msgtype_free()
{ {
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp, *tmp2 = 0;
struct plinemsg_type *tmp2;
while (tmp) { for (tmp = plinemsg_types; tmp; tmp = tmp2) {
free(tmp->pattern); tmp2 = tmp->next;
free((genericptr_t) tmp->pattern);
regex_free(tmp->regex); regex_free(tmp->regex);
tmp2 = tmp; free((genericptr_t) tmp);
tmp = tmp->next;
free(tmp2);
} }
plinemsg_types = NULL; plinemsg_types = (struct plinemsg_type *) 0;
} }
void void
@@ -1420,9 +1420,10 @@ int idx; /* 0 .. */
while (tmp) { while (tmp) {
if (idx == 0) { if (idx == 0) {
struct plinemsg_type *next = tmp->next; struct plinemsg_type *next = tmp->next;
regex_free(tmp->regex); regex_free(tmp->regex);
free(tmp->pattern); free((genericptr_t) tmp->pattern);
free(tmp); free((genericptr_t) tmp);
if (prev) if (prev)
prev->next = next; prev->next = next;
else else
@@ -1442,7 +1443,8 @@ const char *msg;
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = plinemsg_types;
while (tmp) { while (tmp) {
if (regex_match(msg, tmp->regex)) return tmp->msgtype; if (regex_match(msg, tmp->regex))
return tmp->msgtype;
tmp = tmp->next; tmp = tmp->next;
} }
return MSGTYP_NORMAL; return MSGTYP_NORMAL;
@@ -1471,6 +1473,7 @@ char *str;
if (sscanf(str, "%10s \"%255[^\"]\"", msgtype, pattern) == 2) { if (sscanf(str, "%10s \"%255[^\"]\"", msgtype, pattern) == 2) {
int typ = -1; int typ = -1;
int i; int i;
for (i = 0; i < SIZE(msgtype_names); i++) for (i = 0; i < SIZE(msgtype_names); i++)
if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) { if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
typ = msgtype_names[i].msgtyp; typ = msgtype_names[i].msgtyp;
@@ -1492,7 +1495,7 @@ int c, a;
if (!str) if (!str)
return FALSE; return FALSE;
tmp = (struct menucoloring *) alloc(sizeof(struct menucoloring)); tmp = (struct menucoloring *) alloc(sizeof (struct menucoloring));
tmp->match = regex_init(); tmp->match = regex_init();
if (!regex_compile(str, tmp->match)) { if (!regex_compile(str, tmp->match)) {
if (!iflags.window_inited) if (!iflags.window_inited)
@@ -1598,9 +1601,10 @@ free_menu_coloring()
while (tmp) { while (tmp) {
struct menucoloring *tmp2 = tmp->next; struct menucoloring *tmp2 = tmp->next;
regex_free(tmp->match); regex_free(tmp->match);
free(tmp->origstr); free((genericptr_t) tmp->origstr);
free(tmp); free((genericptr_t) tmp);
tmp = tmp2; tmp = tmp2;
} }
} }
@@ -1615,9 +1619,10 @@ int idx; /* 0 .. */
while (tmp) { while (tmp) {
if (idx == 0) { if (idx == 0) {
struct menucoloring *next = tmp->next; struct menucoloring *next = tmp->next;
regex_free(tmp->match); regex_free(tmp->match);
free(tmp->origstr); free((genericptr_t) tmp->origstr);
free(tmp); free((genericptr_t) tmp);
if (prev) if (prev)
prev->next = next; prev->next = next;
else else
@@ -2054,6 +2059,7 @@ boolean tinitial, tfrom_file;
/* allow option to be silently ignored by non-tty ports */ /* allow option to be silently ignored by non-tty ports */
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
int tmp; int tmp;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!(op = string_for_opt(opts, TRUE))) { if (!(op = string_for_opt(opts, TRUE))) {
@@ -2244,8 +2250,8 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "fruit", 2, TRUE)) { if (match_optname(opts, "fruit", 2, TRUE)) {
struct fruit *forig = 0; struct fruit *forig = 0;
char empty_str = '\0'; char empty_str = '\0';
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated); op = string_for_opt(opts, negated);
@@ -3186,6 +3192,7 @@ boolean tinitial, tfrom_file;
fullname = "DECgraphics"; fullname = "DECgraphics";
if (match_optname(opts, fullname, 3, TRUE)) { if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE; boolean badflag = FALSE;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
@@ -3212,6 +3219,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, 3, TRUE)) { if (match_optname(opts, fullname, 3, TRUE)) {
const char *sym_name = fullname; const char *sym_name = fullname;
boolean badflag = FALSE; boolean badflag = FALSE;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
@@ -3246,6 +3254,7 @@ boolean tinitial, tfrom_file;
fullname = "MACgraphics"; fullname = "MACgraphics";
if (match_optname(opts, fullname, 3, TRUE)) { if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE; boolean badflag = FALSE;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
@@ -3271,6 +3280,7 @@ boolean tinitial, tfrom_file;
return; return;
} }
#endif #endif
/* OK, if we still haven't recognized the option, check the boolean /* OK, if we still haven't recognized the option, check the boolean
* options list * options list
*/ */
@@ -3638,25 +3648,25 @@ doset()
*/ */
for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) { for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
opt_indx = pick_list[pick_idx].item.a_int - 1; opt_indx = pick_list[pick_idx].item.a_int - 1;
if (opt_indx == -2) { /* -3 due to -1 offset for select_menu() */ if (opt_indx == -2) {
/* -2 due to -1 offset for select_menu() */
(void) special_handling("autopickup_exception", setinitial, (void) special_handling("autopickup_exception", setinitial,
fromfile); fromfile);
} else
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
if (opt_indx } else if (opt_indx == -3) {
== -3) { /* -3 due to -1 offset for select_menu() */ /* -3 due to -1 offset for select_menu() */
if (!status_hilite_menu()) if (!status_hilite_menu()) {
pline("Bad status hilite(s) specified."); pline("Bad status hilite(s) specified.");
else { } else {
if (wc2_supported("status_hilites")) if (wc2_supported("status_hilites"))
preference_update("status_hilites"); preference_update("status_hilites");
} }
} else
#endif #endif
#endif #endif
if (opt_indx == -4) { } else if (opt_indx == -4) {
(void) special_handling("menucolors", setinitial, fromfile); (void) special_handling("menucolors", setinitial,
fromfile);
} else if (opt_indx == -5) { } else if (opt_indx == -5) {
(void) special_handling("msgtype", setinitial, fromfile); (void) special_handling("msgtype", setinitial, fromfile);
} else if (opt_indx < boolcount) { } else if (opt_indx < boolcount) {
@@ -4091,7 +4101,8 @@ boolean setinitial, setfromfile;
mt_idx = 0; mt_idx = 0;
while (tmp) { while (tmp) {
const char *mtype = msgtype2name(tmp->msgtype); const char *mtype = msgtype2name(tmp->msgtype);
any.a_int = (++mt_idx);
any.a_int = ++mt_idx;
Sprintf(mtbuf, "%-5s \"%s\"", mtype, tmp->pattern); Sprintf(mtbuf, "%-5s \"%s\"", mtype, tmp->pattern);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf,
MENU_UNSELECTED); MENU_UNSELECTED);
@@ -4100,8 +4111,9 @@ boolean setinitial, setfromfile;
Sprintf(mtbuf, "%s message types", Sprintf(mtbuf, "%s message types",
(opt_idx == 1) ? "List of" : "Remove which"); (opt_idx == 1) ? "List of" : "Remove which");
end_menu(tmpwin, mtbuf); end_menu(tmpwin, mtbuf);
pick_cnt = select_menu( pick_cnt = select_menu(tmpwin,
tmpwin, (opt_idx == 1) ? PICK_NONE : PICK_ANY, &pick_list); (opt_idx == 1) ? PICK_NONE : PICK_ANY,
&pick_list);
if (pick_cnt > 0) { if (pick_cnt > 0) {
for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
free_one_msgtype(pick_list[pick_idx].item.a_int - 1 free_one_msgtype(pick_list[pick_idx].item.a_int - 1
@@ -4535,8 +4547,7 @@ char *buf;
else if (!strcmp(optname, "horsename")) else if (!strcmp(optname, "horsename"))
Sprintf(buf, "%s", horsename[0] ? horsename : none); Sprintf(buf, "%s", horsename[0] ? horsename : none);
else if (!strcmp(optname, "map_mode")) else if (!strcmp(optname, "map_mode"))
Sprintf( Sprintf(buf, "%s",
buf, "%s",
iflags.wc_map_mode == MAP_MODE_TILES iflags.wc_map_mode == MAP_MODE_TILES
? "tiles" ? "tiles"
: iflags.wc_map_mode == MAP_MODE_ASCII4x6 : iflags.wc_map_mode == MAP_MODE_ASCII4x6
@@ -4547,11 +4558,9 @@ char *buf;
? "ascii8x8" ? "ascii8x8"
: iflags.wc_map_mode == MAP_MODE_ASCII16x8 : iflags.wc_map_mode == MAP_MODE_ASCII16x8
? "ascii16x8" ? "ascii16x8"
: iflags.wc_map_mode : iflags.wc_map_mode == MAP_MODE_ASCII7x12
== MAP_MODE_ASCII7x12
? "ascii7x12" ? "ascii7x12"
: iflags.wc_map_mode : iflags.wc_map_mode == MAP_MODE_ASCII8x12
== MAP_MODE_ASCII8x12
? "ascii8x12" ? "ascii8x12"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII16x12 == MAP_MODE_ASCII16x12
@@ -4561,9 +4570,7 @@ char *buf;
? "ascii12x16" ? "ascii12x16"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII10x18 == MAP_MODE_ASCII10x18
? "asci" ? "ascii10x18"
"i10x"
"18"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII_FIT_TO_SCREEN == MAP_MODE_ASCII_FIT_TO_SCREEN
? "fit_to_screen" ? "fit_to_screen"
@@ -4623,17 +4630,16 @@ char *buf;
: Cmd.swap_yz ? 5 : 0; : Cmd.swap_yz ? 5 : 0;
Strcpy(buf, numpadmodes[indx]); Strcpy(buf, numpadmodes[indx]);
} else if (!strcmp(optname, "objects")) } else if (!strcmp(optname, "objects")) {
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "packorder")) { } else if (!strcmp(optname, "packorder")) {
oc_to_str(flags.inv_order, ocl); oc_to_str(flags.inv_order, ocl);
Sprintf(buf, "%s", ocl); Sprintf(buf, "%s", ocl);
}
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR
else if (!strcmp(optname, "palette")) } else if (!strcmp(optname, "palette")) {
Sprintf(buf, "%s", get_color_string()); Sprintf(buf, "%s", get_color_string());
#endif #endif
else if (!strcmp(optname, "paranoid_confirmation")) { } else if (!strcmp(optname, "paranoid_confirmation")) {
char tmpbuf[QBUFSZ]; char tmpbuf[QBUFSZ];
tmpbuf[0] = '\0'; tmpbuf[0] = '\0';
@@ -4652,36 +4658,33 @@ char *buf;
if (ParanoidRemove) if (ParanoidRemove)
Strcat(tmpbuf, " Remove"); Strcat(tmpbuf, " Remove");
Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none"); Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
} else if (!strcmp(optname, "pettype")) } else if (!strcmp(optname, "pettype")) {
Sprintf(buf, "%s", Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat"
(preferred_pet == 'c') : (preferred_pet == 'd') ? "dog"
? "cat" : (preferred_pet == 'h') ? "horse"
: (preferred_pet == 'd') : (preferred_pet == 'n') ? "none"
? "dog" : "random");
: (preferred_pet == 'h') } else if (!strcmp(optname, "pickup_burden")) {
? "horse"
: (preferred_pet == 'n') ? "none" : "random");
else if (!strcmp(optname, "pickup_burden"))
Sprintf(buf, "%s", burdentype[flags.pickup_burden]); Sprintf(buf, "%s", burdentype[flags.pickup_burden]);
else if (!strcmp(optname, "pickup_types")) { } else if (!strcmp(optname, "pickup_types")) {
oc_to_str(flags.pickup_types, ocl); oc_to_str(flags.pickup_types, ocl);
Sprintf(buf, "%s", ocl[0] ? ocl : "all"); Sprintf(buf, "%s", ocl[0] ? ocl : "all");
} else if (!strcmp(optname, "pile_limit")) } else if (!strcmp(optname, "pile_limit")) {
Sprintf(buf, "%d", flags.pile_limit); Sprintf(buf, "%d", flags.pile_limit);
else if (!strcmp(optname, "playmode")) { } else if (!strcmp(optname, "playmode")) {
Strcpy(buf, wizard ? "debug" : discover ? "explore" : "normal"); Strcpy(buf, wizard ? "debug" : discover ? "explore" : "normal");
} else if (!strcmp(optname, "race")) } else if (!strcmp(optname, "race")) {
Sprintf(buf, "%s", rolestring(flags.initrace, races, noun)); Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
else if (!strcmp(optname, "roguesymset")) { } else if (!strcmp(optname, "roguesymset")) {
Sprintf(buf, "%s", Sprintf(buf, "%s",
symset[ROGUESET].name ? symset[ROGUESET].name : "default"); symset[ROGUESET].name ? symset[ROGUESET].name : "default");
if (currentgraphics == ROGUESET && symset[ROGUESET].name) if (currentgraphics == ROGUESET && symset[ROGUESET].name)
Strcat(buf, ", active"); Strcat(buf, ", active");
} else if (!strcmp(optname, "role")) } else if (!strcmp(optname, "role")) {
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m)); Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
else if (!strcmp(optname, "runmode")) } else if (!strcmp(optname, "runmode")) {
Sprintf(buf, "%s", runmodes[flags.runmode]); Sprintf(buf, "%s", runmodes[flags.runmode]);
else if (!strcmp(optname, "scores")) { } else if (!strcmp(optname, "scores")) {
Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around, Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around,
flags.end_own ? "/own" : ""); flags.end_own ? "/own" : "");
} else if (!strcmp(optname, "scroll_amount")) { } else if (!strcmp(optname, "scroll_amount")) {
@@ -4696,19 +4699,20 @@ char *buf;
Strcpy(buf, defopt); Strcpy(buf, defopt);
} else if (!strcmp(optname, "sortloot")) { } else if (!strcmp(optname, "sortloot")) {
char *sortname = (char *) NULL; char *sortname = (char *) NULL;
for (i = 0; i < SIZE(sortltype) && sortname == (char *) NULL; i++) { for (i = 0; i < SIZE(sortltype) && sortname == (char *) NULL; i++) {
if (flags.sortloot == sortltype[i][0]) if (flags.sortloot == sortltype[i][0])
sortname = (char *) sortltype[i]; sortname = (char *) sortltype[i];
} }
if (sortname != (char *) NULL) if (sortname != (char *) NULL)
Sprintf(buf, "%s", sortname); Sprintf(buf, "%s", sortname);
} else if (!strcmp(optname, "player_selection")) } else if (!strcmp(optname, "player_selection")) {
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog"); Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
#ifdef MSDOS #ifdef MSDOS
else if (!strcmp(optname, "soundcard")) } else if (!strcmp(optname, "soundcard")) {
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
#endif #endif
else if (!strcmp(optname, "suppress_alert")) { } else if (!strcmp(optname, "suppress_alert")) {
if (flags.suppress_alert == 0L) if (flags.suppress_alert == 0L)
Strcpy(buf, none); Strcpy(buf, none);
else else
@@ -4719,10 +4723,10 @@ char *buf;
symset[PRIMARY].name ? symset[PRIMARY].name : "default"); symset[PRIMARY].name ? symset[PRIMARY].name : "default");
if (currentgraphics == PRIMARY && symset[PRIMARY].name) if (currentgraphics == PRIMARY && symset[PRIMARY].name)
Strcat(buf, ", active"); Strcat(buf, ", active");
} else if (!strcmp(optname, "tile_file")) } else if (!strcmp(optname, "tile_file")) {
Sprintf(buf, "%s", Sprintf(buf, "%s",
iflags.wc_tile_file ? iflags.wc_tile_file : defopt); iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
else if (!strcmp(optname, "tile_height")) { } else if (!strcmp(optname, "tile_height")) {
if (iflags.wc_tile_height) if (iflags.wc_tile_height)
Sprintf(buf, "%d", iflags.wc_tile_height); Sprintf(buf, "%d", iflags.wc_tile_height);
else else
@@ -4732,22 +4736,21 @@ char *buf;
Sprintf(buf, "%d", iflags.wc_tile_width); Sprintf(buf, "%d", iflags.wc_tile_width);
else else
Strcpy(buf, defopt); Strcpy(buf, defopt);
} else if (!strcmp(optname, "traps")) } else if (!strcmp(optname, "traps")) {
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "vary_msgcount")) { } else if (!strcmp(optname, "vary_msgcount")) {
if (iflags.wc_vary_msgcount) if (iflags.wc_vary_msgcount)
Sprintf(buf, "%d", iflags.wc_vary_msgcount); Sprintf(buf, "%d", iflags.wc_vary_msgcount);
else else
Strcpy(buf, defopt); Strcpy(buf, defopt);
}
#ifdef MSDOS #ifdef MSDOS
else if (!strcmp(optname, "video")) } else if (!strcmp(optname, "video")) {
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
#endif #endif
#ifdef VIDEOSHADES #ifdef VIDEOSHADES
else if (!strcmp(optname, "videoshades")) } else if (!strcmp(optname, "videoshades")) {
Sprintf(buf, "%s-%s-%s", shade[0], shade[1], shade[2]); Sprintf(buf, "%s-%s-%s", shade[0], shade[1], shade[2]);
else if (!strcmp(optname, "videocolors")) } else if (!strcmp(optname, "videocolors")) {
Sprintf(buf, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d", Sprintf(buf, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d",
ttycolors[CLR_RED], ttycolors[CLR_GREEN], ttycolors[CLR_RED], ttycolors[CLR_GREEN],
ttycolors[CLR_BROWN], ttycolors[CLR_BLUE], ttycolors[CLR_BROWN], ttycolors[CLR_BLUE],
@@ -4756,9 +4759,9 @@ char *buf;
ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE], ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE],
ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]); ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]);
#endif /* VIDEOSHADES */ #endif /* VIDEOSHADES */
else if (!strcmp(optname, "windowtype")) } else if (!strcmp(optname, "windowtype")) {
Sprintf(buf, "%s", windowprocs.name); Sprintf(buf, "%s", windowprocs.name);
else if (!strcmp(optname, "windowcolors")) } else if (!strcmp(optname, "windowcolors")) {
Sprintf( Sprintf(
buf, "%s/%s %s/%s %s/%s %s/%s", buf, "%s/%s %s/%s %s/%s %s/%s",
iflags.wc_foregrnd_menu ? iflags.wc_foregrnd_menu : defbrief, iflags.wc_foregrnd_menu ? iflags.wc_foregrnd_menu : defbrief,
@@ -4772,12 +4775,12 @@ char *buf;
iflags.wc_foregrnd_text ? iflags.wc_foregrnd_text : defbrief, iflags.wc_foregrnd_text ? iflags.wc_foregrnd_text : defbrief,
iflags.wc_backgrnd_text ? iflags.wc_backgrnd_text : defbrief); iflags.wc_backgrnd_text ? iflags.wc_backgrnd_text : defbrief);
#ifdef PREFIXES_IN_USE #ifdef PREFIXES_IN_USE
else { } else {
for (i = 0; i < PREFIX_COUNT; ++i) for (i = 0; i < PREFIX_COUNT; ++i)
if (!strcmp(optname, fqn_prefix_names[i]) && fqn_prefix[i]) if (!strcmp(optname, fqn_prefix_names[i]) && fqn_prefix[i])
Sprintf(buf, "%s", fqn_prefix[i]); Sprintf(buf, "%s", fqn_prefix[i]);
}
#endif #endif
}
if (buf[0]) if (buf[0])
return buf; return buf;
@@ -5380,6 +5383,7 @@ const char *optnam;
int status; int status;
{ {
int k; int k;
if (SET__IS_VALUE_VALID(status)) { if (SET__IS_VALUE_VALID(status)) {
impossible("set_option_mod_status: status out of range %d.", status); impossible("set_option_mod_status: status out of range %d.", status);
return; return;
@@ -5413,6 +5417,7 @@ unsigned long optmask;
int status; int status;
{ {
int k = 0; int k = 0;
if (SET__IS_VALUE_VALID(status)) { if (SET__IS_VALUE_VALID(status)) {
impossible("set_wc_option_mod_status: status out of range %d.", impossible("set_wc_option_mod_status: status out of range %d.",
status); status);
@@ -5431,6 +5436,7 @@ is_wc_option(optnam)
const char *optnam; const char *optnam;
{ {
int k = 0; int k = 0;
while (wc_options[k].wc_name) { while (wc_options[k].wc_name) {
if (strcmp(wc_options[k].wc_name, optnam) == 0) if (strcmp(wc_options[k].wc_name, optnam) == 0)
return TRUE; return TRUE;
@@ -5444,6 +5450,7 @@ wc_supported(optnam)
const char *optnam; const char *optnam;
{ {
int k = 0; int k = 0;
while (wc_options[k].wc_name) { while (wc_options[k].wc_name) {
if (!strcmp(wc_options[k].wc_name, optnam) if (!strcmp(wc_options[k].wc_name, optnam)
&& (windowprocs.wincap & wc_options[k].wc_bit)) && (windowprocs.wincap & wc_options[k].wc_bit))
@@ -5470,6 +5477,7 @@ unsigned long optmask;
int status; int status;
{ {
int k = 0; int k = 0;
if (SET__IS_VALUE_VALID(status)) { if (SET__IS_VALUE_VALID(status)) {
impossible("set_wc2_option_mod_status: status out of range %d.", impossible("set_wc2_option_mod_status: status out of range %d.",
status); status);
@@ -5488,6 +5496,7 @@ is_wc2_option(optnam)
const char *optnam; const char *optnam;
{ {
int k = 0; int k = 0;
while (wc2_options[k].wc_name) { while (wc2_options[k].wc_name) {
if (strcmp(wc2_options[k].wc_name, optnam) == 0) if (strcmp(wc2_options[k].wc_name, optnam) == 0)
return TRUE; return TRUE;
@@ -5501,6 +5510,7 @@ wc2_supported(optnam)
const char *optnam; const char *optnam;
{ {
int k = 0; int k = 0;
while (wc2_options[k].wc_name) { while (wc2_options[k].wc_name) {
if (!strcmp(wc2_options[k].wc_name, optnam) if (!strcmp(wc2_options[k].wc_name, optnam)
&& (windowprocs.wincap2 & wc2_options[k].wc_bit)) && (windowprocs.wincap2 & wc2_options[k].wc_bit))
@@ -5516,6 +5526,7 @@ int opttype;
char *fontname; char *fontname;
{ {
char **fn = (char **) 0; char **fn = (char **) 0;
if (!fontname) if (!fontname)
return; return;
switch (opttype) { switch (opttype) {
@@ -5554,7 +5565,6 @@ char *op;
* menu white/black message green/yellow status white/blue text * menu white/black message green/yellow status white/blue text
* white/black * white/black
*/ */
int j; int j;
char buf[BUFSZ]; char buf[BUFSZ];
char *wn, *tfg, *tbg, *newop; char *wn, *tfg, *tbg, *newop;