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
+8 -7
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
@@ -3164,7 +3165,7 @@ struct obj *obj;
/* we want this before the explosion instead of at the very end */ /* we want this before the explosion instead of at the very end */
pline("A wall of force smashes down around you!"); pline("A wall of force smashes down around you!");
dmg = d(1 + obj->spe, 6); /* normally 2d12 */ dmg = d(1 + obj->spe, 6); /* normally 2d12 */
/*FALLTHRU*/ /*FALLTHRU*/
case WAN_CANCELLATION: case WAN_CANCELLATION:
case WAN_POLYMORPH: case WAN_POLYMORPH:
case WAN_TELEPORTATION: case WAN_TELEPORTATION:
+22 -22
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. */
@@ -56,10 +56,10 @@ ballfall()
* To make this work, we have to mess with the hero's mind. The rules for * To make this work, we have to mess with the hero's mind. The rules for
* ball&chain are: * ball&chain are:
* *
* 1. If the hero can see them, fine. * 1. If the hero can see them, fine.
* 2. If the hero can't see either, it isn't seen. * 2. If the hero can't see either, it isn't seen.
* 3. If either is felt it is seen. * 3. If either is felt it is seen.
* 4. If either is felt and moved, it disappears. * 4. If either is felt and moved, it disappears.
* *
* If the hero can see, then when a move is done, the ball and chain are * If the hero can see, then when a move is done, the ball and chain are
* first picked up, the positions under them are corrected, then they * first picked up, the positions under them are corrected, then they
@@ -77,12 +77,12 @@ ballfall()
/* /*
* from you.h * from you.h
* int u.bglyph glyph under the ball * int u.bglyph glyph under the ball
* int u.cglyph glyph under the chain * int u.cglyph glyph under the chain
* int u.bc_felt mask for ball/chain being felt * int u.bc_felt mask for ball/chain being felt
* #define BC_BALL 0x01 bit mask in u.bc_felt for ball * #define BC_BALL 0x01 bit mask in u.bc_felt for ball
* #define BC_CHAIN 0x02 bit mask in u.bc_felt for chain * #define BC_CHAIN 0x02 bit mask in u.bc_felt for chain
* int u.bc_order ball & chain order * int u.bc_order ball & chain order
* *
* u.bc_felt is also manipulated in display.c and read.c, the others only * u.bc_felt is also manipulated in display.c and read.c, the others only
* in this file. None of these variables are valid unless the player is * in this file. None of these variables are valid unless the player is
@@ -479,7 +479,7 @@ boolean allow_drag;
&& !already_in_rock) { && !already_in_rock) {
if (allow_drag) { if (allow_drag) {
/* Avoid pathological case *if* not teleporting: /* Avoid pathological case *if* not teleporting:
* 0 0_ * 0 0_
* _X move northeast -----> X@ * _X move northeast -----> X@
* @ * @
*/ */
@@ -487,9 +487,9 @@ boolean allow_drag;
&& dist2(x, y, tempx, tempy) == 1) && dist2(x, y, tempx, tempy) == 1)
SKIP_TO_DRAG; SKIP_TO_DRAG;
/* Avoid pathological case *if* not teleporting: /* Avoid pathological case *if* not teleporting:
* 0 0 * 0 0
* _X move east -----> X_ * _X move east -----> X_
* @ @ * @ @
*/ */
if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 4 if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 4
&& dist2(x, y, tempx, tempy) == 2) && dist2(x, y, tempx, tempy) == 2)
@@ -694,8 +694,9 @@ 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 */
/* pick up glyph */ u.bc_order = bc_order();
/* 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;
} }
@@ -796,14 +797,13 @@ drag_down()
uchar dragchance = 3; uchar dragchance = 3;
/* /*
* Assume that the ball falls forward if: * Assume that the ball falls forward if:
* *
* a) the character is wielding it, or * a) the character is wielding it, or
* b) the character has both hands available to hold it (i.e. is * b) the character has both hands available to hold it (i.e. is
* 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))
+113 -109
View File
@@ -1,10 +1,10 @@
/* 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. */
/* /*
* THE NEW DISPLAY CODE * THE NEW DISPLAY CODE
* *
* The old display code has been broken up into three parts: vision, display, * The old display code has been broken up into three parts: vision, display,
* and drawing. Vision decides what locations can and cannot be physically * and drawing. Vision decides what locations can and cannot be physically
@@ -30,15 +30,15 @@
* *
* Display rules: * Display rules:
* *
* If the location is in sight, display in order: * If the location is in sight, display in order:
* visible (or sensed) monsters * visible (or sensed) monsters
* visible objects * visible objects
* known traps * known traps
* background * background
* *
* If the location is out of sight, display in order: * If the location is out of sight, display in order:
* sensed monsters (telepathy) * sensed monsters (telepathy)
* memory * memory
* *
* *
* *
@@ -97,24 +97,23 @@
* *
* Parts of the rm structure that are used: * Parts of the rm structure that are used:
* *
* typ - What is really there. * typ - What is really there.
* glyph - What the hero remembers. This will never be a monster. * glyph - What the hero remembers. This will never be a monster.
* Monsters "float" above this. * Monsters "float" above this.
* lit - True if the position is lit. An optimization for * lit - True if the position is lit. An optimization for
* lit/unlit rooms. * lit/unlit rooms.
* waslit - True if the position was *remembered* as lit. * waslit - True if the position was *remembered* as lit.
* 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. * flags - Additional information for the typ field. Different for
* flags - Additional information for the typ field. Different for * each typ.
* each typ. * horizontal - Indicates whether the wall or door is horizontal or
* horizontal - Indicates whether the wall or door is horizontal or * vertical.
* vertical.
*/ */
#include "hack.h" #include "hack.h"
@@ -180,7 +179,7 @@ int show;
* The routines map_background(), map_object(), and map_trap() could just * The routines map_background(), map_object(), and map_trap() could just
* as easily be: * as easily be:
* *
* map_glyph(x,y,glyph,show) * map_glyph(x,y,glyph,show)
* *
* Which is called with the xx_to_glyph() in the call. Then I can get * Which is called with the xx_to_glyph() in the call. Then I can get
* rid of 3 routines that don't do very much anyway. And then stop * rid of 3 routines that don't do very much anyway. And then stop
@@ -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)) {
@@ -534,11 +534,11 @@ xchar x, y;
* *
* Check (and display) in order: * Check (and display) in order:
* *
* + Stone, walls, and closed doors. * + Stone, walls, and closed doors.
* + Boulders. [see a boulder before a doorway] * + Boulders. [see a boulder before a doorway]
* + Doors. * + Doors.
* + Room/water positions * + Room/water positions
* + Everything else (hallways!) * + Everything else (hallways!)
*/ */
if (IS_ROCK(lev->typ) if (IS_ROCK(lev->typ)
|| (IS_DOOR(lev->typ) || (IS_DOOR(lev->typ)
@@ -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));
@@ -597,7 +599,7 @@ xchar x, y;
/* We feel it (I think hallways are the only things left). */ /* We feel it (I think hallways are the only things left). */
map_background(x, y, 1); map_background(x, y, 1);
/* Corridors are never felt as lit (unless remembered that way) */ /* Corridors are never felt as lit (unless remembered that way) */
/* (lit_corridor only). */ /* (lit_corridor only). */
if (lev->typ == CORR && lev->glyph == cmap_to_glyph(S_litcorr) if (lev->typ == CORR && lev->glyph == cmap_to_glyph(S_litcorr)
&& !lev->waslit) && !lev->waslit)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
@@ -697,7 +699,7 @@ register int x, y;
/* /*
* Don't use templit here: E.g. * Don't use templit here: E.g.
* *
* lev->waslit = !!(lev->lit || templit(x,y)); * lev->waslit = !!(lev->lit || templit(x,y));
* *
* Otherwise we have the "light pool" problem, where non-permanently * Otherwise we have the "light pool" problem, where non-permanently
* lit areas just out of sight stay remembered as lit. They should * lit areas just out of sight stay remembered as lit. They should
@@ -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);
@@ -782,20 +784,20 @@ register int x, y;
* If the location is remembered as being both dark (waslit is false) * If the location is remembered as being both dark (waslit is false)
* and lit (glyph is a lit room or lit corridor) then it was either: * and lit (glyph is a lit room or lit corridor) then it was either:
* *
* (1) A dark location that the hero could see through night * (1) A dark location that the hero could see through night
* vision. * vision.
* *
* (2) Darkened while out of the hero's sight. This can happen * (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read. * when cursed scroll of light is read.
* *
* In either case, we have to manually correct the hero's memory to * In either case, we have to manually correct the hero's memory to
* match waslit. Deciding when to change waslit is non-trivial. * match waslit. Deciding when to change waslit is non-trivial.
* *
* Note: If flags.lit_corridor is set, then corridors act like room * Note: If flags.lit_corridor is set, then corridors act like room
* squares. That is, they light up if in night vision range. * squares. That is, they light up if in night vision range.
* If flags.lit_corridor is not set, then corridors will * If flags.lit_corridor is not set, then corridors will
* remain dark unless lit by a light spell and may darken * remain dark unless lit by a light spell and may darken
* again, as discussed above. * again, as discussed above.
* *
* These checks and changes must be here and not in back_to_glyph(). * These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight. * They are dependent on the position being out of sight.
@@ -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;
@@ -856,20 +859,20 @@ xchar x, y;
* but explode() wants to delay]. * but explode() wants to delay].
* *
* Call: * Call:
* (DISP_BEAM, glyph) open, initialize glyph * (DISP_BEAM, glyph) open, initialize glyph
* (DISP_FLASH, glyph) open, initialize glyph * (DISP_FLASH, glyph) open, initialize glyph
* (DISP_ALWAYS, glyph) open, initialize glyph * (DISP_ALWAYS, glyph) open, initialize glyph
* (DISP_CHANGE, glyph) change glyph * (DISP_CHANGE, glyph) change glyph
* (DISP_END, 0) close & clean up (second argument doesn't * (DISP_END, 0) close & clean up (second argument doesn't
* matter) * matter)
* (DISP_FREEMEM, 0) only used to prevent memory leak during * (DISP_FREEMEM, 0) only used to prevent memory leak during
* exit) * exit)
* (x, y) display the glyph at the location * (x, y) display the glyph at the location
* *
* DISP_BEAM - Display the given glyph at each location, but do not erase * DISP_BEAM - Display the given glyph at each location, but do not erase
* any until the close call. * any until the close call.
* DISP_FLASH - Display the given glyph at each location, but erase the * DISP_FLASH - Display the given glyph at each location, but erase the
* previous location's glyph. * previous location's glyph.
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account. * DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
*/ */
@@ -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)) {
@@ -1089,9 +1093,9 @@ int mode;
} }
/* /*
* under_ground() * under_ground()
* *
* Very restricted display. You can only see yourself. * Very restricted display. You can only see yourself.
*/ */
void void
under_ground(mode) under_ground(mode)
@@ -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);
}
} }
/* ========================================================================= /* =========================================================================
@@ -1123,17 +1128,17 @@ int mode;
/* /*
* Loop through all of the monsters and update them. Called when: * Loop through all of the monsters and update them. Called when:
* + going blind & telepathic * + going blind & telepathic
* + regaining sight & telepathic * + regaining sight & telepathic
* + getting and losing infravision * + getting and losing infravision
* + hallucinating * + hallucinating
* + doing a full screen redraw * + doing a full screen redraw
* + see invisible times out or a ring of see invisible is taken off * + see invisible times out or a ring of see invisible is taken off
* + when a potion of see invisible is quaffed or a ring of see * + when a potion of see invisible is quaffed or a ring of see
* invisible is put on * invisible is put on
* + gaining telepathy when blind [givit() in eat.c, pleased() in pray.c] * + gaining telepathy when blind [givit() in eat.c, pleased() in pray.c]
* + losing telepathy while blind [xkilled() in mon.c, attrcurse() in * + losing telepathy while blind [xkilled() in mon.c, attrcurse() in
* sit.c] * sit.c]
*/ */
void void
see_monsters() see_monsters()
@@ -1191,7 +1196,7 @@ set_mimic_blocking()
/* /*
* Loop through all of the object *locations* and update them. Called when * Loop through all of the object *locations* and update them. Called when
* + hallucinating. * + hallucinating.
*/ */
void void
see_objects() see_objects()
@@ -1451,7 +1456,7 @@ flush_screen(cursor_on_u)
int cursor_on_u; int cursor_on_u;
{ {
/* Prevent infinite loops on errors: /* Prevent infinite loops on errors:
* flush_screen->print_glyph->impossible->pline->flush_screen * flush_screen->print_glyph->impossible->pline->flush_screen
*/ */
static boolean flushing = 0; static boolean flushing = 0;
static boolean delay_flushing = 0; static boolean delay_flushing = 0;
@@ -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;
} }
/* /*
@@ -1657,10 +1661,10 @@ int loc;
* type has four glyphs, one for each of the symbols below. The order of * type has four glyphs, one for each of the symbols below. The order of
* the zap symbols [0-3] as defined in rm.h are: * the zap symbols [0-3] as defined in rm.h are:
* *
* | S_vbeam ( 0, 1) or ( 0,-1) * | S_vbeam ( 0, 1) or ( 0,-1)
* - S_hbeam ( 1, 0) or (-1, 0) * - S_hbeam ( 1, 0) or (-1, 0)
* \ S_lslant ( 1, 1) or (-1,-1) * \ S_lslant ( 1, 1) or (-1,-1)
* / S_rslant (-1, 1) or ( 1,-1) * / S_rslant (-1, 1) or ( 1,-1)
*/ */
int int
zapdir_to_glyph(dx, dy, beam_type) zapdir_to_glyph(dx, dy, beam_type)
@@ -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 */
+53 -51
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,8 +384,7 @@ struct obj *obj;
{ {
if (has_oname(obj)) if (has_oname(obj))
return ONAME(obj); return ONAME(obj);
else return "";
return "";
} }
/* historical note: this returns a monster pointer because it used to /* historical note: this returns a monster pointer because it used to
@@ -718,8 +717,8 @@ register struct obj *obj;
(void) mungspaces(buf); (void) mungspaces(buf);
if (!*buf) { if (!*buf) {
if (*str1) { /* had name, so possibly remove from disco[] */ if (*str1) { /* had name, so possibly remove from disco[] */
/* strip name first, for the update_inventory() call /* strip name first, for the update_inventory() call
from undiscover_object() */ from undiscover_object() */
*str1 = (char *) 0; *str1 = (char *) 0;
undiscover_object(obj->otyp); undiscover_object(obj->otyp);
} }
@@ -821,20 +820,20 @@ 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 * Amonnam: A newt It An invisible orc Fido
* Amonnam: A newt It An invisible orc Fido * a_monnam: a newt it an invisible orc Fido
* a_monnam: a newt it an invisible orc Fido * m_monnam: newt xan orc Fido
* m_monnam: newt xan orc Fido * y_monnam: your newt your xan your invisible orc Fido
* y_monnam: your newt your xan your invisible orc Fido
*/ */
/* Bug: if the monster is a priest or shopkeeper, not every one of these /* Bug: if the monster is a priest or shopkeeper, not every one of these
@@ -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
+43 -37
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
@@ -582,10 +582,10 @@ boolean pets_only; /* true for ascension or final escape */
if (pets_only) { if (pets_only) {
if (!mtmp->mtame) if (!mtmp->mtame)
continue; /* reject non-pets */ continue; /* reject non-pets */
/* don't block pets from accompanying hero's dungeon /* don't block pets from accompanying hero's dungeon
escape or ascension simply due to mundane trifles; escape or ascension simply due to mundane trifles;
unlike level change for steed, don't bother trying unlike level change for steed, don't bother trying
to achieve a normal trap escape first */ to achieve a normal trap escape first */
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
mtmp->meating = 0; mtmp->meating = 0;
mtmp->msleeping = 0; mtmp->msleeping = 0;
@@ -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;
} }
} }
+5 -5
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));
@@ -1655,8 +1655,8 @@ boolean near_hero;
if (!noscatter) if (!noscatter)
(void) scatter(nx, ny, rnd(2), 0, otmp); (void) scatter(nx, ny, rnd(2), 0, otmp);
} else { /* random location */ } else { /* random location */
/* set dummy coordinates because there's no /* set dummy coordinates because there's no
current position for rloco() to update */ current position for rloco() to update */
otmp->ox = otmp->oy = 0; otmp->ox = otmp->oy = 0;
if (rloco(otmp) && !nobreak && breaktest(otmp)) { if (rloco(otmp) && !nobreak && breaktest(otmp)) {
/* assume it broke before player arrived, no messages */ /* assume it broke before player arrived, no messages */
+163 -128
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,9 +24,10 @@ 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;
@@ -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*/
@@ -338,10 +337,10 @@ struct proto_dungeon *pd;
* or dungeon entrance can occupy. * or dungeon entrance can occupy.
* *
* Note: This follows the acouple (instead of the rcouple) rules for a * Note: This follows the acouple (instead of the rcouple) rules for a
* negative random component (randc < 0). These rules are found * negative random component (randc < 0). These rules are found
* in dgn_comp.y. The acouple [absolute couple] section says that * in dgn_comp.y. The acouple [absolute couple] section says that
* a negative random component means from the (adjusted) base to the * a negative random component means from the (adjusted) base to the
* end of the dungeon. * end of the dungeon.
*/ */
STATIC_OVL int STATIC_OVL int
level_range(dgn, base, randc, chain, pd, adjusted_base) level_range(dgn, base, randc, chain, pd, adjusted_base)
@@ -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;
@@ -810,9 +811,9 @@ void init_dungeons() /* initialize the "dungeon" structs */
/* /*
* Set the entry level for this dungeon. The pd.tmpdungeon entry * Set the entry level for this dungeon. The pd.tmpdungeon entry
* value means: * value means:
* < 0 from bottom (-1 == bottom level) * < 0 from bottom (-1 == bottom level)
* 0 default (top) * 0 default (top)
* > 0 actual level (1 = top) * > 0 actual level (1 = top)
* *
* Note that the entry_lev field in the dungeon structure is * Note that the entry_lev field in the dungeon structure is
* redundant. It is used only here and in print_dungeon(). * redundant. It is used only here and in print_dungeon().
@@ -850,13 +851,13 @@ void init_dungeons() /* initialize the "dungeon" structs */
* Calculate the depth of the top of the dungeon via * Calculate the depth of the top of the dungeon via
* its branch. First, the depth of the entry point: * its branch. First, the depth of the entry point:
* *
* depth of branch from "parent" dungeon * depth of branch from "parent" dungeon
* + -1 or 1 depending on a up or down stair or * + -1 or 1 depending on a up or down stair or
* 0 if portal * 0 if portal
* *
* Followed by the depth of the top of the dungeon: * Followed by the depth of the top of the dungeon:
* *
* - (entry depth - 1) * - (entry depth - 1)
* *
* We'll say that portals stay on the same depth. * We'll say that portals stay on the same depth.
*/ */
@@ -945,7 +946,7 @@ void init_dungeons() /* initialize the "dungeon" structs */
} }
} }
/* /*
* I hate hardwiring these names. :-( * I hate hardwiring these names. :-(
*/ */
quest_dnum = dname_to_dnum("The Quest"); quest_dnum = dname_to_dnum("The Quest");
sokoban_dnum = dname_to_dnum("Sokoban"); sokoban_dnum = dname_to_dnum("Sokoban");
@@ -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,8 +1046,8 @@ 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);
} }
/* return the dungeon that this ledgerno exists in */ /* return the dungeon that this ledgerno exists in */
@@ -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,25 +1387,29 @@ 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);
} }
/* /*
* Return the branch for the given dungeon. * Return the branch for the given dungeon.
* *
* This function assumes: * This function assumes:
* + This is not called with "Dungeons of Doom". * + This is not called with "Dungeons of Doom".
* + There is only _one_ branch to a given dungeon. * + There is only _one_ branch to a given dungeon.
* + Field end2 is the "child" dungeon. * + Field end2 is the "child" dungeon.
*/ */
branch * branch *
dungeon_branch(s) dungeon_branch(s)
@@ -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_wiz3_level(lev));
} }
boolean In_W_tower(x, y, /* is `lev' a level containing the Wizard's tower? */
lev) /* is <x,y> of `lev' inside 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 <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;
{ {
@@ -1453,7 +1478,7 @@ d_level *lev;
/* /*
* Both of the exclusion regions for arriving via level teleport * Both of the exclusion regions for arriving via level teleport
* (from above or below) define the tower's boundary. * (from above or below) define the tower's boundary.
* assert( updest.nIJ == dndest.nIJ for I={l|h},J={x|y} ); * assert( updest.nIJ == dndest.nIJ for I={l|h},J={x|y} );
*/ */
if (dndest.nlx > 0) if (dndest.nlx > 0)
return (boolean) within_bounded_area(x, y, dndest.nlx, dndest.nly, return (boolean) within_bounded_area(x, y, dndest.nlx, dndest.nly,
@@ -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->flags.knownbones || wizard)) || (mptr->final_resting_place
|| mptr->custom || mptr->br && (mptr->flags.knownbones || wizard))
|| mptr->lev.dlevel == dungeons[mptr->lev.dnum].dunlev_ureached); || mptr->custom || mptr->br
|| (mptr->lev.dlevel
== dungeons[mptr->lev.dnum].dunlev_ureached));
} }
/* recalculate mapseen for the current level */ /* recalculate mapseen for the current level */
@@ -2329,20 +2361,23 @@ recalc_mapseen()
switch (lastseentyp[x][y]) { switch (lastseentyp[x][y]) {
#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)
break; mptr->feat.ice = count;
case POOL: break;
case MOAT: case POOL:
case WATER: case MOAT:
count = mptr->feat.water + 1; case WATER:
if (count <= 3) mptr->feat.water = count; count = mptr->feat.water + 1;
break; if (count <= 3)
case LAVAPOOL: mptr->feat.water = count;
count = mptr->feat.lava + 1; break;
if (count <= 3) mptr->feat.lava = count; case LAVAPOOL:
break; count = mptr->feat.lava + 1;
if (count <= 3)
mptr->feat.lava = count;
break;
#endif #endif
case TREE: case TREE:
count = mptr->feat.ntree + 1; count = mptr->feat.ntree + 1;
@@ -2379,16 +2414,16 @@ recalc_mapseen()
if (count <= 3) if (count <= 3)
mptr->feat.naltar = count; mptr->feat.naltar = count;
break; break;
/* An automatic annotation is added to the Castle and /* An automatic annotation is added to the Castle and
* to Fort Ludios once their structure's main entrance * to Fort Ludios once their structure's main entrance
* has been seen (in person or via magic mapping). * has been seen (in person or via magic mapping).
* DOOR: possibly a lowered drawbridge's open portcullis; * DOOR: possibly a lowered drawbridge's open portcullis;
* DBWALL: a raised drawbridge's "closed door"; * DBWALL: a raised drawbridge's "closed door";
* DRAWBRIDGE_DOWN: the span provided by lowered bridge, * DRAWBRIDGE_DOWN: the span provided by lowered bridge,
* with moat or other terrain hidden underneath; * with moat or other terrain hidden underneath;
* DRAWBRIDGE_UP: moat in front of a raised drawbridge, * DRAWBRIDGE_UP: moat in front of a raised drawbridge,
* not recognizable as a bridge location unless/until * not recognizable as a bridge location unless/until
* the adjacent DBWALL has been seen. * the adjacent DBWALL has been seen.
*/ */
case DOOR: case DOOR:
if (is_drawbridge_wall(x, y) < 0) if (is_drawbridge_wall(x, y) < 0)
@@ -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)";
@@ -2753,9 +2788,9 @@ boolean printdun;
buf[0] = 0; buf[0] = 0;
i = 0; /* interest counter */ i = 0; /* interest counter */
/* List interests in an order vaguely corresponding to /* List interests in an order vaguely corresponding to
* how important they are. * how important they are.
*/ */
if (mptr->feat.nshop > 0) { if (mptr->feat.nshop > 0) {
if (mptr->feat.nshop > 1) if (mptr->feat.nshop > 1)
ADDNTOBUF("shop", mptr->feat.nshop); ADDNTOBUF("shop", mptr->feat.nshop);
@@ -2780,9 +2815,9 @@ boolean printdun;
ADDNTOBUF("grave", mptr->feat.ngrave); ADDNTOBUF("grave", mptr->feat.ngrave);
ADDNTOBUF("tree", mptr->feat.ntree); ADDNTOBUF("tree", mptr->feat.ntree);
#if 0 #if 0
ADDTOBUF("water", mptr->feat.water); ADDTOBUF("water", mptr->feat.water);
ADDTOBUF("lava", mptr->feat.lava); ADDTOBUF("lava", mptr->feat.lava);
ADDTOBUF("ice", mptr->feat.ice); ADDTOBUF("ice", mptr->feat.ice);
#endif #endif
/* capitalize afterwards */ /* capitalize afterwards */
i = strlen(PREFIX); i = strlen(PREFIX);
+44 -44
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. */
@@ -563,9 +563,9 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
/* caller handles Int and memory loss */ /* caller handles Int and memory loss */
} else { /* mhitm */ } else { /* mhitm */
/* /*
* monster mind flayer is eating another monster's brain * monster mind flayer is eating another monster's brain
*/ */
if (mindless(pd)) { if (mindless(pd)) {
if (visflag) if (visflag)
pline("%s doesn't notice.", Monnam(mdef)); pline("%s doesn't notice.", Monnam(mdef));
@@ -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,12 +984,11 @@ 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.", an(Upolyd ? youmonst.data->mname : urace.noun));
an(Upolyd ? youmonst.data->mname : urace.noun));
eatmbuf = dupstr(buf); eatmbuf = dupstr(buf);
nomovemsg = eatmbuf; nomovemsg = eatmbuf;
afternmv = eatmdone; afternmv = eatmdone;
@@ -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,13 +1958,14 @@ 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 */
/* can't eat Amulet of Yendor or fakes, /* can't eat Amulet of Yendor or fakes,
* and no oc_prop even if you could -3. * and no oc_prop even if you could -3.
*/ */
break; break;
} }
} }
@@ -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()
{ {
+109 -106
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,18 +167,18 @@ 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) {
case S_GIANT: case S_GIANT:
@@ -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 /*
* of weapon for "normal" monsters. Certain special types * Now the general case, some chance of getting some type
* of monsters will get a bonus chance or different selections. * of weapon for "normal" monsters. Certain special types
*/ * 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,11 +529,12 @@ 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;
/* /*
* Soldiers get armour & rations - armour approximates their ac. * Soldiers get armour & rations - armour approximates their ac.
* Nymphs may get mirror or potion of object detection. * Nymphs may get mirror or potion of object detection.
*/ */
switch (ptr->mlet) { switch (ptr->mlet) {
case S_HUMAN: case S_HUMAN:
@@ -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;
} }
@@ -1008,16 +1011,16 @@ coord *cc;
/* /*
* called with [x,y] = coordinates; * called with [x,y] = coordinates;
* [0,0] means anyplace * [0,0] means anyplace
* [u.ux,u.uy] means: near player (if !in_mklev) * [u.ux,u.uy] means: near player (if !in_mklev)
* *
* In case we make a monster group, only return the one at [x,y]. * In case we make a monster group, only return the one at [x,y].
*/ */
struct monst * 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,15 +1369,15 @@ 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);
} }
/* /*
* shift the probability of a monster's generation by * shift the probability of a monster's generation by
* comparing the dungeon alignment and monster alignment. * comparing the dungeon alignment and monster alignment.
* return an integer in the range of 0-5. * return an integer in the range of 0-5.
*/ */
STATIC_OVL int STATIC_OVL int
align_shift(ptr) align_shift(ptr)
@@ -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))
@@ -1470,8 +1472,8 @@ rndmonst()
rndmonst_state.mchoices[mndx] = (char) ct; rndmonst_state.mchoices[mndx] = (char) ct;
} }
/* /*
* Possible modification: if choice_count is "too low", * Possible modification: if choice_count is "too low",
* expand minmlev..maxmlev range and try again. * expand minmlev..maxmlev range and try again.
*/ */
} /* choice_count+mchoices[] recalc */ } /* choice_count+mchoices[] recalc */
@@ -1482,7 +1484,7 @@ rndmonst()
} }
/* /*
* Now, select a monster at random. * Now, select a monster at random.
*/ */
ct = rnd(rndmonst_state.choice_count); ct = rnd(rndmonst_state.choice_count);
for (mndx = LOW_PM; mndx < SPECIAL_PM; mndx++) for (mndx = LOW_PM; mndx < SPECIAL_PM; mndx++)
@@ -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,10 +1550,10 @@ 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.
*/ */
for (first = LOW_PM; first < SPECIAL_PM; first++) for (first = LOW_PM; first < SPECIAL_PM; first++)
if (mons[first].mlet == class) if (mons[first].mlet == class)
@@ -1569,12 +1569,11 @@ 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.
*/ */
for (num = rnd(num); num > 0; first++) for (num = rnd(num); num > 0; first++)
if (mk_gen_ok(first, G_GONE, mask)) { if (mk_gen_ok(first, G_GONE, mask)) {
@@ -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 */
@@ -1674,12 +1678,12 @@ struct monst *mtmp, *victim;
/* growth limits differ depending on method of advancement */ /* growth limits differ depending on method of advancement */
if (victim) { /* killed a monster */ if (victim) { /* killed a monster */
/* /*
* The HP threshold is the maximum number of hit points for the * The HP threshold is the maximum number of hit points for the
* current level; once exceeded, a level will be gained. * current level; once exceeded, a level will be gained.
* Possible bug: if somehow the hit points are already higher * Possible bug: if somehow the hit points are already higher
* than that, monster will gain a level without any increase in HP. * than that, monster will gain a level without any increase in HP.
*/ */
hp_threshold = mtmp->m_lev * 8; /* normal limit */ hp_threshold = mtmp->m_lev * 8; /* normal limit */
if (!mtmp->m_lev) if (!mtmp->m_lev)
hp_threshold = 4; hp_threshold = 4;
@@ -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
@@ -1838,8 +1842,8 @@ 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;
+6 -8
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,17 +567,15 @@ 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.
*/ */
if (Hallucination) if (Hallucination)
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
break; break;
+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;
+34 -35
View File
@@ -1,5 +1,5 @@
/* 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. */
/* /*
@@ -8,23 +8,22 @@
* *
* Actually the list of instruments / effects is : * Actually the list of instruments / effects is :
* *
* (wooden) flute may calm snakes if player has enough dexterity * (wooden) flute may calm snakes if player has enough dexterity
* 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 * on player level.
* on player level. * (wooden) harp May calm nymph if player has enough dexterity.
* (wooden) harp May calm nymph if player has enough dexterity. * magic harp Charm monsters: area of effect depends on player
* magic harp Charm monsters: area of effect depends on player * level.
* level. * (leather) drum Will awaken monsters like the horn.
* (leather) drum Will awaken monsters like the horn. * drum of earthquake Will initiate an earthquake whose intensity depends
* drum of earthquake Will initiate an earthquake whose intensity depends * on player level. That is, it creates random pits
* on player level. That is, it creates random pits * called here chasms.
* called here chasms.
*/ */
#include "hack.h" #include "hack.h"
@@ -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))
@@ -160,7 +160,7 @@ int distance;
if (canseemon(mtmp)) if (canseemon(mtmp))
pline( pline(
"%s listens cheerfully to the music, then seems quieter.", "%s listens cheerfully to the music, then seems quieter.",
Monnam(mtmp)); Monnam(mtmp));
} }
} }
} }
@@ -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();
+192 -182
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. */
@@ -427,26 +427,26 @@ static char def_inv_order[MAXOCLASSES] = {
/* /*
* Default menu manipulation command accelerators. These may _not_ be: * Default menu manipulation command accelerators. These may _not_ be:
* *
* + a number - reserved for counts * + a number - reserved for counts
* + an upper or lower case US ASCII letter - used for accelerators * + an upper or lower case US ASCII letter - used for accelerators
* + ESC - reserved for escaping the menu * + ESC - reserved for escaping the menu
* + NULL, CR or LF - reserved for commiting the selection(s). NULL * + NULL, CR or LF - reserved for commiting the selection(s). NULL
* is kind of odd, but the tty's xwaitforspace() will return it if * is kind of odd, but the tty's xwaitforspace() will return it if
* someone hits a <ret>. * someone hits a <ret>.
* + a default object class symbol - used for object class accelerators * + a default object class symbol - used for object class accelerators
* *
* Standard letters (for now) are: * Standard letters (for now) are:
* *
* < back 1 page * < back 1 page
* > forward 1 page * > forward 1 page
* ^ first page * ^ first page
* | last page * | last page
* : search * : search
* *
* page all * page all
* , select . * , select .
* \ deselect - * \ deselect -
* ~ invert @ * ~ invert @
* *
* The command name list is duplicated in the compopt array. * The command name list is duplicated in the compopt array.
*/ */
@@ -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
@@ -1332,9 +1333,9 @@ int typ;
int i; int i;
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
@@ -1349,11 +1350,11 @@ query_msgtype()
start_menu(tmpwin); start_menu(tmpwin);
any = zeroany; any = zeroany;
for (i = 0; i < SIZE(msgtype_names); i++) for (i = 0; i < SIZE(msgtype_names); i++)
if (msgtype_names[i].descr) { if (msgtype_names[i].descr) {
any.a_int = msgtype_names[i].msgtyp + 1; any.a_int = msgtype_names[i].msgtyp + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
msgtype_names[i].descr, MENU_UNSELECTED); msgtype_names[i].descr, MENU_UNSELECTED);
} }
end_menu(tmpwin, "How to show the message"); end_menu(tmpwin, "How to show the message");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
@@ -1378,7 +1379,8 @@ char *pattern;
tmp->msgtype = typ; tmp->msgtype = typ;
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;
regex_free(tmp->regex); free((genericptr_t) tmp->pattern);
tmp2 = tmp; regex_free(tmp->regex);
tmp = tmp->next; free((genericptr_t) tmp);
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,8 +1443,9 @@ 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))
tmp = tmp->next; return tmp->msgtype;
tmp = tmp->next;
} }
return MSGTYP_NORMAL; return MSGTYP_NORMAL;
} }
@@ -1455,8 +1457,8 @@ msgtype_count()
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = plinemsg_types;
while (tmp) { while (tmp) {
c++; c++;
tmp = tmp->next; tmp = tmp->next;
} }
return c; return c;
} }
@@ -1469,15 +1471,16 @@ char *str;
char msgtype[11]; char msgtype[11];
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++)
if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) { for (i = 0; i < SIZE(msgtype_names); i++)
typ = msgtype_names[i].msgtyp; if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
break; typ = msgtype_names[i].msgtyp;
} break;
if (typ != -1) }
return msgtype_add(typ, pattern); if (typ != -1)
return msgtype_add(typ, pattern);
} }
return FALSE; return FALSE;
} }
@@ -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
@@ -1861,8 +1866,8 @@ boolean tinitial, tfrom_file;
break; break;
case 'h': /* horse */ case 'h': /* horse */
case 'q': /* quadruped */ case 'q': /* quadruped */
/* avoids giving "unrecognized type of pet" but /* avoids giving "unrecognized type of pet" but
pet_type(dog.c) won't actually honor this */ pet_type(dog.c) won't actually honor this */
preferred_pet = 'h'; preferred_pet = 'h';
break; break;
case 'n': /* no pet */ case 'n': /* no pet */
@@ -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);
@@ -2320,7 +2326,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return; return;
} }
/* if (!(opts = string_for_env_opt(fullname, opts, FALSE))) /* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
*/ */
if (!(opts = string_for_opt(opts, FALSE))) if (!(opts = string_for_opt(opts, FALSE)))
return; return;
@@ -2670,17 +2676,17 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "disclose", 7, TRUE)) { if (match_optname(opts, "disclose", 7, TRUE)) {
/* /*
* The order that the end_disclose options are stored: * The order that the end_disclose options are stored:
* inventory, attribs, vanquished, genocided, * inventory, attribs, vanquished, genocided,
* conduct, overview. * conduct, overview.
* There is an array in flags: * There is an array in flags:
* end_disclose[NUM_DISCLOSURE_OPT]; * end_disclose[NUM_DISCLOSURE_OPT];
* with option settings for the each of the following: * with option settings for the each of the following:
* iagvc [see disclosure_options in decl.c]: * iagvc [see disclosure_options in decl.c]:
* Legal setting values in that array are: * Legal setting values in that array are:
* DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes * DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes
* DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no * DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no
* DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask * DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask
* DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask * DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask
* *
* Those setting values can be used in the option * Those setting values can be used in the option
* string as a prefix to get the desired behaviour. * string as a prefix to get the desired behaviour.
@@ -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,27 +3648,27 @@ 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,
} else if (opt_indx == -5) { fromfile);
(void) special_handling("msgtype", setinitial, fromfile); } else if (opt_indx == -5) {
(void) special_handling("msgtype", setinitial, fromfile);
} else if (opt_indx < boolcount) { } else if (opt_indx < boolcount) {
/* boolean option */ /* boolean option */
Sprintf(buf, "%s%s", *boolopt[opt_indx].addr ? "!" : "", Sprintf(buf, "%s%s", *boolopt[opt_indx].addr ? "!" : "",
@@ -4059,27 +4069,27 @@ boolean setinitial, setfromfile;
if (mhattr != -1) if (mhattr != -1)
iflags.menu_headings = mhattr; iflags.menu_headings = mhattr;
} else if (!strcmp("msgtype", optname)) { } else if (!strcmp("msgtype", optname)) {
int opt_idx, nmt, mttyp; int opt_idx, nmt, mttyp;
char mtbuf[BUFSZ]; char mtbuf[BUFSZ];
msgtypes_again: msgtypes_again:
nmt = msgtype_count(); nmt = msgtype_count();
opt_idx = handle_add_list_remove("message type", nmt); opt_idx = handle_add_list_remove("message type", nmt);
if (opt_idx == 3) { if (opt_idx == 3) {
; /* done--fall through to function exit */ ; /* done--fall through to function exit */
} else if (opt_idx == 0) { /* add new */ } else if (opt_idx == 0) { /* add new */
getlin("What new message pattern?", mtbuf); getlin("What new message pattern?", mtbuf);
if (*mtbuf == '\033' || !*mtbuf) if (*mtbuf == '\033' || !*mtbuf)
goto msgtypes_again; goto msgtypes_again;
mttyp = query_msgtype(); mttyp = query_msgtype();
if (mttyp == -1) if (mttyp == -1)
goto msgtypes_again; goto msgtypes_again;
if (!msgtype_add(mttyp, mtbuf)) { if (!msgtype_add(mttyp, mtbuf)) {
pline("Error adding the message type."); pline("Error adding the message type.");
wait_synch(); wait_synch();
goto msgtypes_again; goto msgtypes_again;
} }
} else { /* list or remove */ } else { /* list or remove */
int pick_idx, pick_cnt; int pick_idx, pick_cnt;
int mt_idx; int mt_idx;
menu_item *pick_list = (menu_item *) 0; menu_item *pick_list = (menu_item *) 0;
@@ -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
@@ -4112,7 +4124,7 @@ boolean setinitial, setfromfile;
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
if (pick_cnt >= 0) if (pick_cnt >= 0)
goto msgtypes_again; goto msgtypes_again;
} }
} else if (!strcmp("menucolors", optname)) { } else if (!strcmp("menucolors", optname)) {
int opt_idx, nmc, mcclr, mcattr; int opt_idx, nmc, mcclr, mcattr;
char mcbuf[BUFSZ]; char mcbuf[BUFSZ];
@@ -4535,39 +4547,34 @@ 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 ? "ascii4x6"
? "ascii4x6" : iflags.wc_map_mode == MAP_MODE_ASCII6x8
: iflags.wc_map_mode == MAP_MODE_ASCII6x8 ? "ascii6x8"
? "ascii6x8" : iflags.wc_map_mode == MAP_MODE_ASCII8x8
: iflags.wc_map_mode == MAP_MODE_ASCII8x8 ? "ascii8x8"
? "ascii8x8" : iflags.wc_map_mode == MAP_MODE_ASCII16x8
: iflags.wc_map_mode == MAP_MODE_ASCII16x8 ? "ascii16x8"
? "ascii16x8" : iflags.wc_map_mode == MAP_MODE_ASCII7x12
: iflags.wc_map_mode ? "ascii7x12"
== MAP_MODE_ASCII7x12 : iflags.wc_map_mode == MAP_MODE_ASCII8x12
? "ascii7x12" ? "ascii8x12"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII8x12 == MAP_MODE_ASCII16x12
? "ascii8x12" ? "ascii16x12"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII16x12 == MAP_MODE_ASCII12x16
? "ascii16x12" ? "ascii12x16"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII12x16 == MAP_MODE_ASCII10x18
? "ascii12x16" ? "ascii10x18"
: iflags.wc_map_mode : iflags.wc_map_mode
== MAP_MODE_ASCII10x18 == MAP_MODE_ASCII_FIT_TO_SCREEN
? "asci" ? "fit_to_screen"
"i10x" : defopt);
"18"
: iflags.wc_map_mode
== MAP_MODE_ASCII_FIT_TO_SCREEN
? "fit_to_screen"
: defopt);
else if (!strcmp(optname, "menustyle")) else if (!strcmp(optname, "menustyle"))
Sprintf(buf, "%s", menutype[(int) flags.menu_style]); Sprintf(buf, "%s", menutype[(int) flags.menu_style]);
else if (!strcmp(optname, "menu_deselect_all")) else if (!strcmp(optname, "menu_deselect_all"))
@@ -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;
@@ -5229,19 +5232,19 @@ nonew:
* (Benefits users whose first exposure to NetHack is via tiles). * (Benefits users whose first exposure to NetHack is via tiles).
* *
* prompt * prompt
* The title at the top of the menu. * The title at the top of the menu.
* *
* category: 0 = monster class * category: 0 = monster class
* 1 = object class * 1 = object class
* *
* way * way
* FALSE = PICK_ONE, TRUE = PICK_ANY * FALSE = PICK_ONE, TRUE = PICK_ANY
* *
* class_list * class_list
* a null terminated string containing the list of choices. * a null terminated string containing the list of choices.
* *
* class_selection * class_selection
* a null terminated string containing the selected characters. * a null terminated string containing the selected characters.
* *
* Returns number selected. * Returns number selected.
*/ */
@@ -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;