trap.c reformatting
Monstly changing '<type>* <var>' to '<type> *<var>'. Wrap or shorten a few wide lines. One of the rolling boulder routines accessed gb.bhitpos.x,y many times; change that to use local x,y instead.
This commit is contained in:
272
src/trap.c
272
src/trap.c
@@ -67,7 +67,8 @@ static void untrap_box(struct obj *, boolean, boolean);
|
||||
#if 0
|
||||
static void join_adjacent_pits(struct trap *);
|
||||
#endif
|
||||
static boolean thitm(int, struct monst *, struct obj *, int, boolean) NONNULLARG2;
|
||||
static boolean thitm(int, struct monst *, struct obj *, int,
|
||||
boolean) NONNULLARG2;
|
||||
static void maybe_finish_sokoban(void);
|
||||
|
||||
static const char *const a_your[2] = { "a", "your" };
|
||||
@@ -81,7 +82,7 @@ static const char *const blindgas[6] = { "humid", "odorless",
|
||||
/* called when you're hit by fire (dofiretrap,buzz,zapyourself,explode);
|
||||
returns TRUE if hit on torso */
|
||||
boolean
|
||||
burnarmor(struct monst* victim)
|
||||
burnarmor(struct monst *victim)
|
||||
{
|
||||
struct obj *item;
|
||||
char buf[BUFSZ];
|
||||
@@ -971,7 +972,7 @@ mu_maybe_destroy_web(
|
||||
|
||||
/* make a single arrow/dart/rock for a trap to shoot or drop */
|
||||
static struct obj *
|
||||
t_missile(int otyp, struct trap* trap)
|
||||
t_missile(int otyp, struct trap *trap)
|
||||
{
|
||||
struct obj *otmp = mksobj(otyp, TRUE, FALSE);
|
||||
|
||||
@@ -1012,7 +1013,7 @@ reset_utrap(boolean msg)
|
||||
}
|
||||
}
|
||||
|
||||
/* is trap type ttyp triggered by touching the floor? */
|
||||
/* is trap type ttyp triggered by touching the floor? */
|
||||
static boolean
|
||||
floor_trigger(int ttyp)
|
||||
{
|
||||
@@ -1191,8 +1192,8 @@ trapeffect_arrow_trap(
|
||||
|
||||
static int
|
||||
trapeffect_dart_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags UNUSED)
|
||||
{
|
||||
struct obj *otmp;
|
||||
@@ -1920,8 +1921,8 @@ trapeffect_pit(
|
||||
|
||||
static int
|
||||
trapeffect_hole(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -1979,8 +1980,8 @@ trapeffect_hole(
|
||||
|
||||
static int
|
||||
trapeffect_telep_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags UNUSED)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -1997,8 +1998,8 @@ trapeffect_telep_trap(
|
||||
|
||||
static int
|
||||
trapeffect_level_telep(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2015,8 +2016,8 @@ trapeffect_level_telep(
|
||||
|
||||
static int
|
||||
trapeffect_web(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2184,8 +2185,8 @@ trapeffect_web(
|
||||
|
||||
static int
|
||||
trapeffect_statue_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags UNUSED)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2198,8 +2199,8 @@ trapeffect_statue_trap(
|
||||
|
||||
static int
|
||||
trapeffect_magic_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2339,8 +2340,8 @@ trapeffect_anti_magic(
|
||||
|
||||
static int
|
||||
trapeffect_poly_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2390,8 +2391,8 @@ trapeffect_poly_trap(
|
||||
|
||||
static int
|
||||
trapeffect_landmine(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2440,7 +2441,7 @@ trapeffect_landmine(
|
||||
exercise(A_DEX, FALSE);
|
||||
}
|
||||
/* add a pit before calling losehp so bones won't keep the landmine;
|
||||
* blow_up_landmine will remove the pit afterwards if inappropriate */
|
||||
blow_up_landmine() will remove pit afterwards if inappropriate */
|
||||
trap->ttyp = PIT;
|
||||
trap->madeby_u = FALSE;
|
||||
losehp(Maybe_Half_Phys(rnd(16)), "land mine", KILLED_BY_AN);
|
||||
@@ -2515,8 +2516,8 @@ trapeffect_landmine(
|
||||
|
||||
static int
|
||||
trapeffect_rolling_boulder_trap(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags UNUSED)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2565,8 +2566,8 @@ trapeffect_rolling_boulder_trap(
|
||||
|
||||
static int
|
||||
trapeffect_magic_portal(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
@@ -2580,14 +2581,14 @@ trapeffect_magic_portal(
|
||||
|
||||
static int
|
||||
trapeffect_vibrating_square(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags UNUSED)
|
||||
{
|
||||
if (mtmp == &gy.youmonst) {
|
||||
feeltrap(trap);
|
||||
/* messages handled elsewhere; the trap symbol is merely to mark the
|
||||
* square for future reference */
|
||||
square for future reference */
|
||||
} else {
|
||||
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
|
||||
boolean see_it = cansee(mtmp->mx, mtmp->my);
|
||||
@@ -2789,8 +2790,8 @@ immune_to_trap(struct monst *mon, unsigned ttype)
|
||||
|
||||
static int
|
||||
trapeffect_selector(
|
||||
struct monst* mtmp,
|
||||
struct trap* trap,
|
||||
struct monst *mtmp,
|
||||
struct trap *trap,
|
||||
unsigned int trflags)
|
||||
{
|
||||
switch (trap->ttyp) {
|
||||
@@ -2909,7 +2910,7 @@ dotrap(struct trap *trap, unsigned trflags)
|
||||
}
|
||||
|
||||
static char *
|
||||
trapnote(struct trap* trap, boolean noprefix)
|
||||
trapnote(struct trap *trap, boolean noprefix)
|
||||
{
|
||||
static const char *const tnnames[] = {
|
||||
"C note", "D flat", "D note", "E flat",
|
||||
@@ -3018,7 +3019,7 @@ steedintrap(struct trap *trap, struct obj *otmp)
|
||||
|
||||
/* some actions common to both player and monsters for triggered landmine */
|
||||
void
|
||||
blow_up_landmine(struct trap* trap)
|
||||
blow_up_landmine(struct trap *trap)
|
||||
{
|
||||
coordxy x = trap->tx, y = trap->ty, dbx, dby;
|
||||
struct rm *lev = &levl[x][y];
|
||||
@@ -3064,7 +3065,7 @@ blow_up_landmine(struct trap* trap)
|
||||
}
|
||||
|
||||
static void
|
||||
launch_drop_spot(struct obj* obj, coordxy x, coordxy y)
|
||||
launch_drop_spot(struct obj *obj, coordxy x, coordxy y)
|
||||
{
|
||||
if (!obj) {
|
||||
gl.launchplace.obj = (struct obj *) 0;
|
||||
@@ -3111,12 +3112,10 @@ launch_obj(
|
||||
struct monst *mtmp;
|
||||
struct obj *otmp, *otmp2;
|
||||
int dx, dy;
|
||||
coordxy x, y;
|
||||
struct obj *singleobj;
|
||||
boolean used_up = FALSE;
|
||||
boolean otherside = FALSE;
|
||||
int dist;
|
||||
int tmp;
|
||||
int delaycnt = 0;
|
||||
boolean used_up = FALSE, otherside = FALSE;
|
||||
int dist, tmp, delaycnt = 0;
|
||||
|
||||
otmp = sobj_at(otyp, x1, y1);
|
||||
/* Try the other side too, for rolling boulder traps */
|
||||
@@ -3157,8 +3156,8 @@ launch_obj(
|
||||
sizeof(struct dig_info));
|
||||
|
||||
dist = distmin(x1, y1, x2, y2);
|
||||
gb.bhitpos.x = x1;
|
||||
gb.bhitpos.y = y1;
|
||||
x = gb.bhitpos.x = x1;
|
||||
y = gb.bhitpos.y = y1;
|
||||
dx = sgn(x2 - x1);
|
||||
dy = sgn(y2 - y1);
|
||||
switch (style) {
|
||||
@@ -3189,10 +3188,10 @@ launch_obj(
|
||||
default:
|
||||
if (!delaycnt)
|
||||
delaycnt = 1;
|
||||
if (!cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
if (!cansee(x, y))
|
||||
curs_on_u();
|
||||
tmp_at(DISP_FLASH, obj_to_glyph(singleobj, rn2_on_display_rng));
|
||||
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
|
||||
tmp_at(x, y);
|
||||
}
|
||||
/* Mark a spot to place object in bones files to prevent
|
||||
* loss of object. Use the starting spot to ensure that
|
||||
@@ -3202,27 +3201,27 @@ launch_obj(
|
||||
* that would prevent it from ever getting there (bars), and we
|
||||
* can't tell that yet.
|
||||
*/
|
||||
launch_drop_spot(singleobj, gb.bhitpos.x, gb.bhitpos.y);
|
||||
launch_drop_spot(singleobj, x, y);
|
||||
|
||||
/* Set the object in motion */
|
||||
while (dist-- > 0 && !used_up) {
|
||||
struct trap *t;
|
||||
|
||||
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
|
||||
tmp_at(x, y);
|
||||
tmp = delaycnt;
|
||||
|
||||
/* dstage@u.washington.edu -- Delay only if hero sees it */
|
||||
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
if (cansee(x, y))
|
||||
while (tmp-- > 0)
|
||||
nh_delay_output();
|
||||
|
||||
gb.bhitpos.x += dx;
|
||||
gb.bhitpos.y += dy;
|
||||
x = (gb.bhitpos.x += dx);
|
||||
y = (gb.bhitpos.y += dy);
|
||||
|
||||
if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != 0) {
|
||||
if ((mtmp = m_at(x, y)) != 0) {
|
||||
if (otyp == BOULDER && throws_rocks(mtmp->data)) {
|
||||
if (rn2(3)) {
|
||||
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
if (cansee(x, y))
|
||||
pline("%s snatches the boulder.", Monnam(mtmp));
|
||||
singleobj->otrapped = 0;
|
||||
(void) mpickobj(mtmp, singleobj);
|
||||
@@ -3237,7 +3236,7 @@ launch_obj(
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
} else if (u_at(gb.bhitpos.x, gb.bhitpos.y)) {
|
||||
} else if (u_at(x, y)) {
|
||||
if (gm.multi)
|
||||
nomul(0);
|
||||
if (thitu(9 + singleobj->spe, dmgval(singleobj, &gy.youmonst),
|
||||
@@ -3245,14 +3244,15 @@ launch_obj(
|
||||
stop_occupation();
|
||||
}
|
||||
if (style == ROLL) {
|
||||
if (down_gate(gb.bhitpos.x, gb.bhitpos.y) != -1) {
|
||||
if (ship_object(singleobj, gb.bhitpos.x, gb.bhitpos.y, FALSE)) {
|
||||
if (down_gate(x, y) != -1) {
|
||||
if (ship_object(singleobj, x, y, FALSE)) {
|
||||
used_up = TRUE;
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((t = t_at(gb.bhitpos.x, gb.bhitpos.y)) != 0 && otyp == BOULDER) {
|
||||
if ((t = t_at(x, y)) != 0
|
||||
&& otyp == BOULDER) {
|
||||
int newlev = 0;
|
||||
d_level dest;
|
||||
|
||||
@@ -3260,20 +3260,20 @@ launch_obj(
|
||||
case LANDMINE:
|
||||
if (rn2(10) > 2) {
|
||||
pline("KAABLAMM!!!%s",
|
||||
cansee(gb.bhitpos.x, gb.bhitpos.y)
|
||||
cansee(x, y)
|
||||
? " The rolling boulder triggers a land mine."
|
||||
: "");
|
||||
deltrap(t);
|
||||
del_engr_at(gb.bhitpos.x, gb.bhitpos.y);
|
||||
place_object(singleobj, gb.bhitpos.x, gb.bhitpos.y);
|
||||
del_engr_at(x, y);
|
||||
place_object(singleobj, x, y);
|
||||
singleobj->otrapped = 0;
|
||||
fracture_rock(singleobj);
|
||||
(void) scatter(gb.bhitpos.x, gb.bhitpos.y, 4,
|
||||
(void) scatter(x, y, 4,
|
||||
MAY_DESTROY | MAY_HIT | MAY_FRACTURE
|
||||
| VIS_EFFECTS,
|
||||
(struct obj *) 0);
|
||||
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
newsym(gb.bhitpos.x, gb.bhitpos.y);
|
||||
if (cansee(x, y))
|
||||
newsym(x, y);
|
||||
used_up = TRUE;
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
}
|
||||
@@ -3287,7 +3287,7 @@ launch_obj(
|
||||
break;
|
||||
/*FALLTHRU*/
|
||||
case TELEP_TRAP:
|
||||
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
if (cansee(x, y))
|
||||
pline("Suddenly the rolling boulder disappears!");
|
||||
else if (!Deaf)
|
||||
You_hear("a rumbling stop abruptly.");
|
||||
@@ -3311,7 +3311,7 @@ launch_obj(
|
||||
case TRAPDOOR:
|
||||
/* the boulder won't be used up if there is a
|
||||
monster in the trap; stop rolling anyway */
|
||||
x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* stops here */
|
||||
x2 = x, y2 = y; /* stops here */
|
||||
if (flooreffects(singleobj, x2, y2, "fall")) {
|
||||
used_up = TRUE;
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
@@ -3325,47 +3325,45 @@ launch_obj(
|
||||
if (used_up || dist == -1)
|
||||
break; /* from 'while' loop */
|
||||
}
|
||||
if (flooreffects(singleobj, gb.bhitpos.x, gb.bhitpos.y, "fall")) {
|
||||
if (flooreffects(singleobj, x, y, "fall")) {
|
||||
used_up = TRUE;
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
if (otyp == BOULDER
|
||||
&& (otmp2 = sobj_at(BOULDER, gb.bhitpos.x, gb.bhitpos.y)) != 0) {
|
||||
if (otyp == BOULDER && (otmp2 = sobj_at(BOULDER, x, y)) != 0) {
|
||||
const char *bmsg = " as one boulder sets another in motion";
|
||||
coordxy fx = x + dx, fy = y + dy;
|
||||
|
||||
if (!isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy) || !dist
|
||||
|| IS_ROCK(levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ))
|
||||
if (!isok(fx, fy) || !dist || IS_ROCK(levl[fx][fy].typ))
|
||||
bmsg = " as one boulder hits another";
|
||||
|
||||
Soundeffect(se_loud_crash, 80);
|
||||
You_hear("a loud crash%s!",
|
||||
cansee(gb.bhitpos.x, gb.bhitpos.y) ? bmsg : "");
|
||||
You_hear("a loud crash%s!", cansee(fx, fy) ? bmsg : "");
|
||||
obj_extract_self(otmp2);
|
||||
/* pass off the otrapped flag to the next boulder */
|
||||
otmp2->otrapped = singleobj->otrapped;
|
||||
singleobj->otrapped = 0;
|
||||
place_object(singleobj, gb.bhitpos.x, gb.bhitpos.y);
|
||||
place_object(singleobj, fx, fy);
|
||||
singleobj = otmp2;
|
||||
otmp2 = (struct obj *) 0;
|
||||
wake_nearto(gb.bhitpos.x, gb.bhitpos.y, 10 * 10);
|
||||
wake_nearto(fx, fy, 10 * 10);
|
||||
}
|
||||
}
|
||||
if (otyp == BOULDER && closed_door(gb.bhitpos.x, gb.bhitpos.y)) {
|
||||
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
|
||||
if (otyp == BOULDER && closed_door(x, y)) {
|
||||
if (cansee(x, y))
|
||||
pline_The("boulder crashes through a door.");
|
||||
levl[gb.bhitpos.x][gb.bhitpos.y].doormask = D_BROKEN;
|
||||
levl[x][y].doormask = D_BROKEN;
|
||||
if (dist)
|
||||
unblock_point(gb.bhitpos.x, gb.bhitpos.y);
|
||||
unblock_point(x, y);
|
||||
}
|
||||
|
||||
/* if about to hit something, do so now */
|
||||
if (dist > 0 && isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy)) {
|
||||
coordxy fx = gb.bhitpos.x + dx, fy = gb.bhitpos.y + dy;
|
||||
if (dist > 0 && isok(x + dx, y + dy)) {
|
||||
coordxy fx = x + dx, fy = y + dy;
|
||||
uchar typ = levl[fx][fy].typ;
|
||||
|
||||
if (typ == IRONBARS) {
|
||||
x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* object stops here */
|
||||
x2 = x, y2 = y; /* object stops here */
|
||||
if (hits_bars(&singleobj, x2, y2, fx, fy, !rn2(20), 0)) {
|
||||
if (!singleobj) {
|
||||
used_up = TRUE;
|
||||
@@ -3374,13 +3372,13 @@ launch_obj(
|
||||
break;
|
||||
}
|
||||
} else if (IS_STWALL(typ) || IS_TREE(typ)) {
|
||||
x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* object stops here */
|
||||
x2 = x, y2 = y; /* object stops here */
|
||||
if (!Deaf)
|
||||
pline("Thump!");
|
||||
wake_nearto(x2, y2, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* while dist > 0 */
|
||||
tmp_at(DISP_END, 0);
|
||||
launch_drop_spot((struct obj *) 0, 0, 0);
|
||||
if (!used_up) {
|
||||
@@ -3388,12 +3386,12 @@ launch_obj(
|
||||
place_object(singleobj, x2, y2);
|
||||
newsym(x2, y2);
|
||||
return 1;
|
||||
} else
|
||||
return 2;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
void
|
||||
seetrap(struct trap* trap)
|
||||
seetrap(struct trap *trap)
|
||||
{
|
||||
if (!trap->tseen) {
|
||||
trap->tseen = 1;
|
||||
@@ -3403,7 +3401,7 @@ seetrap(struct trap* trap)
|
||||
|
||||
/* like seetrap() but overrides vision */
|
||||
void
|
||||
feeltrap(struct trap* trap)
|
||||
feeltrap(struct trap *trap)
|
||||
{
|
||||
trap->tseen = 1;
|
||||
map_trap(trap, 1);
|
||||
@@ -3442,7 +3440,7 @@ find_random_launch_coord(struct trap *ttmp, coord *cc)
|
||||
if (ttmp->ttyp == ROLLING_BOULDER_TRAP)
|
||||
mindist = 2;
|
||||
distance = rn1(5, 4); /* 4..8 away */
|
||||
tmp = rn2(N_DIRS); /* randomly pick a direction to try first */
|
||||
tmp = rn2(N_DIRS); /* randomly pick a direction to try first */
|
||||
while (distance >= mindist) {
|
||||
dx = xdir[tmp];
|
||||
dy = ydir[tmp];
|
||||
@@ -3554,8 +3552,7 @@ mintrap(struct monst *mtmp, unsigned mintrapflags)
|
||||
|| trap->ttyp == HOLE
|
||||
|| trap->ttyp == WEB)) {
|
||||
/* If you come upon an obviously trapped monster, then
|
||||
* you must be able to see the trap it's in too.
|
||||
*/
|
||||
you must be able to see the trap it's in too. */
|
||||
seetrap(trap);
|
||||
}
|
||||
|
||||
@@ -4248,20 +4245,12 @@ domagictrap(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set an item on fire.
|
||||
* "force" means not to roll a luck-based protection check for the
|
||||
* item.
|
||||
* "x" and "y" are the coordinates to dump the contents of a
|
||||
* container, if it burns up.
|
||||
*
|
||||
* Return whether the object was destroyed.
|
||||
*/
|
||||
/* Set an item on fire. Return whether the object was destroyed. */
|
||||
boolean
|
||||
fire_damage(
|
||||
struct obj *obj,
|
||||
boolean force,
|
||||
coordxy x,
|
||||
coordxy y)
|
||||
boolean force, /* if True, skip luck-based protection check */
|
||||
coordxy x, coordxy y) /* where to place contents of burned up container */
|
||||
{
|
||||
int chance;
|
||||
struct obj *otmp, *ncobj;
|
||||
@@ -4352,8 +4341,7 @@ fire_damage_chain(
|
||||
struct obj *chain,
|
||||
boolean force,
|
||||
boolean here,
|
||||
coordxy x,
|
||||
coordxy y)
|
||||
coordxy x, coordxy y)
|
||||
{
|
||||
struct obj *obj, *nobj;
|
||||
int num = 0;
|
||||
@@ -4375,7 +4363,7 @@ fire_damage_chain(
|
||||
|
||||
/* obj has been thrown or dropped into lava; damage is worse than mere fire */
|
||||
boolean
|
||||
lava_damage(struct obj* obj, coordxy x, coordxy y)
|
||||
lava_damage(struct obj *obj, coordxy x, coordxy y)
|
||||
{
|
||||
int otyp = obj->otyp, ocls = obj->oclass;
|
||||
|
||||
@@ -4417,7 +4405,7 @@ lava_damage(struct obj* obj, coordxy x, coordxy y)
|
||||
}
|
||||
|
||||
void
|
||||
acid_damage(struct obj* obj)
|
||||
acid_damage(struct obj *obj)
|
||||
{
|
||||
/* Scrolls but not spellbooks can be erased by acid. */
|
||||
struct monst *victim;
|
||||
@@ -4456,16 +4444,12 @@ acid_damage(struct obj* obj)
|
||||
}
|
||||
|
||||
/* Get an object wet and damage it appropriately.
|
||||
* "obj": if null, returns ER_NOTHING
|
||||
* "ostr", if present, is used instead of the object name in some messages.
|
||||
* "force" means not to roll luck to protect some objects.
|
||||
* Returns an erosion return value (ER_*)
|
||||
*/
|
||||
Returns an erosion return value (ER_*). */
|
||||
int
|
||||
water_damage(
|
||||
struct obj *obj,
|
||||
const char *ostr,
|
||||
boolean force)
|
||||
struct obj *obj, /* might be Null; return ER_NOTHING if so */
|
||||
const char *ostr, /* if non-Null, use instead of cxname() in messages */
|
||||
boolean force) /* if True, skip luck-based protection check */
|
||||
{
|
||||
boolean in_invent = obj && carried(obj), described = FALSE;
|
||||
|
||||
@@ -5209,10 +5193,7 @@ move_into_trap(struct trap *ttmp)
|
||||
}
|
||||
}
|
||||
|
||||
/* 0: doesn't even try
|
||||
* 1: tries and fails
|
||||
* 2: succeeds
|
||||
*/
|
||||
/* 0: doesn't even try; 1: tries and fails; 2: succeeds */
|
||||
static int
|
||||
try_disarm(
|
||||
struct trap *ttmp,
|
||||
@@ -5303,7 +5284,7 @@ try_disarm(
|
||||
}
|
||||
|
||||
static void
|
||||
reward_untrap(struct trap* ttmp, struct monst* mtmp)
|
||||
reward_untrap(struct trap *ttmp, struct monst *mtmp)
|
||||
{
|
||||
if (!ttmp->madeby_u) {
|
||||
if (rnl(10) < 8 && !mtmp->mpeaceful && !helpless(mtmp)
|
||||
@@ -5314,8 +5295,8 @@ reward_untrap(struct trap* ttmp, struct monst* mtmp)
|
||||
set_malign(mtmp); /* reset alignment */
|
||||
pline("%s is grateful.", Monnam(mtmp));
|
||||
}
|
||||
/* Helping someone out of a trap is a nice thing to do,
|
||||
* A lawful may be rewarded, but not too often. */
|
||||
/* Helping someone out of a trap is a nice thing to do.
|
||||
A lawful may be rewarded, but not too often. */
|
||||
if (!rn2(3) && !rnl(8) && u.ualign.type == A_LAWFUL) {
|
||||
adjalign(1);
|
||||
You_feel("that you did the right thing.");
|
||||
@@ -5367,7 +5348,7 @@ disarm_holdingtrap(struct trap *ttmp)
|
||||
}
|
||||
|
||||
static int
|
||||
disarm_landmine(struct trap* ttmp) /* Helge Hafting */
|
||||
disarm_landmine(struct trap *ttmp) /* Helge Hafting */
|
||||
{
|
||||
int fails = try_disarm(ttmp, FALSE);
|
||||
|
||||
@@ -5380,7 +5361,7 @@ disarm_landmine(struct trap* ttmp) /* Helge Hafting */
|
||||
|
||||
/* getobj callback for object to disarm a squeaky board with */
|
||||
static int
|
||||
unsqueak_ok(struct obj* obj)
|
||||
unsqueak_ok(struct obj *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return GETOBJ_EXCLUDE;
|
||||
@@ -5403,7 +5384,7 @@ unsqueak_ok(struct obj* obj)
|
||||
|
||||
/* it may not make much sense to use grease on floor boards, but so what? */
|
||||
static int
|
||||
disarm_squeaky_board(struct trap* ttmp)
|
||||
disarm_squeaky_board(struct trap *ttmp)
|
||||
{
|
||||
struct obj *obj;
|
||||
boolean bad_tool;
|
||||
@@ -5437,7 +5418,7 @@ disarm_squeaky_board(struct trap* ttmp)
|
||||
|
||||
/* removes traps that shoot arrows, darts, etc. */
|
||||
static int
|
||||
disarm_shooting_trap(struct trap* ttmp, int otyp)
|
||||
disarm_shooting_trap(struct trap *ttmp, int otyp)
|
||||
{
|
||||
int fails = try_disarm(ttmp, FALSE);
|
||||
|
||||
@@ -5851,8 +5832,9 @@ untrap(
|
||||
boolean
|
||||
openholdingtrap(
|
||||
struct monst *mon,
|
||||
boolean *noticed) /* set to true iff hero notices the effect; */
|
||||
{ /* otherwise left with its previous value intact */
|
||||
boolean *noticed) /* set to true iff hero notices the effect;
|
||||
* otherwise left with its previous value intact */
|
||||
{
|
||||
struct trap *t;
|
||||
char buf[BUFSZ], whichbuf[20];
|
||||
const char *trapdescr = 0, *which = 0;
|
||||
@@ -5950,8 +5932,9 @@ openholdingtrap(
|
||||
boolean
|
||||
closeholdingtrap(
|
||||
struct monst *mon,
|
||||
boolean *noticed) /* set to true iff hero notices the effect; */
|
||||
{ /* otherwise left with its previous value intact */
|
||||
boolean *noticed) /* set to true iff hero notices the effect;
|
||||
* otherwise left with its previous value intact */
|
||||
{
|
||||
struct trap *t;
|
||||
unsigned dotrapflags;
|
||||
boolean ishero = (mon == &gy.youmonst), result;
|
||||
@@ -6259,9 +6242,9 @@ count_traps(int ttyp)
|
||||
}
|
||||
|
||||
void
|
||||
deltrap(register struct trap* trap)
|
||||
deltrap(struct trap *trap)
|
||||
{
|
||||
register struct trap *ttmp;
|
||||
struct trap *ttmp;
|
||||
|
||||
clear_conjoined_pits(trap);
|
||||
if (trap == gf.ftrap) {
|
||||
@@ -6307,7 +6290,7 @@ conjoined_pits(
|
||||
}
|
||||
|
||||
static void
|
||||
clear_conjoined_pits(struct trap* trap)
|
||||
clear_conjoined_pits(struct trap *trap)
|
||||
{
|
||||
int diridx, adjidx;
|
||||
coordxy x, y;
|
||||
@@ -6331,7 +6314,7 @@ clear_conjoined_pits(struct trap* trap)
|
||||
}
|
||||
|
||||
static boolean
|
||||
adj_nonconjoined_pit(struct trap* adjtrap)
|
||||
adj_nonconjoined_pit(struct trap *adjtrap)
|
||||
{
|
||||
struct trap *trap_with_u = t_at(u.ux0, u.uy0);
|
||||
|
||||
@@ -6349,7 +6332,7 @@ adj_nonconjoined_pit(struct trap* adjtrap)
|
||||
* (currently not called from anywhere)
|
||||
*/
|
||||
static void
|
||||
join_adjacent_pits(struct trap* trap)
|
||||
join_adjacent_pits(struct trap *trap)
|
||||
{
|
||||
struct trap *t;
|
||||
int diridx;
|
||||
@@ -6375,7 +6358,7 @@ join_adjacent_pits(struct trap* trap)
|
||||
* Returns TRUE if you escaped a pit and are standing on the precipice.
|
||||
*/
|
||||
boolean
|
||||
uteetering_at_seen_pit(struct trap* trap)
|
||||
uteetering_at_seen_pit(struct trap *trap)
|
||||
{
|
||||
return (trap && is_pit(trap->ttyp) && trap->tseen
|
||||
&& u_at(trap->tx, trap->ty)
|
||||
@@ -6387,7 +6370,7 @@ uteetering_at_seen_pit(struct trap* trap)
|
||||
* release a trap door
|
||||
*/
|
||||
boolean
|
||||
uescaped_shaft(struct trap* trap)
|
||||
uescaped_shaft(struct trap *trap)
|
||||
{
|
||||
return (trap && is_hole(trap->ttyp) && trap->tseen
|
||||
&& u_at(trap->tx, trap->ty));
|
||||
@@ -6395,7 +6378,7 @@ uescaped_shaft(struct trap* trap)
|
||||
|
||||
/* Destroy a trap that emanates from the floor. */
|
||||
boolean
|
||||
delfloortrap(struct trap* ttmp)
|
||||
delfloortrap(struct trap *ttmp)
|
||||
{
|
||||
/* some of these are arbitrary -dlc */
|
||||
if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP)
|
||||
@@ -6421,7 +6404,7 @@ delfloortrap(struct trap* ttmp)
|
||||
|
||||
/* used for doors (also tins). can be used for anything else that opens. */
|
||||
void
|
||||
b_trapped(const char* item, int bodypart)
|
||||
b_trapped(const char *item, int bodypart)
|
||||
{
|
||||
int lvl = level_difficulty(),
|
||||
dmg = rnd(5 + (lvl < 5 ? lvl : 2 + lvl / 2));
|
||||
@@ -6463,7 +6446,8 @@ thitm(
|
||||
pline("%s is almost hit by %s!", Monnam(mon), doname(obj));
|
||||
} else {
|
||||
int dam = 1;
|
||||
boolean harmless = (obj && stone_missile(obj) && passes_rocks(mon->data));
|
||||
boolean harmless = (obj && stone_missile(obj)
|
||||
&& passes_rocks(mon->data));
|
||||
|
||||
if (obj && cansee(mon->mx, mon->my))
|
||||
pline("%s is hit by %s%s", Monnam(mon), doname(obj),
|
||||
@@ -6550,7 +6534,7 @@ lava_effects(void)
|
||||
for (obj = gi.invent; obj; obj = obj->nobj) {
|
||||
if (obj->in_use) { /* remove_worn_item() sets in_use */
|
||||
/* one item can be protected from burning up [accommodates
|
||||
steal(AMULET_OF_FLYING) -> remove_worn_item() -> drop
|
||||
steal(AMULET_OF_FLYING) -> remove_worn_item() -> fall
|
||||
into lava (which happens before item is transferred
|
||||
from invent to thief->minvent)]; item will still be in
|
||||
inventory when we return to caller or save bones (or
|
||||
@@ -6820,13 +6804,11 @@ maybe_finish_sokoban(void)
|
||||
}
|
||||
|
||||
/* Return the string name of the trap type passed in, unless the player is
|
||||
* hallucinating, in which case return a random or hallucinatory trap name.
|
||||
* If the second argument is true, return the correct trap name even when
|
||||
* hallucinating (for things like wizard mode wishing for traps and impossible
|
||||
* calls).
|
||||
*/
|
||||
hallucinating, in which case return a random or hallucinatory trap name. */
|
||||
const char *
|
||||
trapname(int ttyp, boolean override)
|
||||
trapname(
|
||||
int ttyp,
|
||||
boolean override) /* if True, ignore Hallucination */
|
||||
{
|
||||
static const char *const halu_trapnames[] = {
|
||||
/* riffs on actual nethack traps */
|
||||
@@ -6863,7 +6845,7 @@ trapname(int ttyp, boolean override)
|
||||
/* inspired by "tourist trap" */
|
||||
copynchars(roletrap,
|
||||
rn2(3) ? ((fem && gu.urole.name.f) ? gu.urole.name.f
|
||||
: gu.urole.name.m)
|
||||
: gu.urole.name.m)
|
||||
: rank_of(u.ulevel, Role_switch, fem),
|
||||
(int) (sizeof roletrap - sizeof " trap"));
|
||||
Strcat(roletrap, " trap");
|
||||
@@ -6882,7 +6864,7 @@ trapname(int ttyp, boolean override)
|
||||
chain, due to some external source of fire. The object chain should
|
||||
be somewhere exposed, like someone's open inventory or the floor. */
|
||||
void
|
||||
ignite_items(struct obj* objchn)
|
||||
ignite_items(struct obj *objchn)
|
||||
{
|
||||
struct obj *obj;
|
||||
boolean bynexthere = (objchn && objchn->where == OBJ_FLOOR);
|
||||
|
||||
Reference in New Issue
Block a user