Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git c/include/display.h w/include/display.h
- index 9da288d..4a1d63b 100644
- --- c/include/display.h
- +++ w/include/display.h
- @@ -59,9 +59,9 @@
- * Infravision is not taken into account.
- */
- #define mon_visible(mon) \
- - (/* The hero can see the monster IF the monster */ \
- - (!mon->minvis || See_invisible) /* 1. is not invisible */ \
- - && !mon->mundetected /* AND 2. not an undetected hider */ \
- + (/* The hero can see the monster IF the monster */ \
- + (!minvisible(mon) || See_invisible) /* 1. is not invisible */ \
- + && !mon->mundetected /* AND 2. not an undetected hider */ \
- && !(mon->mburied || u.uburied)) /* AND 3. neither you nor it is buried */
- /*
- @@ -110,7 +110,8 @@
- */
- #define knowninvisible(mon) \
- (mtmp->minvis \
- - && ((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters)) \
- + && ((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters \
- + || candetect(mon->mx, mon->my))) \
- || (!Blind && (HTelepat & ~INTRINSIC) \
- && distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))
- diff --git c/include/extern.h w/include/extern.h
- index 6959e24..36e7776 100644
- --- c/include/extern.h
- +++ w/include/extern.h
- @@ -275,6 +275,7 @@ E void FDECL(use_crystal_ball, (struct obj **));
- E void NDECL(do_mapping);
- E void FDECL(do_vicinity_map, (struct obj *));
- E void FDECL(cvt_sdoor_to_door, (struct rm *));
- +E boolean FDECL(findone_core, (int, int));
- #ifdef USE_TRAMPOLI
- E void FDECL(findone, (int, int, genericptr_t));
- E void FDECL(openone, (int, int, genericptr_t));
- @@ -1064,7 +1065,7 @@ E void FDECL(obj_split_light_source, (struct obj *, struct obj *));
- E void FDECL(obj_merge_light_sources, (struct obj *, struct obj *));
- E void FDECL(obj_adjust_light_radius, (struct obj *, int));
- E int FDECL(candle_light_range, (struct obj *));
- -E int FDECL(arti_light_radius, (struct obj *));
- +E int FDECL(dynamic_light_radius, (struct obj *));
- E const char *FDECL(arti_light_description, (struct obj *));
- E int NDECL(wiz_light_sources);
- @@ -1418,6 +1419,7 @@ E void FDECL(setmangry, (struct monst *, BOOLEAN_P));
- E void FDECL(wakeup, (struct monst *, BOOLEAN_P));
- E void NDECL(wake_nearby);
- E void FDECL(wake_nearto, (int, int, int));
- +E void FDECL(seemimic_noredraw, (struct monst *));
- E void FDECL(seemimic, (struct monst *));
- E void NDECL(rescham);
- E void NDECL(restartcham);
- diff --git c/include/mkroom.h w/include/mkroom.h
- index 9d72455..df6a0f7 100644
- --- c/include/mkroom.h
- +++ w/include/mkroom.h
- @@ -34,7 +34,7 @@ struct shclass {
- struct itp {
- int iprob; /* probability of an item type */
- int itype; /* item type: if >=0 a class, if < 0 a specific item */
- - } iprobs[6];
- + } iprobs[7];
- const char *const *shknms; /* list of shopkeeper names for this type */
- };
- diff --git c/include/mondata.h w/include/mondata.h
- index 41b5f70..f96d574 100644
- --- c/include/mondata.h
- +++ w/include/mondata.h
- @@ -75,6 +75,7 @@
- (lays_eggs(ptr) && (ptr)->mlet == S_EEL && is_swimmer(ptr))
- #define regenerates(ptr) (((ptr)->mflags1 & M1_REGEN) != 0L)
- #define perceives(ptr) (((ptr)->mflags1 & M1_SEE_INVIS) != 0L)
- +#define perceives_you(ptr) (perceives(ptr) || candetect(u.ux, u.uy))
- #define can_teleport(ptr) (((ptr)->mflags1 & M1_TPORT) != 0L)
- #define control_teleport(ptr) (((ptr)->mflags1 & M1_TPORT_CNTRL) != 0L)
- #define telepathic(ptr) \
- diff --git c/include/monst.h w/include/monst.h
- index f9be37f..4882176 100644
- --- c/include/monst.h
- +++ w/include/monst.h
- @@ -174,6 +174,9 @@ struct monst {
- ((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LORD \
- || (mon)->cham == PM_VLAD_THE_IMPALER)
- +/* guiding candle makes monsters effectively visible */
- +#define minvisible(mon) ((mon)->minvis && !candetect((mon)->mx, (mon)->my))
- +
- /* mimic appearances that block vision/light */
- #define is_lightblocker_mappear(mon) \
- (is_obj_mappear(mon, BOULDER) \
- diff --git c/include/obj.h w/include/obj.h
- index 62e20b7..6796141 100644
- --- c/include/obj.h
- +++ w/include/obj.h
- @@ -302,7 +302,9 @@ struct obj {
- /* Light sources */
- #define Is_candle(otmp) \
- - (otmp->otyp == TALLOW_CANDLE || otmp->otyp == WAX_CANDLE)
- + (otmp->otyp == TALLOW_CANDLE || otmp->otyp == WAX_CANDLE \
- + || otmp->otyp == GUIDING_CANDLE)
- +#define candle_burn_time(otmp) ((otmp)->otyp == TALLOW_CANDLE ? 200L : 400L)
- #define MAX_OIL_IN_FLASK 400 /* maximum amount of oil in a potion of oil */
- /* MAGIC_LAMP intentionally excluded below */
- diff --git c/include/rm.h w/include/rm.h
- index d6ec078..07676fe 100644
- --- c/include/rm.h
- +++ w/include/rm.h
- @@ -388,6 +388,16 @@ extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
- #define W_NONDIGGABLE 0x08
- #define W_NONPASSWALL 0x10
- +/*
- + * Filled trapdoors in the Castle can be dug out again.
- + * Conflicts with W_NONPASSWALL above, but Castle has no
- + * non-passwall walls anyway, much less those that can be dug.
- + */
- +
- +#define FL_DIGGABLE 0x10
- +#define Can_dig_hole(x,y,z) (Can_dig_down(z) || Can_fall_thru(z) \
- + && (level.locations[x][y].flags & FL_DIGGABLE))
- +
- /*
- * Ladders (in Vlad's tower) may be up or down.
- */
- @@ -419,7 +429,7 @@ struct rm {
- Bitfield(roomno, 6); /* room # for special rooms */
- Bitfield(edge, 1); /* marks boundaries for special rooms*/
- - Bitfield(candig, 1); /* Exception to Can_dig_down; was a trapdoor */
- + Bitfield(buried, 1); /* true iff there are buried objects here */
- };
- #define SET_TYPLIT(x, y, ttyp, llit) \
- diff --git c/include/vision.h w/include/vision.h
- index 562f542..5cb5aec 100644
- --- c/include/vision.h
- +++ w/include/vision.h
- @@ -11,15 +11,17 @@ extern char **viz_array; /* could see/in sight row pointers */
- extern char *viz_rmin; /* min could see indices */
- extern char *viz_rmax; /* max could see indices */
- #endif
- -#define COULD_SEE 0x1 /* location could be seen, if it were lit */
- -#define IN_SIGHT 0x2 /* location can be seen */
- -#define TEMP_LIT 0x4 /* location is temporarily lit */
- +#define COULD_SEE 0x1 /* location could be seen, if it were lit */
- +#define IN_SIGHT 0x2 /* location can be seen */
- +#define TEMP_LIT 0x4 /* location is temporarily lit */
- +#define TEMP_DETECT 0x8 /* lit by a guiding candle */
- /*
- * Light source sources
- */
- #define LS_OBJECT 0
- #define LS_MONSTER 1
- +#define LS_DETECT 2 /* guiding candle */
- /*
- * cansee() - Returns true if the hero can see the location.
- @@ -30,6 +32,7 @@ extern char *viz_rmax; /* max could see indices */
- #define cansee(x, y) (viz_array[y][x] & IN_SIGHT)
- #define couldsee(x, y) (viz_array[y][x] & COULD_SEE)
- #define templit(x, y) (viz_array[y][x] & TEMP_LIT)
- +#define candetect(x, y) (viz_array[y][x] & TEMP_DETECT)
- /*
- * The following assume the monster is not blind.
- @@ -44,7 +47,7 @@ extern char *viz_rmax; /* max could see indices */
- #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2))
- #define m_canseeu(m) \
- - ((!Invis || perceives((m)->data)) \
- + ((!Invis || perceives_you((m)->data)) \
- && !(Underwater || u.uburied || (m)->mburied) \
- ? couldsee((m)->mx, (m)->my) \
- : 0)
- diff --git c/include/youprop.h w/include/youprop.h
- index c0eb10e..32b75ae 100644
- --- c/include/youprop.h
- +++ w/include/youprop.h
- @@ -177,7 +177,7 @@
- #define EInvis u.uprops[INVIS].extrinsic
- #define BInvis u.uprops[INVIS].blocked
- #define Invis ((HInvis || EInvis) && !BInvis)
- -#define Invisible (Invis && !See_invisible)
- +#define Invisible (Invis && !See_invisible && !candetect(u.ux, u.uy))
- /* Note: invisibility also hides inventory and steed */
- #define EDisplaced u.uprops[DISPLACED].extrinsic
- diff --git c/src/apply.c w/src/apply.c
- index 998d4dd..541ccd6 100644
- --- c/src/apply.c
- +++ w/src/apply.c
- @@ -816,11 +816,11 @@ struct obj *obj;
- struct monst *mtmp;
- unsigned how_seen;
- char mlet;
- - boolean vis, invis_mirror, useeit, monable;
- + boolean vis, invis_mirror, useeit, mcanseeself, monable;
- if (!getdir((char *) 0))
- return 0;
- - invis_mirror = Invis;
- + invis_mirror = Invis && !candetect(u.ux, u.uy);
- useeit = !Blind && (!invis_mirror || See_invisible);
- uvisage = beautiful();
- mirror = simpleonames(obj); /* "mirror" or "looking glass" */
- @@ -895,7 +895,7 @@ struct obj *obj;
- #define SEENMON (MONSEEN_NORMAL | MONSEEN_SEEINVIS | MONSEEN_INFRAVIS)
- how_seen = vis ? howmonseen(mtmp) : 0;
- /* whether monster is able to use its vision-based capabilities */
- - monable = !mtmp->mcan && (!mtmp->minvis || perceives(mtmp->data));
- + monable = !mtmp->mcan && (!minvisible(mtmp) || perceives(mtmp->data));
- mlet = mtmp->data->mlet;
- if (mtmp->msleeping) {
- if (vis)
- @@ -952,7 +952,7 @@ struct obj *obj;
- if (!tele_restrict(mtmp))
- (void) rloc(mtmp, TRUE);
- } else if (!is_unicorn(mtmp->data) && !humanoid(mtmp->data)
- - && (!mtmp->minvis || perceives(mtmp->data)) && rn2(5)) {
- + && (!minvisible(mtmp) || perceives(mtmp->data)) && rn2(5)) {
- boolean do_react = TRUE;
- if (mtmp->mfrozen) {
- @@ -968,9 +968,9 @@ struct obj *obj;
- monflee(mtmp, d(2, 4), FALSE, FALSE);
- }
- } else if (!Blind) {
- - if (mtmp->minvis && !See_invisible)
- + if (minvisible(mtmp) && !See_invisible)
- ;
- - else if ((mtmp->minvis && !perceives(mtmp->data))
- + else if ((minvisible(mtmp) && !perceives(mtmp->data))
- /* redundant: can't get here if these are true */
- || !haseyes(mtmp->data) || notonhead || !mtmp->mcansee)
- pline("%s doesn't seem to notice %s reflection.", Monnam(mtmp),
- @@ -1208,6 +1208,9 @@ struct obj **optr;
- *optr = 0;
- You("attach %ld%s %s to %s.", obj->quan, !otmp->spe ? "" : " more", s,
- the(xname(otmp)));
- + if (objects[obj->otyp].oc_magic) /* hello SLASH'EM */
- + pline("%s very ordinary.", (obj->quan > 1L) ? "They look"
- + : "It looks");
- if (!otmp->spe || otmp->age > obj->age)
- otmp->age = obj->age;
- otmp->spe += (int) obj->quan;
- @@ -1365,7 +1368,7 @@ struct obj *obj;
- pline("%s flame%s %s%s", s_suffix(Yname2(obj)), plur(obj->quan),
- otense(obj, "burn"), Blind ? "." : " brightly!");
- if (obj->unpaid && costly_spot(u.ux, u.uy)
- - && obj->age == 20L * (long) objects[obj->otyp].oc_cost) {
- + && obj->age == candle_burn_time(obj)) {
- const char *ithem = (obj->quan > 1L) ? "them" : "it";
- verbalize("You burn %s, you bought %s!", ithem, ithem);
- @@ -2107,7 +2110,7 @@ long timeout;
- /* [m_monnam() yields accurate mon type, overriding hallucination] */
- Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
- and_vanish[0] = '\0';
- - if ((mtmp->minvis && !See_invisible)
- + if ((minvisible(mtmp) && !See_invisible)
- || (mtmp->data->mlet == S_MIMIC
- && M_AP_TYPE(mtmp) != M_AP_NOTHING))
- suppress_see = TRUE;
- @@ -3402,8 +3405,7 @@ struct obj *obj;
- fillmsg = TRUE;
- } else
- digactualhole(x, y, BY_OBJECT, (rn2(obj->spe) < 3
- - || (!Can_dig_down(&u.uz)
- - && !levl[x][y].candig))
- + || !Can_dig_hole(x, y, &u.uz))
- ? PIT
- : HOLE);
- }
- @@ -3652,6 +3654,7 @@ doapply()
- break;
- case WAX_CANDLE:
- case TALLOW_CANDLE:
- + case GUIDING_CANDLE:
- use_candle(&obj);
- break;
- case OIL_LAMP:
- diff --git c/src/detect.c w/src/detect.c
- index 4527168..c2a4803 100644
- --- c/src/detect.c
- +++ w/src/detect.c
- @@ -1443,46 +1443,59 @@ struct rm *lev;
- lev->doormask = newmask;
- }
- -STATIC_PTR void
- -findone(zx, zy, num)
- +/* also used in display.c */
- +boolean
- +findone_core(zx, zy)
- int zx, zy;
- -genericptr_t num;
- {
- register struct trap *ttmp;
- register struct monst *mtmp;
- + boolean result = FALSE;
- if (levl[zx][zy].typ == SDOOR) {
- cvt_sdoor_to_door(&levl[zx][zy]); /* .typ = DOOR */
- magic_map_background(zx, zy, 0);
- - newsym(zx, zy);
- - (*(int *) num)++;
- - } else if (levl[zx][zy].typ == SCORR) {
- + return TRUE;
- + }
- + if (levl[zx][zy].typ == SCORR) {
- levl[zx][zy].typ = CORR;
- unblock_point(zx, zy);
- magic_map_background(zx, zy, 0);
- - newsym(zx, zy);
- - (*(int *) num)++;
- - } else if ((ttmp = t_at(zx, zy)) != 0) {
- + return TRUE;
- + }
- + if ((ttmp = t_at(zx, zy)) != 0) {
- if (!ttmp->tseen && ttmp->ttyp != STATUE_TRAP) {
- ttmp->tseen = 1;
- - newsym(zx, zy);
- - (*(int *) num)++;
- + return TRUE;
- }
- - } else if ((mtmp = m_at(zx, zy)) != 0) {
- + }
- + if ((mtmp = m_at(zx, zy)) != 0) {
- if (M_AP_TYPE(mtmp)) {
- - seemimic(mtmp);
- - (*(int *) num)++;
- + seemimic_noredraw(mtmp);
- + result = TRUE;
- }
- if (mtmp->mundetected
- && (is_hider(mtmp->data) || mtmp->data->mlet == S_EEL)) {
- mtmp->mundetected = 0;
- - newsym(zx, zy);
- - (*(int *) num)++;
- + result = TRUE;
- }
- if (!canspotmon(mtmp) && !glyph_is_invisible(levl[zx][zy].glyph))
- map_invisible(zx, zy);
- - } else if (unmap_invisible(zx, zy)) {
- + } else if (glyph_is_invisible(levl[zx][zy].glyph)) {
- + unmap_object(zx, zy);
- + result = TRUE;
- + }
- + return result;
- +}
- +
- +STATIC_PTR void
- +findone(zx, zy, num)
- +int zx, zy;
- +genericptr_t num;
- +{
- + if (findone_core(zx, zy)) {
- (*(int *) num)++;
- + newsym(zx, zy);
- }
- }
- diff --git c/src/dig.c w/src/dig.c
- index dbf5eb5..d44ea1f 100644
- --- c/src/dig.c
- +++ w/src/dig.c
- @@ -219,7 +219,7 @@ int x, y;
- || (ttmp
- && (ttmp->ttyp == MAGIC_PORTAL
- || ttmp->ttyp == VIBRATING_SQUARE
- - || (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) {
- + || !Can_dig_hole(x, y, &u.uz)))) {
- if (verbose)
- pline_The("%s here is too hard to %s.", surface(x, y), verb);
- return FALSE;
- @@ -579,7 +579,7 @@ int ttyp;
- return;
- }
- - if (ttyp != PIT && (!Can_dig_down(&u.uz) && !lev->candig)) {
- + if (ttyp != PIT && !Can_dig_hole(x, y, &u.uz)) {
- impossible("digactualhole: can't dig %s on this level.",
- defsyms[trap_to_defsym(ttyp)].explanation);
- ttyp = PIT;
- @@ -783,7 +783,7 @@ coord *cc;
- ttmp = t_at(dig_x, dig_y);
- lev = &levl[dig_x][dig_y];
- - nohole = (!Can_dig_down(&u.uz) && !lev->candig);
- + nohole = !Can_dig_hole(dig_x, dig_y, &u.uz);
- if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL
- || ttmp->ttyp == VIBRATING_SQUARE || nohole))
- @@ -866,9 +866,9 @@ coord *cc;
- } else {
- typ = fillholetyp(dig_x, dig_y, FALSE);
- - lev->flags = 0;
- if (typ != ROOM) {
- lev->typ = typ;
- + lev->flags = 0;
- liquid_flow(dig_x, dig_y, typ, ttmp,
- "As you dig, the hole fills with %s!");
- return TRUE;
- @@ -1931,23 +1931,27 @@ int x, y;
- coord cc;
- debugpline2("unearth_objs: at <%d,%d>", x, y);
- - cc.x = x;
- - cc.y = y;
- - bball = buried_ball(&cc);
- - for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
- - otmp2 = otmp->nobj;
- - if (otmp->ox == x && otmp->oy == y) {
- - if (bball && otmp == bball
- - && u.utrap && u.utraptype == TT_BURIEDBALL) {
- - buried_ball_to_punishment();
- - } else {
- - obj_extract_self(otmp);
- - if (otmp->timed)
- - (void) stop_timer(ROT_ORGANIC, obj_to_any(otmp));
- - place_object(otmp, x, y);
- - stackobj(otmp);
- +
- + if (levl[x][y].buried) {
- + cc.x = x;
- + cc.y = y;
- + bball = buried_ball(&cc);
- + for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
- + otmp2 = otmp->nobj;
- + if (otmp->ox == x && otmp->oy == y) {
- + if (bball && otmp == bball
- + && u.utrap && u.utraptype == TT_BURIEDBALL) {
- + buried_ball_to_punishment();
- + } else {
- + obj_extract_self(otmp);
- + if (otmp->timed)
- + (void) stop_timer(ROT_ORGANIC, obj_to_any(otmp));
- + place_object(otmp, x, y);
- + stackobj(otmp);
- + }
- }
- }
- + levl[x][y].buried = 0;
- }
- del_engr_at(x, y);
- newsym(x, y);
- diff --git c/src/display.c w/src/display.c
- index c5b155b..2ea8b06 100644
- --- c/src/display.c
- +++ w/src/display.c
- @@ -123,6 +123,7 @@
- */
- #include "hack.h"
- +STATIC_DCL void FDECL(map_buried, (int, int, int));
- STATIC_DCL void FDECL(display_monster,
- (XCHAR_P, XCHAR_P, struct monst *, int, XCHAR_P));
- STATIC_DCL int FDECL(swallow_to_glyph, (int, int));
- @@ -264,6 +265,26 @@ register int show;
- show_glyph(x, y, glyph);
- }
- +/*
- + * map_buried()
- + * Map the object buried under the specified tile.
- + * If there are several, we need to display the very last one
- + * to be consistent with object_detect().
- + */
- +
- +STATIC_OVL void
- +map_buried(x, y, show)
- +int x, y;
- +int show;
- +{
- + struct obj *obj, *last_obj = NULL;
- + for (obj = level.buriedobjlist; obj; obj = obj->nobj)
- + if (obj->ox == x && obj->oy == y)
- + last_obj = obj;
- + if (last_obj)
- + map_object(last_obj, show);
- +}
- +
- /*
- * map_invisible()
- *
- @@ -344,8 +365,11 @@ register int x, y;
- register struct obj *obj; \
- register struct trap *trap; \
- \
- - if ((obj = vobj_at(x, y)) && !covers_objects(x, y)) \
- + if ((obj = vobj_at(x, y)) && (!covers_objects(x, y) \
- + || candetect(x, y) && cansee(x, y))) \
- map_object(obj, show); \
- + else if (levl[x][y].buried && candetect(x, y) && cansee(x, y)) \
- + map_buried(x, y, show); \
- else if ((trap = t_at(x, y)) && trap->tseen && !covers_traps(x, y)) \
- map_trap(trap, show); \
- else \
- @@ -772,6 +796,10 @@ register int x, y;
- return;
- }
- + /* guiding candle! */
- + if (candetect(x,y))
- + findone_core(x,y);
- +
- if (x == u.ux && y == u.uy) {
- int see_self = canspotself();
- diff --git c/src/do_name.c w/src/do_name.c
- index 6dd8d5a..48921b0 100644
- --- c/src/do_name.c
- +++ w/src/do_name.c
- @@ -1151,7 +1151,7 @@ do_mname()
- && (!(cansee(cx, cy) || see_with_infrared(mtmp))
- || mtmp->mundetected || M_AP_TYPE(mtmp) == M_AP_FURNITURE
- || M_AP_TYPE(mtmp) == M_AP_OBJECT
- - || (mtmp->minvis && !See_invisible)))) {
- + || (minvisible(mtmp) && !See_invisible)))) {
- pline("I see no monster there.");
- return;
- }
- diff --git c/src/do_wear.c w/src/do_wear.c
- index 9132e75..df2de3f 100644
- --- c/src/do_wear.c
- +++ w/src/do_wear.c
- @@ -287,8 +287,9 @@ Cloak_on(VOID_ARGS)
- /* Note: it's already being worn, so we have to cheat here. */
- if ((HInvis || EInvis) && !Blind) {
- newsym(u.ux, u.uy);
- - You("can %s!", See_invisible ? "no longer see through yourself"
- - : see_yourself);
- + You("can %s!", See_invisible || candetect(u.ux, u.uy)
- + ? "no longer see through yourself"
- + : see_yourself);
- }
- break;
- case CLOAK_OF_INVISIBILITY:
- @@ -298,7 +299,7 @@ Cloak_on(VOID_ARGS)
- makeknown(uarmc->otyp);
- newsym(u.ux, u.uy);
- pline("Suddenly you can%s yourself.",
- - See_invisible ? " see through" : "not see");
- + !Invisible ? " see through" : "not see");
- }
- break;
- case OILSKIN_CLOAK:
- @@ -343,8 +344,8 @@ Cloak_off(VOID_ARGS)
- case MUMMY_WRAPPING:
- if (Invis && !Blind) {
- newsym(u.ux, u.uy);
- - You("can %s.", See_invisible ? "see through yourself"
- - : "no longer see yourself");
- + You("can %s.", !Invisible ? "see through yourself"
- + : "no longer see yourself");
- }
- break;
- case CLOAK_OF_INVISIBILITY:
- @@ -352,8 +353,9 @@ Cloak_off(VOID_ARGS)
- makeknown(CLOAK_OF_INVISIBILITY);
- newsym(u.ux, u.uy);
- pline("Suddenly you can %s.",
- - See_invisible ? "no longer see through yourself"
- - : see_yourself);
- + See_invisible || candetect(u.ux, u.uy)
- + ? "no longer see through yourself"
- + : see_yourself);
- }
- break;
- /* Alchemy smock gives poison _and_ acid resistance */
- @@ -900,7 +902,8 @@ register struct obj *obj;
- set_mimic_blocking(); /* do special mimic handling */
- see_monsters();
- - if (Invis && !oldprop && !HSee_invisible && !Blind) {
- + if (Invis && !oldprop && !HSee_invisible
- + && !Blind && !candetect(u.ux, u.uy)) {
- newsym(u.ux, u.uy);
- pline("Suddenly you are transparent, but there!");
- learnring(obj, TRUE);
- @@ -1024,7 +1027,8 @@ boolean gone;
- if (!Invis && !BInvis && !Blind) {
- newsym(u.ux, u.uy);
- Your("body seems to unfade%s.",
- - See_invisible ? " completely" : "..");
- + See_invisible || candetect(u.ux, u.uy) ? " completely"
- + : "..");
- learnring(obj, TRUE);
- }
- break;
- diff --git c/src/dogmove.c w/src/dogmove.c
- index df3452f..d3e55aa 100644
- --- c/src/dogmove.c
- +++ w/src/dogmove.c
- @@ -649,7 +649,7 @@ int maxdist;
- if ((targ = m_at(curx, cury)) != 0) {
- /* Is the monster visible to the pet? */
- - if ((!targ->minvis || perceives(mtmp->data))
- + if ((!minvisible(targ) || perceives(mtmp->data))
- && !targ->mundetected)
- break;
- /* If the pet can't see it, it assumes it aint there */
- @@ -692,7 +692,7 @@ int maxdist;
- if (pal) {
- if (pal->mtame) {
- /* Pet won't notice invisible pets */
- - if (!pal->minvis || perceives(mtmp->data))
- + if (!minvisible(pal) || perceives(mtmp->data))
- return 1;
- } else {
- /* Quest leaders and guardians are always seen */
- @@ -1007,7 +1007,7 @@ int after; /* this is extra fast monster movement */
- if ((int) mtmp2->m_lev >= (int) mtmp->m_lev + 2
- || (mtmp2->data == &mons[PM_FLOATING_EYE] && rn2(10)
- && mtmp->mcansee && haseyes(mtmp->data) && mtmp2->mcansee
- - && (perceives(mtmp->data) || !mtmp2->minvis))
- + && (perceives(mtmp->data) || !minvisible(mtmp2)))
- || (mtmp2->data == &mons[PM_GELATINOUS_CUBE] && rn2(10))
- || (max_passive_dmg(mtmp2, mtmp) >= mtmp->mhp)
- || ((mtmp->mhp * 4 < mtmp->mhpmax
- diff --git c/src/eat.c w/src/eat.c
- index 4dd3a0a..f3bd5d0 100644
- --- c/src/eat.c
- +++ w/src/eat.c
- @@ -1969,15 +1969,14 @@ struct obj *otmp;
- set_mimic_blocking();
- see_monsters();
- if (Invis && !oldprop && !ESee_invisible
- - && !perceives(youmonst.data) && !Blind) {
- + && !perceives_you(youmonst.data) && !Blind) {
- newsym(u.ux, u.uy);
- pline("Suddenly you can see yourself.");
- makeknown(typ);
- }
- break;
- case RIN_INVISIBILITY:
- - if (!oldprop && !EInvis && !BInvis && !See_invisible
- - && !Blind) {
- + if (!oldprop && !EInvis && !BInvis && Invisible && !Blind) {
- newsym(u.ux, u.uy);
- Your("body takes on a %s transparency...",
- Hallucination ? "normal" : "strange");
- diff --git c/src/hack.c w/src/hack.c
- index d84dd35..4e9d32e 100644
- --- c/src/hack.c
- +++ w/src/hack.c
- @@ -220,8 +220,7 @@ moverock()
- deltrap(ttmp);
- delobj(otmp);
- bury_objs(rx, ry);
- - levl[rx][ry].wall_info &= ~W_NONDIGGABLE;
- - levl[rx][ry].candig = 1;
- + levl[rx][ry].flags |= FL_DIGGABLE;
- if (cansee(rx, ry))
- newsym(rx, ry);
- return sobj_at(BOULDER, sx, sy) ? -1 : 0;
- @@ -2657,7 +2656,8 @@ lookaround()
- if ((mtmp = m_at(x, y)) != 0
- && M_AP_TYPE(mtmp) != M_AP_FURNITURE
- && M_AP_TYPE(mtmp) != M_AP_OBJECT
- - && (!mtmp->minvis || See_invisible) && !mtmp->mundetected) {
- + && (!minvisible(mtmp) || See_invisible)
- + && !mtmp->mundetected) {
- if ((context.run != 1 && !mtmp->mtame)
- || (x == u.ux + u.dx && y == u.uy + u.dy
- && !context.travel)) {
- diff --git c/src/invent.c w/src/invent.c
- index ff69de7..b3b675c 100644
- --- c/src/invent.c
- +++ w/src/invent.c
- @@ -4384,6 +4384,9 @@ boolean as_if_seen;
- menu_item *selected = 0;
- int n;
- + if (!levl[x][y].buried)
- + return 0; /* nothing to do here */
- +
- /* count # of objects here */
- for (n = 0, obj = level.buriedobjlist; obj; obj = obj->nobj)
- if (obj->ox == x && obj->oy == y) {
- diff --git c/src/light.c w/src/light.c
- index 446dc39..0c025fa 100644
- --- c/src/light.c
- +++ w/src/light.c
- @@ -41,6 +41,7 @@
- /* flags */
- #define LSF_SHOW 0x1 /* display the light source */
- #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */
- +#define LSF_DETECT 0x4 /* guiding candle */
- static light_source *light_base = 0;
- @@ -71,9 +72,9 @@ anything *id;
- ls->x = x;
- ls->y = y;
- ls->range = range;
- - ls->type = type;
- + ls->type = type & ~LS_DETECT;
- ls->id = *id;
- - ls->flags = 0;
- + ls->flags = type & LS_DETECT ? LSF_DETECT : 0;
- light_base = ls;
- vision_full_recalc = 1; /* make the source show up */
- @@ -157,9 +158,10 @@ char **cs_rows;
- /* minor optimization: don't bother with duplicate light sources */
- /* at hero */
- if (ls->x == u.ux && ls->y == u.uy) {
- - if (at_hero_range >= ls->range)
- - ls->flags &= ~LSF_SHOW;
- - else
- + if (at_hero_range >= ls->range) {
- + if (!(ls->flags & LSF_DETECT))
- + ls->flags &= ~LSF_SHOW;
- + } else
- at_hero_range = ls->range;
- }
- @@ -197,13 +199,19 @@ char **cs_rows;
- * does this.
- */
- for (x = min_x; x <= max_x; x++)
- - if (row[x] & COULD_SEE)
- + if (row[x] & COULD_SEE) {
- row[x] |= TEMP_LIT;
- + if (ls->flags & LSF_DETECT)
- + row[x] |= TEMP_DETECT;
- + }
- } else {
- for (x = min_x; x <= max_x; x++)
- if ((ls->x == x && ls->y == y)
- - || clear_path((int) ls->x, (int) ls->y, x, y))
- + || clear_path((int) ls->x, (int) ls->y, x, y)) {
- row[x] |= TEMP_LIT;
- + if (ls->flags & LSF_DETECT)
- + row[x] |= TEMP_DETECT;
- + }
- }
- }
- }
- @@ -602,10 +610,18 @@ struct obj *obj;
- int new_radius;
- {
- light_source *ls;
- + short old_flags;
- for (ls = light_base; ls; ls = ls->next)
- if (ls->type == LS_OBJECT && ls->id.a_obj == obj) {
- - if (new_radius != ls->range)
- + old_flags = ls->flags;
- + if (obj->otyp == GUIDING_CANDLE) {
- + if (obj->cursed)
- + ls->flags &= ~LSF_DETECT;
- + else
- + ls->flags |= LSF_DETECT;
- + }
- + if (new_radius != ls->range || ls->flags != old_flags)
- vision_full_recalc = 1;
- ls->range = new_radius;
- return;
- @@ -646,6 +662,8 @@ struct obj *obj;
- radius++;
- n /= 7L;
- } while (n > 0L);
- + if (obj->otyp == GUIDING_CANDLE && obj->blessed)
- + radius++; /* make them less useless in late game */
- } else {
- /* we're only called for lit candelabrum or candles */
- /* impossible("candlelight for %d?", obj->otyp); */
- @@ -656,7 +674,7 @@ struct obj *obj;
- /* light emitting artifact's range depends upon its curse/bless state */
- int
- -arti_light_radius(obj)
- +dynamic_light_radius(obj)
- struct obj *obj;
- {
- /*
- @@ -667,9 +685,12 @@ struct obj *obj;
- */
- /* sanity check [simplifies usage by bless()/curse()/&c] */
- - if (!obj->lamplit || !artifact_light(obj))
- + if (!obj->lamplit || !artifact_light(obj) && obj->otyp != GUIDING_CANDLE)
- return 0;
- + if (obj->otyp == GUIDING_CANDLE)
- + return candle_light_range(obj);
- +
- /* cursed radius of 1 is not noticeable for an item that's
- carried by the hero but is if it's carried by a monster
- or left lit on the floor (not applicable for Sunsword) */
- @@ -681,7 +702,7 @@ const char *
- arti_light_description(obj)
- struct obj *obj;
- {
- - switch (arti_light_radius(obj)) {
- + switch (dynamic_light_radius(obj)) {
- case 3:
- return "brilliantly"; /* blessed */
- case 2:
- diff --git c/src/mcastu.c w/src/mcastu.c
- index 1f73638..b59981a 100644
- --- c/src/mcastu.c
- +++ w/src/mcastu.c
- @@ -59,7 +59,7 @@ boolean undirected;
- if (undirected)
- point_msg = "all around, then curses";
- - else if ((Invis && !perceives(mtmp->data)
- + else if ((Invis && !perceives_you(mtmp->data)
- && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- || is_obj_mappear(&youmonst, STRANGE_OBJECT)
- || u.uundetected)
- @@ -264,7 +264,7 @@ boolean foundyou;
- canspotmon(mtmp) ? Monnam(mtmp) : "Something",
- is_undirected_spell(mattk->adtyp, spellnum)
- ? ""
- - : (Invisible && !perceives(mtmp->data)
- + : (Invis && !perceives_you(mtmp->data)
- && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- ? " at a spot near you"
- : (Displaced
- @@ -414,7 +414,7 @@ int spellnum;
- /* messages not quite right if plural monsters created but
- only a single monster is seen */
- - if (Invisible && !perceives(mtmp->data)
- + if (Invis && !perceives_you(mtmp->data)
- && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- pline("%s around a spot near you!", mappear);
- else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- @@ -463,7 +463,8 @@ int spellnum;
- if (!mtmp->minvis && !mtmp->invis_blkd) {
- if (canseemon(mtmp))
- pline("%s suddenly %s!", Monnam(mtmp),
- - !See_invisible ? "disappears" : "becomes transparent");
- + !See_invisible && !candetect(mtmp->mx, mtmp->my)
- + ? "disappears" : "becomes transparent");
- mon_set_minvis(mtmp);
- if (cansee(mtmp->mx, mtmp->my) && !canspotmon(mtmp))
- map_invisible(mtmp->mx, mtmp->my);
- @@ -640,7 +641,7 @@ int spellnum;
- fmt = "%s casts at a clump of sticks, but nothing happens.";
- else if (let == S_SNAKE)
- fmt = "%s transforms a clump of sticks into snakes!";
- - else if (Invisible && !perceives(mtmp->data)
- + else if (Invis && !perceives_you(mtmp->data)
- && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- fmt = "%s summons insects around a spot near you!";
- else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
- diff --git c/src/mhitm.c w/src/mhitm.c
- index 79f1e67..2320b2e 100644
- --- c/src/mhitm.c
- +++ w/src/mhitm.c
- @@ -609,7 +609,7 @@ struct attack *mattk;
- }
- if (magr->mcan || !magr->mcansee || !mdef->mcansee
- - || (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) {
- + || (minvisible(magr) && !perceives(mdef->data)) || mdef->msleeping) {
- if (vis && canspotmon(mdef))
- pline("but nothing happens.");
- return MM_MISS;
- @@ -625,7 +625,7 @@ struct attack *mattk;
- "The gaze is reflected away by %s %s.");
- return MM_MISS;
- }
- - if (mdef->minvis && !perceives(magr->data)) {
- + if (minvisible(mdef) && !perceives(magr->data)) {
- if (canseemon(magr)) {
- pline(
- "%s doesn't seem to notice that %s gaze was reflected.",
- @@ -1590,7 +1590,7 @@ int mdead;
- if (!rn2(4))
- tmp = 127;
- if (magr->mcansee && haseyes(madat) && mdef->mcansee
- - && (perceives(madat) || !mdef->minvis)) {
- + && (perceives(madat) || !minvisible(mdef))) {
- /* construct format string; guard against '%' in Monnam */
- Strcpy(buf, s_suffix(Monnam(mdef)));
- (void) strNsubst(buf, "%", "%%", 0);
- diff --git c/src/mhitu.c w/src/mhitu.c
- index db92458..1927d01 100644
- --- c/src/mhitu.c
- +++ w/src/mhitu.c
- @@ -159,7 +159,7 @@ struct attack *mattk;
- ? could_seduce(mtmp, &youmonst, mattk) : 0);
- Monst_name = Monnam(mtmp);
- - if (!mtmp->mcansee || (Invis && !perceives(mtmp->data))) {
- + if (!mtmp->mcansee || (Invis && !perceives_you(mtmp->data))) {
- const char *swings = (mattk->aatyp == AT_BITE) ? "snaps"
- : (mattk->aatyp == AT_KICK) ? "kicks"
- : (mattk->aatyp == AT_STNG
- @@ -573,7 +573,7 @@ register struct monst *mtmp;
- tmp += mtmp->m_lev;
- if (multi < 0)
- tmp += 4;
- - if ((Invis && !perceives(mdat)) || !mtmp->mcansee)
- + if ((Invis && !perceives_you(mdat)) || !mtmp->mcansee)
- tmp -= 2;
- if (mtmp->mtrapped)
- tmp -= 2;
- @@ -2386,16 +2386,18 @@ struct attack *mattk; /* non-Null: current attack; Null: general capability */
- pagr = youmonst.data;
- agrinvis = (Invis != 0);
- genagr = poly_gender();
- + defperc = candetect(u.ux, u.uy);
- } else {
- pagr = magr->data;
- agrinvis = magr->minvis;
- genagr = gender(magr);
- + defperc = candetect(magr->mx, magr->my);
- }
- if (mdef == &youmonst) {
- - defperc = (See_invisible != 0);
- + defperc = defperc || See_invisible;
- gendef = poly_gender();
- } else {
- - defperc = perceives(mdef->data);
- + defperc = defperc || perceives(mdef->data);
- gendef = gender(mdef);
- }
- @@ -2873,7 +2875,7 @@ struct attack *mattk;
- if (!rn2(4))
- tmp = 127;
- if (mtmp->mcansee && haseyes(mtmp->data) && rn2(3)
- - && (perceives(mtmp->data) || !Invis)) {
- + && (perceives_you(mtmp->data) || !Invis)) {
- if (Blind)
- pline("As a blind %s, you cannot defend yourself.",
- youmonst.data->mname);
- diff --git c/src/mkobj.c w/src/mkobj.c
- index 195de0b..1909852 100644
- --- c/src/mkobj.c
- +++ w/src/mkobj.c
- @@ -10,6 +10,7 @@ STATIC_DCL unsigned FDECL(nextoid, (struct obj *, struct obj *));
- STATIC_DCL void FDECL(maybe_adjust_light, (struct obj *, int));
- STATIC_DCL void FDECL(obj_timer_checks, (struct obj *,
- XCHAR_P, XCHAR_P, int));
- +STATIC_DCL void FDECL(recheck_buried, (int, int));
- STATIC_DCL void FDECL(container_weight, (struct obj *));
- STATIC_DCL struct obj *FDECL(save_mtraits, (struct obj *, struct monst *));
- STATIC_DCL void FDECL(objlist_sanity, (struct obj *, int, const char *));
- @@ -898,11 +899,12 @@ boolean artif;
- switch (otmp->otyp) {
- case TALLOW_CANDLE:
- case WAX_CANDLE:
- - otmp->spe = 1;
- - otmp->age = 20L * /* 400 or 200 */
- - (long) objects[otmp->otyp].oc_cost;
- - otmp->lamplit = 0;
- otmp->quan = 1L + (long) (rn2(2) ? rn2(7) : 0);
- + /*FALLTHRU*/
- + case GUIDING_CANDLE:
- + otmp->spe = 1;
- + otmp->age = candle_burn_time(otmp);
- + otmp->lamplit = 0;
- blessorcurse(otmp, 5);
- break;
- case BRASS_LANTERN:
- @@ -1227,12 +1229,13 @@ int old_range;
- {
- char buf[BUFSZ];
- xchar ox, oy;
- - int new_range = arti_light_radius(obj), delta = new_range - old_range;
- + int new_range = dynamic_light_radius(obj), delta = new_range - old_range;
- /* radius of light emitting artifact varies by curse/bless state
- so will change after blessing or cursing */
- - if (delta) {
- + if (new_range)
- obj_adjust_light_radius(obj, new_range);
- + if (delta) {
- /* simplifying assumptions: hero is wielding this object;
- artifacts have to be in use to emit light and monsters'
- gear won't change bless or curse state */
- @@ -1249,7 +1252,8 @@ int old_range;
- when changing intensity, using "less brightly" is
- straightforward for dimming, but we need "brighter"
- rather than "more brightly" for brightening; ugh */
- - pline("%s %s %s%s.", buf, otense(obj, "shine"),
- + pline("%s %s %s%s.", buf, otense(obj, Is_candle(obj)
- + ? "burn" : "shine"),
- (abs(delta) > 1) ? "much " : "",
- (delta > 0) ? "brighter" : "less brightly");
- }
- @@ -1272,7 +1276,7 @@ register struct obj *otmp;
- if (otmp->oclass == COIN_CLASS)
- return;
- if (otmp->lamplit)
- - old_light = arti_light_radius(otmp);
- + old_light = dynamic_light_radius(otmp);
- otmp->cursed = 0;
- otmp->blessed = 1;
- if (carried(otmp) && confers_luck(otmp))
- @@ -1293,7 +1297,7 @@ register struct obj *otmp;
- int old_light = 0;
- if (otmp->lamplit)
- - old_light = arti_light_radius(otmp);
- + old_light = dynamic_light_radius(otmp);
- otmp->blessed = 0;
- if (carried(otmp) && confers_luck(otmp))
- set_moreluck();
- @@ -1313,7 +1317,7 @@ register struct obj *otmp;
- if (otmp->oclass == COIN_CLASS)
- return;
- if (otmp->lamplit)
- - old_light = arti_light_radius(otmp);
- + old_light = dynamic_light_radius(otmp);
- already_cursed = otmp->cursed;
- otmp->blessed = 0;
- otmp->cursed = 1;
- @@ -1350,7 +1354,7 @@ register struct obj *otmp;
- int old_light = 0;
- if (otmp->lamplit)
- - old_light = arti_light_radius(otmp);
- + old_light = dynamic_light_radius(otmp);
- otmp->cursed = 0;
- if (carried(otmp) && confers_luck(otmp))
- set_moreluck();
- @@ -1768,7 +1772,7 @@ boolean do_buried;
- if (otmp->timed)
- obj_timer_checks(otmp, x, y, 0);
- }
- - if (do_buried) {
- + if (do_buried && levl[x][y].buried) {
- for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj) {
- if (otmp->ox == x && otmp->oy == y) {
- if (otmp->timed)
- @@ -1955,6 +1959,7 @@ struct obj *obj;
- break;
- case OBJ_BURIED:
- extract_nobj(obj, &level.buriedobjlist);
- + recheck_buried(obj->ox, obj->oy);
- break;
- case OBJ_ONBILL:
- extract_nobj(obj, &billobjs);
- @@ -2095,6 +2100,21 @@ struct obj *obj;
- obj->where = OBJ_BURIED;
- obj->nobj = level.buriedobjlist;
- level.buriedobjlist = obj;
- + levl[obj->ox][obj->oy].buried = 1;
- +}
- +
- +STATIC_OVL void
- +recheck_buried(x, y)
- +int x, y;
- +{
- + struct obj *obj;
- + for (obj = level.buriedobjlist; obj; obj = obj->nobj)
- + if (obj->ox == x && obj->oy == y)
- + {
- + levl[x][y].buried = 1;
- + return;
- + }
- + levl[x][y].buried = 0;
- }
- /* Recalculate the weight of this container and all of _its_ containers. */
- diff --git c/src/mon.c w/src/mon.c
- index 7bb0d0f..a811f5c 100644
- --- c/src/mon.c
- +++ w/src/mon.c
- @@ -1405,7 +1405,7 @@ nexttry: /* eels prefer the water, but if there is no water nearby,
- && (lavaok || !is_lava(nx, ny))) {
- int dispx, dispy;
- boolean monseeu = (mon->mcansee
- - && (!Invis || perceives(mdat)));
- + && (!Invis || perceives_you(mdat)));
- boolean checkobj = OBJ_AT(nx, ny);
- /* Displacement also displaces the Elbereth/scare monster,
- @@ -2917,9 +2917,9 @@ int x, y, distance;
- }
- }
- -/* NOTE: we must check for mimicry before calling this routine */
- +/* also used in detect.c */
- void
- -seemimic(mtmp)
- +seemimic_noredraw(mtmp)
- register struct monst *mtmp;
- {
- boolean is_blocker_appear = (is_lightblocker_mappear(mtmp));
- @@ -2936,7 +2936,14 @@ register struct monst *mtmp;
- if (is_blocker_appear
- && !does_block(mtmp->mx, mtmp->my, &levl[mtmp->mx][mtmp->my]))
- unblock_point(mtmp->mx, mtmp->my);
- +}
- +/* NOTE: we must check for mimicry before calling this routine */
- +void
- +seemimic(mtmp)
- +register struct monst *mtmp;
- +{
- + seemimic_noredraw(mtmp);
- newsym(mtmp->mx, mtmp->my);
- }
- diff --git c/src/monmove.c w/src/monmove.c
- index 2f7ae6f..e832a23 100644
- --- c/src/monmove.c
- +++ w/src/monmove.c
- @@ -330,7 +330,7 @@ int *inrange, *nearby, *scared;
- * running into you by accident but possibly attacking the spot
- * where it guesses you are.
- */
- - if (!mtmp->mcansee || (Invis && !perceives(mtmp->data))) {
- + if (!mtmp->mcansee || (Invis && !perceives_you(mtmp->data))) {
- seescaryx = mtmp->mux;
- seescaryy = mtmp->muy;
- } else {
- @@ -913,7 +913,7 @@ register int after;
- && (dist2(omx, omy, gx, gy) <= 36));
- if (!mtmp->mcansee
- - || (should_see && Invis && !perceives(ptr) && rn2(11))
- + || (should_see && Invis && !perceives_you(ptr) && rn2(11))
- || is_obj_mappear(&youmonst,STRANGE_OBJECT) || u.uundetected
- || (is_obj_mappear(&youmonst,GOLD_PIECE) && !likes_gold(ptr))
- || (mtmp->mpeaceful && !mtmp->isshk) /* allow shks to follow */
- @@ -1550,7 +1550,7 @@ register struct monst *mtmp;
- if (mx == u.ux && my == u.uy)
- goto found_you;
- - notseen = (!mtmp->mcansee || (Invis && !perceives(mtmp->data)));
- + notseen = (!mtmp->mcansee || (Invis && !perceives_you(mtmp->data)));
- /* add cases as required. eg. Displacement ... */
- if (notseen || Underwater) {
- /* Xorns can smell quantities of valuable metal
- diff --git c/src/mthrowu.c w/src/mthrowu.c
- index d10d2f1..9e0b1bd 100644
- --- c/src/mthrowu.c
- +++ w/src/mthrowu.c
- @@ -1159,8 +1159,8 @@ int whodidit; /* 1==hero, 0=other, -1==just check whether it'll pass thru */
- break;
- case TOOL_CLASS:
- hits = (obj_type != SKELETON_KEY && obj_type != LOCK_PICK
- - && obj_type != CREDIT_CARD && obj_type != TALLOW_CANDLE
- - && obj_type != WAX_CANDLE && obj_type != LENSES
- + && obj_type != CREDIT_CARD && !Is_candle(otmp)
- + && obj_type != LENSES
- && obj_type != TIN_WHISTLE && obj_type != MAGIC_WHISTLE);
- break;
- case ROCK_CLASS: /* includes boulder */
- diff --git c/src/muse.c w/src/muse.c
- index ec533c0..c2b0880 100644
- --- c/src/muse.c
- +++ w/src/muse.c
- @@ -727,7 +727,7 @@ struct monst *mtmp;
- pline_The("digging ray is ineffective.");
- return 2;
- }
- - if (!Can_dig_down(&u.uz) && !levl[mtmp->mx][mtmp->my].candig) {
- + if (!Can_dig_hole(mtmp->mx, mtmp->my, &u.uz)) {
- if (canseemon(mtmp))
- pline_The("%s here is too hard to dig in.",
- surface(mtmp->mx, mtmp->my));
- diff --git c/src/objects.c w/src/objects.c
- index fcca3b0..a3f8c99 100644
- --- c/src/objects.c
- +++ w/src/objects.c
- @@ -658,8 +658,9 @@ TOOL("skeleton key", "key", 0, 0, 0, 0, 80, 3, 10, IRON, HI_METAL),
- TOOL("lock pick", None, 1, 0, 0, 0, 60, 4, 20, IRON, HI_METAL),
- TOOL("credit card", None, 1, 0, 0, 0, 15, 1, 10, PLASTIC, CLR_WHITE),
- /* light sources */
- -TOOL("tallow candle", "candle", 0, 1, 0, 0, 20, 2, 10, WAX, CLR_WHITE),
- +TOOL("tallow candle", "candle", 0, 1, 0, 0, 17, 2, 10, WAX, CLR_WHITE),
- TOOL("wax candle", "candle", 0, 1, 0, 0, 5, 2, 20, WAX, CLR_WHITE),
- +TOOL("guiding candle", "candle", 0, 1, 1, 0, 3, 2, 30, WAX, CLR_WHITE),
- TOOL("brass lantern", None, 1, 0, 0, 0, 30, 30, 12, COPPER, CLR_YELLOW),
- TOOL("oil lamp", "lamp", 0, 0, 0, 0, 45, 20, 10, COPPER, CLR_YELLOW),
- TOOL("magic lamp", "lamp", 0, 0, 1, 0, 15, 20, 50, COPPER, CLR_YELLOW),
- diff --git c/src/objnam.c w/src/objnam.c
- index 06efd9b..cb0f06d 100644
- --- c/src/objnam.c
- +++ w/src/objnam.c
- @@ -1077,8 +1077,7 @@ unsigned doname_flags;
- break;
- } else if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
- || obj->otyp == BRASS_LANTERN || Is_candle(obj)) {
- - if (Is_candle(obj)
- - && obj->age < 20L * (long) objects[obj->otyp].oc_cost)
- + if (Is_candle(obj) && obj->age < candle_burn_time(obj))
- Strcat(prefix, "partly used ");
- if (obj->lamplit)
- Strcat(bp, " (lit)");
- @@ -2668,7 +2667,7 @@ struct o_range {
- STATIC_OVL NEARDATA const struct o_range o_ranges[] = {
- { "bag", TOOL_CLASS, SACK, BAG_OF_TRICKS },
- { "lamp", TOOL_CLASS, OIL_LAMP, MAGIC_LAMP },
- - { "candle", TOOL_CLASS, TALLOW_CANDLE, WAX_CANDLE },
- + { "candle", TOOL_CLASS, TALLOW_CANDLE, GUIDING_CANDLE },
- { "horn", TOOL_CLASS, TOOLED_HORN, HORN_OF_PLENTY },
- { "shield", ARMOR_CLASS, SMALL_SHIELD, SHIELD_OF_REFLECTION },
- { "hat", ARMOR_CLASS, FEDORA, DUNCE_CAP },
- @@ -3707,7 +3706,7 @@ struct obj *no_wish;
- typ = FAKE_AMULET_OF_YENDOR;
- break;
- case CANDELABRUM_OF_INVOCATION:
- - typ = rnd_class(TALLOW_CANDLE, WAX_CANDLE);
- + typ = rnd_class(TALLOW_CANDLE, GUIDING_CANDLE);
- break;
- case BELL_OF_OPENING:
- typ = BELL;
- @@ -3741,7 +3740,8 @@ struct obj *no_wish;
- /* if player specified a reasonable count, maybe honor it */
- if (cnt > 0 && objects[typ].oc_merge
- - && (wizard || cnt < rnd(6) || (cnt <= 7 && Is_candle(otmp))
- + && (wizard || cnt < rnd(6) || (cnt <= 7 && Is_candle(otmp)
- + && !objects[typ].oc_magic)
- || (cnt <= 20 && ((oclass == WEAPON_CLASS && is_ammo(otmp))
- || typ == ROCK || is_missile(otmp)))))
- otmp->quan = (long) cnt;
- diff --git c/src/pager.c w/src/pager.c
- index 5ca886d..0b2b07e 100644
- --- c/src/pager.c
- +++ w/src/pager.c
- @@ -167,7 +167,7 @@ struct obj **obj_p;
- *obj_p = (struct obj *) 0;
- /* TODO: check inside containers in case glyph came from detection */
- - if ((otmp = sobj_at(glyphotyp, x, y)) == 0)
- + if ((otmp = sobj_at(glyphotyp, x, y)) == 0 && levl[x][y].buried)
- for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj)
- if (otmp->ox == x && otmp->oy == y && otmp->otyp == glyphotyp)
- break;
- diff --git c/src/polyself.c w/src/polyself.c
- index a8e4342..d8ff152 100644
- --- c/src/polyself.c
- +++ w/src/polyself.c
- @@ -1320,9 +1320,9 @@ dogaze()
- continue;
- if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) {
- looked++;
- - if (Invis && !perceives(mtmp->data)) {
- + if (Invis && !perceives_you(mtmp->data)) {
- pline("%s seems not to notice your gaze.", Monnam(mtmp));
- - } else if (mtmp->minvis && !See_invisible) {
- + } else if (minvisible(mtmp) && !See_invisible) {
- You_cant("see where to gaze at %s.", Monnam(mtmp));
- } else if (M_AP_TYPE(mtmp) == M_AP_FURNITURE
- || M_AP_TYPE(mtmp) == M_AP_OBJECT) {
- diff --git c/src/potion.c w/src/potion.c
- index 7d8afd0..5596433 100644
- --- c/src/potion.c
- +++ w/src/potion.c
- @@ -439,7 +439,8 @@ self_invis_message()
- pline("%s %s.",
- Hallucination ? "Far out, man! You"
- : "Gee! All of a sudden, you",
- - See_invisible ? "can see right through yourself"
- + See_invisible || candetect(u.ux, u.uy)
- + ? "can see right through yourself"
- : "can't see yourself");
- }
- @@ -1680,8 +1681,9 @@ register struct obj *obj;
- if (!Blind && !Invis) {
- kn++;
- pline("For an instant you %s!",
- - See_invisible ? "could see right through yourself"
- - : "couldn't see yourself");
- + See_invisible || candetect(u.ux, u.uy)
- + ? "could see right through yourself"
- + : "couldn't see yourself");
- }
- break;
- case POT_PARALYSIS:
- diff --git c/src/priest.c w/src/priest.c
- index d97886c..646fe5c 100644
- --- c/src/priest.c
- +++ w/src/priest.c
- @@ -213,7 +213,7 @@ register struct monst *priest;
- }
- avoid = FALSE;
- }
- - } else if (Invis)
- + } else if (Invis && !perceives_you(priest->data))
- avoid = FALSE;
- return move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, gx, gy);
- diff --git c/src/save.c w/src/save.c
- index c3ce6d0..efce8d3 100644
- --- c/src/save.c
- +++ w/src/save.c
- @@ -580,7 +580,7 @@ boolean rlecomp;
- && prm->flags == rgrm->flags && prm->lit == rgrm->lit
- && prm->waslit == rgrm->waslit
- && prm->roomno == rgrm->roomno && prm->edge == rgrm->edge
- - && prm->candig == rgrm->candig) {
- + && prm->buried == rgrm->buried) {
- match++;
- if (match > 254) {
- match = 254; /* undo this match */
- diff --git c/src/shk.c w/src/shk.c
- index d5ad782..8ea5562 100644
- --- c/src/shk.c
- +++ w/src/shk.c
- @@ -579,7 +579,7 @@ char *enterstring;
- if (muteshk(shkp) || eshkp->following)
- return; /* no dialog */
- - if (Invis) {
- + if (Invis && !perceives_you(shkp->data)) {
- pline("%s senses your presence.", Shknam(shkp));
- if (!Deaf && !muteshk(shkp))
- verbalize("Invisible customers are not welcome!");
- @@ -2177,8 +2177,7 @@ boolean unpaid_only;
- if (saleable(shkp, otmp) && !otmp->unpaid
- && otmp->oclass != BALL_CLASS
- && !(otmp->oclass == FOOD_CLASS && otmp->oeaten)
- - && !(Is_candle(otmp)
- - && otmp->age < 20L * (long) objects[otmp->otyp].oc_cost))
- + && !(Is_candle(otmp) && otmp->age < candle_burn_time(otmp)))
- price += set_cost(otmp, shkp);
- } else {
- /* no_charge is only set for floor items (including
- @@ -3117,8 +3116,7 @@ xchar x, y;
- if ((!saleitem && !(container && cltmp > 0L)) || eshkp->billct == BILLSZ
- || obj->oclass == BALL_CLASS || obj->oclass == CHAIN_CLASS
- || offer == 0L || (obj->oclass == FOOD_CLASS && obj->oeaten)
- - || (Is_candle(obj)
- - && obj->age < 20L * (long) objects[obj->otyp].oc_cost)) {
- + || (Is_candle(obj) && obj->age < candle_burn_time(obj))) {
- pline("%s seems uninterested%s.", Shknam(shkp),
- cgold ? " in the rest" : "");
- if (container)
- @@ -3373,8 +3371,7 @@ boolean shk_buying;
- tmp += 10L * (long) obj->spe;
- break;
- case TOOL_CLASS:
- - if (Is_candle(obj)
- - && obj->age < 20L * (long) objects[obj->otyp].oc_cost)
- + if (Is_candle(obj) && obj->age < candle_burn_time(obj))
- tmp /= 2L;
- break;
- }
- @@ -3848,7 +3845,7 @@ struct monst *shkp;
- avoid = FALSE;
- } else {
- #define GDIST(x, y) (dist2(x, y, gx, gy))
- - if (Invis || u.usteed) {
- + if (Invis && !perceives_you(shkp->data) || u.usteed) {
- avoid = FALSE;
- } else {
- uondoor = (u.ux == eshkp->shd.x && u.uy == eshkp->shd.y);
- @@ -4178,7 +4175,7 @@ boolean cant_mollify;
- return;
- }
- - if (Invis)
- + if (Invis && !perceives_you(shkp->data))
- Your("invisibility does not fool %s!", shkname(shkp));
- Sprintf(qbuf, "%sYou did %ld %s worth of damage!%s Pay?",
- !animal ? cad(TRUE) : "", cost_of_damage,
- @@ -4630,7 +4627,8 @@ register xchar x, y;
- && shkp->mcanmove && !shkp->msleeping
- && (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) {
- pline("%s%s blocks your way!", Shknam(shkp),
- - Invis ? " senses your motion and" : "");
- + Invis && !perceives_you(shkp->data) ? " senses your motion and"
- + : "");
- return TRUE;
- }
- return FALSE;
- @@ -4664,10 +4662,11 @@ register xchar x, y;
- if (shkp->mx == sx && shkp->my == sy && shkp->mcanmove && !shkp->msleeping
- && (x == sx - 1 || x == sx + 1 || y == sy - 1 || y == sy + 1)
- - && (Invis || carrying(PICK_AXE) || carrying(DWARVISH_MATTOCK)
- - || u.usteed)) {
- + && (Invis && !perceives_you(shkp->data) || carrying(PICK_AXE)
- + || carrying(DWARVISH_MATTOCK) || u.usteed)) {
- pline("%s%s blocks your way!", Shknam(shkp),
- - Invis ? " senses your motion and" : "");
- + Invis && !perceives_you(shkp->data) ? " senses your motion and"
- + : "");
- return TRUE;
- }
- return FALSE;
- diff --git c/src/shknam.c w/src/shknam.c
- index a36b67e..cb54cc7 100644
- --- c/src/shknam.c
- +++ w/src/shknam.c
- @@ -330,8 +330,9 @@ const struct shclass shtypes[] = {
- TOOL_CLASS,
- 0,
- D_SHOP,
- - { { 30, -WAX_CANDLE },
- - { 48, -TALLOW_CANDLE },
- + { { 25, -WAX_CANDLE },
- + { 38, -TALLOW_CANDLE },
- + { 15, -GUIDING_CANDLE },
- { 5, -BRASS_LANTERN },
- { 9, -OIL_LAMP },
- { 3, -MAGIC_LAMP },
- diff --git c/src/timeout.c w/src/timeout.c
- index a4408de..c02319f 100644
- --- c/src/timeout.c
- +++ w/src/timeout.c
- @@ -594,7 +594,7 @@ nh_timeout()
- case INVIS:
- newsym(u.ux, u.uy);
- if (!Invis && !BInvis && !Blind) {
- - You(!See_invisible
- + You(!See_invisible && !candetect(u.ux, u.uy)
- ? "are no longer invisible."
- : "can no longer see through yourself.");
- stop_occupation();
- @@ -1249,6 +1249,7 @@ long timeout;
- case CANDELABRUM_OF_INVOCATION:
- case TALLOW_CANDLE:
- case WAX_CANDLE:
- + case GUIDING_CANDLE:
- switch (obj->age) {
- case 75:
- if (canseeit)
- @@ -1411,6 +1412,7 @@ boolean already_lit;
- int radius = 3;
- long turns = 0;
- boolean do_timer = TRUE;
- + boolean detect = FALSE;
- if (obj->age == 0 && obj->otyp != MAGIC_LAMP && !artifact_light(obj))
- return;
- @@ -1443,6 +1445,10 @@ boolean already_lit;
- turns = obj->age;
- break;
- + case GUIDING_CANDLE:
- + if (!obj->cursed)
- + detect = TRUE;
- + /* fall through */
- case CANDELABRUM_OF_INVOCATION:
- case TALLOW_CANDLE:
- case WAX_CANDLE:
- @@ -1461,7 +1467,7 @@ boolean already_lit;
- if (artifact_light(obj)) {
- obj->lamplit = 1;
- do_timer = FALSE;
- - radius = arti_light_radius(obj);
- + radius = dynamic_light_radius(obj);
- } else {
- impossible("begin burn: unexpected %s", xname(obj));
- turns = obj->age;
- @@ -1487,7 +1493,9 @@ boolean already_lit;
- xchar x, y;
- if (get_obj_location(obj, &x, &y, CONTAINED_TOO | BURIED_TOO))
- - new_light_source(x, y, radius, LS_OBJECT, obj_to_any(obj));
- + new_light_source(x, y, radius,
- + detect ? LS_OBJECT | LS_DETECT : LS_OBJECT,
- + obj_to_any(obj));
- else
- impossible("begin_burn: can't get obj position");
- }
- diff --git c/src/trap.c w/src/trap.c
- index 02d1030..7a06ff0 100644
- --- c/src/trap.c
- +++ w/src/trap.c
- @@ -487,7 +487,7 @@ boolean td; /* td == TRUE : trap door or hole */
- if (Sokoban && Can_fall_thru(&u.uz))
- ; /* KMH -- You can't escape the Sokoban level traps */
- else if (Levitation || u.ustuck
- - || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig) || Flying
- + || !Can_fall_thru(&u.uz) || Flying
- || is_clinger(youmonst.data)
- || (Inhell && !u.uevent.invoked && newlevel == bottom)) {
- dont_fall = "don't fall in.";
- diff --git c/src/uhitm.c w/src/uhitm.c
- index f478d02..fdbc616 100644
- --- c/src/uhitm.c
- +++ w/src/uhitm.c
- @@ -3008,7 +3008,7 @@ struct monst *mtmp;
- /* cloned Wiz starts out mimicking some other monster and
- might make himself invisible before being revealed */
- - if (mtmp->minvis && !See_invisible)
- + if (minvisible(mtmp) && !See_invisible)
- what = generic;
- else
- what = a_monnam(mtmp);
- diff --git c/src/vision.c w/src/vision.c
- index b8ce2e5..2b95930 100644
- --- c/src/vision.c
- +++ w/src/vision.c
- @@ -513,6 +513,7 @@ int control;
- int dx, dy; /* one step from a lit door or lit wall (see below) */
- register int col; /* inner loop counter */
- register struct rm *lev; /* pointer to current pos */
- + struct obj *otmp; /* for iterating through inventory */
- struct rm *flev; /* pointer to position in "front" of current pos */
- extern unsigned char seenv_matrix[3][3]; /* from display.c */
- static unsigned char colbump[COLNO + 1]; /* cols to bump sv */
- @@ -570,6 +571,17 @@ int control;
- newsym(col, row);
- }
- + /* Check if the invisible hero can be seen because of their guiding
- + * candle (normally would be checked below). We don't check for
- + * nearby candles (on the ground or held by monsters) because that's
- + * too much effort for too rare an occurence.
- + */
- + for (otmp = invent; otmp; otmp = otmp->nobj)
- + if (otmp->otyp == GUIDING_CANDLE && otmp->lamplit) {
- + viz_array[u.uy][u.ux] |= TEMP_DETECT;
- + break;
- + }
- +
- /* skip the normal update loop */
- goto skip;
- } else if (Is_rogue_level(&u.uz)) {
- @@ -737,8 +749,10 @@ int control;
- lev->seenv |=
- new_angle(lev, sv, row, col); /* update seen angle */
- - /* Update pos if previously not in sight or new angle. */
- - if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv)
- + /* Update pos if previously not in sight or new angle
- + * or when entering/leaving the radius of guiding candle. */
- + if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv
- + || (old_row[col] ^ next_row[col]) & TEMP_DETECT)
- newsym(col, row);
- } else if ((next_row[col] & COULD_SEE)
- @@ -766,9 +780,11 @@ int control;
- lev->seenv |= new_angle(lev, sv, row, col);
- /* Update pos if previously not in sight or new
- - * angle.*/
- + * angle or when entering/leaving the radius of
- + * guiding candle. */
- if (!(old_row[col] & IN_SIGHT)
- - || oldseenv != lev->seenv)
- + || oldseenv != lev->seenv
- + || (old_row[col] ^ next_row[col]) & TEMP_DETECT)
- newsym(col, row);
- } else
- goto not_in_sight; /* we don't see it */
- @@ -779,8 +795,10 @@ int control;
- oldseenv = lev->seenv;
- lev->seenv |= new_angle(lev, sv, row, col);
- - /* Update pos if previously not in sight or new angle. */
- - if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv)
- + /* Update pos if previously not in sight or new angle or
- + * when entering/leaving the radius of guiding candle. */
- + if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv
- + || (old_row[col] ^ next_row[col]) & TEMP_DETECT)
- newsym(col, row);
- }
- } else if ((next_row[col] & COULD_SEE) && lev->waslit) {
- @@ -2806,7 +2824,7 @@ struct monst *mon;
- if (useemon && mon->minvis)
- how_seen |= MONSEEN_SEEINVIS;
- /* infravision */
- - if ((!mon->minvis || See_invisible) && see_with_infrared(mon))
- + if ((!minvisible(mon) || See_invisible) && see_with_infrared(mon))
- how_seen |= MONSEEN_INFRAVIS;
- /* telepathy */
- if (tp_sensemon(mon))
- diff --git c/src/worn.c w/src/worn.c
- index 1a966b7..05328b3 100644
- --- c/src/worn.c
- +++ w/src/worn.c
- @@ -522,7 +522,7 @@ boolean racialexception;
- return; /* probably putting previous item on */
- /* Get a copy of monster's name before altering its visibility */
- - Strcpy(nambuf, See_invisible ? Monnam(mon) : mon_nam(mon));
- + Strcpy(nambuf, mon_nam(mon));
- old = which_armor(mon, flag);
- if (old && old->cursed)
- @@ -640,7 +640,7 @@ outer_break:
- update_mon_intrinsics(mon, best, TRUE, creation);
- /* if couldn't see it but now can, or vice versa, */
- if (!creation && (unseen ^ !canseemon(mon))) {
- - if (mon->minvis && !See_invisible) {
- + if (minvisible(mon) && !See_invisible) {
- pline("Suddenly you cannot see %s.", nambuf);
- makeknown(best->otyp);
- } /* else if (!mon->minvis) pline("%s suddenly appears!",
- diff --git c/src/zap.c w/src/zap.c
- index a9350eb..ec6526a 100644
- --- c/src/zap.c
- +++ w/src/zap.c
- @@ -3353,7 +3353,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
- prepared for multiple hits so just get first one
- that's either visible or could see its invisible
- self. [No tmp_at() cleanup is needed here.] */
- - if (!mtmp->minvis || perceives(mtmp->data))
- + if (!minvisible(mtmp) || perceives(mtmp->data))
- return mtmp;
- } else if (weapon != ZAPPED_WAND) {
Add Comment
Please, Sign In to add comment