Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git i/include/extern.h w/include/extern.h
- index b6f4825..399c940 100644
- --- i/include/extern.h
- +++ w/include/extern.h
- @@ -355,6 +355,7 @@ E int FDECL(back_to_glyph, (XCHAR_P, XCHAR_P));
- E int FDECL(zapdir_to_glyph, (int, int, int));
- E int FDECL(glyph_at, (XCHAR_P, XCHAR_P));
- E void NDECL(set_wall_state);
- +E int FDECL(set_wall, (int, int, int));
- E void FDECL(unset_seenv, (struct rm *, int, int, int, int));
- E int FDECL(warning_of, (struct monst *));
- @@ -2283,6 +2284,7 @@ E void FDECL(fill_room, (struct mkroom *, BOOLEAN_P));
- E boolean FDECL(load_special, (const char *));
- E xchar FDECL(selection_getpoint, (int, int, struct opvar *));
- E struct opvar *FDECL(selection_opvar, (char *));
- +E void FDECL(set_door_orientation, (int, int));
- E void FDECL(opvar_free_x, (struct opvar *));
- E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int))));
- E void FDECL(selection_floodfill, (struct opvar *, int, int, BOOLEAN_P));
- diff --git i/src/display.c w/src/display.c
- index 5c98c8a..1c6b6f7 100644
- --- i/src/display.c
- +++ w/src/display.c
- @@ -131,7 +131,6 @@ STATIC_DCL boolean FDECL(more_than_one, (int, int, int, int, int));
- #endif
- STATIC_DCL int FDECL(set_twall, (int, int, int, int, int, int, int, int));
- -STATIC_DCL int FDECL(set_wall, (int, int, int));
- STATIC_DCL int FDECL(set_corn, (int, int, int, int, int, int, int, int));
- STATIC_DCL int FDECL(set_crosswall, (int, int));
- STATIC_DCL void FDECL(set_seenv, (struct rm *, int, int, int, int));
- @@ -1921,7 +1920,7 @@ int x1, y1, x2, y2, x3, y3;
- }
- /* Return wall mode for a horizontal or vertical wall. */
- -STATIC_OVL int
- +int
- set_wall(x, y, horiz)
- int x, y, horiz;
- {
- diff --git i/src/lock.c w/src/lock.c
- index 067eb6c..60ce3d6 100644
- --- i/src/lock.c
- +++ w/src/lock.c
- @@ -1031,6 +1031,35 @@ int x, y;
- } else
- res = FALSE;
- break;
- + case WAN_MAKE_INVISIBLE:
- + if (door->doormask & (D_LOCKED | D_CLOSED)) {
- + /* Riders shall not be blocked */
- + if (Is_astralevel(&u.uz))
- + {
- + msg = "The door momentarily fades.";
- + res = FALSE;
- + break;
- + }
- + /* Probably should not count as vandalism,
- + * but the original shop door will still reappear */
- + if (*in_rooms(x, y, SHOPBASE))
- + add_damage(x, y, 0L);
- + /* BUG: secret doors can only pretend to be straight walls,
- + * so a door created with wizard lock in a room corner
- + * or other weird position will display as a wrong kind
- + * of wall when made invisible. This is not noticeable
- + * with the default symset, but all others will glitch.
- + * There's no easy way to fix it short of arbitrarily refusing
- + * to vanish doors at weird positions, which is also ugly. */
- + door->typ = SDOOR;
- + set_door_orientation(x, y);
- + door->doormask &= ~WM_MASK;
- + door->wall_info |= set_wall(x, y, door->horizontal);
- + newsym(x, y);
- + msg = "The door vanishes!";
- + } else
- + res = FALSE;
- + break;
- default:
- impossible("magic (%d) attempted on door.", otmp->otyp);
- break;
- diff --git i/src/shk.c w/src/shk.c
- index 1b42f27..e0b7cae 100644
- --- i/src/shk.c
- +++ w/src/shk.c
- @@ -3303,8 +3303,8 @@ long cost;
- /* Don't schedule for repair unless it's a real shop entrance */
- for (shops = in_rooms(x, y, SHOPBASE); *shops; shops++)
- - if ((mtmp = shop_keeper(*shops)) != 0 && x == ESHK(mtmp)->shd.x
- - && y == ESHK(mtmp)->shd.y)
- + if ((mtmp = shop_keeper(*shops)) != 0
- + && x == ESHK(mtmp)->shd.x && y == ESHK(mtmp)->shd.y)
- break;
- if (!*shops)
- return;
- @@ -3312,10 +3312,11 @@ long cost;
- for (tmp_dam = level.damagelist; tmp_dam; tmp_dam = tmp_dam->next)
- if (tmp_dam->place.x == x && tmp_dam->place.y == y) {
- tmp_dam->cost += cost;
- + tmp_dam->when = monstermoves; /* needed by pay_for_damage() */
- return;
- }
- - tmp_dam = (struct damage *) alloc((unsigned) sizeof(struct damage));
- - (void) memset((genericptr_t)tmp_dam, 0, sizeof(struct damage));
- + tmp_dam = (struct damage *) alloc((unsigned) sizeof *tmp_dam);
- + (void) memset((genericptr_t) tmp_dam, 0, sizeof *tmp_dam);
- tmp_dam->when = monstermoves;
- tmp_dam->place.x = x;
- tmp_dam->place.y = y;
- @@ -3362,11 +3363,11 @@ boolean croaked;
- if (IS_DOOR(levl[x][y].typ))
- old_doormask = levl[x][y].doormask;
- - if (croaked)
- + if (croaked) {
- disposition = (shops[1]) ? 0 : 1;
- - else if (stop_picking)
- + } else if (stop_picking) {
- disposition = repair_damage(shkp, tmp_dam, FALSE);
- - else {
- + } else {
- /* Defer the stop_occupation() until after repair msgs */
- if (closed_door(x, y))
- stop_picking = picking_at(x, y);
- @@ -3461,15 +3462,16 @@ boolean croaked;
- */
- int
- repair_damage(shkp, tmp_dam, catchup)
- -register struct monst *shkp;
- -register struct damage *tmp_dam;
- +struct monst *shkp;
- +struct damage *tmp_dam;
- boolean catchup; /* restoring a level */
- {
- - register xchar x, y, i;
- + xchar x, y;
- xchar litter[9];
- - register struct monst *mtmp;
- - register struct obj *otmp;
- - register struct trap *ttmp;
- + struct monst *mtmp;
- + struct obj *otmp;
- + struct trap *ttmp;
- + int i, k, ix, iy, disposition = 1;
- if ((monstermoves - tmp_dam->when) < REPAIR_DELAY)
- return 0;
- @@ -3478,18 +3480,14 @@ boolean catchup; /* restoring a level */
- x = tmp_dam->place.x;
- y = tmp_dam->place.y;
- if (!IS_ROOM(tmp_dam->typ)) {
- - if (x == u.ux && y == u.uy)
- - if (!Passes_walls)
- - return 0;
- - if (x == shkp->mx && y == shkp->my)
- - return 0;
- - if ((mtmp = m_at(x, y)) && (!passes_walls(mtmp->data)))
- + if ((x == u.ux && y == u.uy && !Passes_walls)
- + || (x == shkp->mx && y == shkp->my)
- + || ((mtmp = m_at(x, y)) && !passes_walls(mtmp->data)))
- return 0;
- }
- if ((ttmp = t_at(x, y)) != 0) {
- - if (x == u.ux && y == u.uy)
- - if (!Passes_walls)
- - return 0;
- + if (x == u.ux && y == u.uy && !Passes_walls)
- + return 0;
- if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) {
- /* convert to an object */
- otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP,
- @@ -3499,48 +3497,60 @@ boolean catchup; /* restoring a level */
- (void) mpickobj(shkp, otmp);
- }
- deltrap(ttmp);
- - if (IS_DOOR(tmp_dam->typ) && !(levl[x][y].doormask & D_ISOPEN)) {
- - levl[x][y].doormask = D_CLOSED;
- - block_point(x, y);
- - } else if (IS_WALL(tmp_dam->typ)) {
- - levl[x][y].typ = tmp_dam->typ;
- - block_point(x, y);
- - }
- - newsym(x, y);
- - return 3;
- + if (cansee(x, y))
- + newsym(x, y);
- + if (!catchup)
- + disposition = 3;
- }
- - if (IS_ROOM(tmp_dam->typ)) {
- - /* No messages, because player already filled trap door */
- - return 1;
- - }
- - if ((tmp_dam->typ == levl[x][y].typ)
- - && (!IS_DOOR(tmp_dam->typ) || (levl[x][y].doormask > D_BROKEN)))
- - /* No messages if player already replaced shop door */
- - return 1;
- + if (IS_ROOM(tmp_dam->typ)
- + || (tmp_dam->typ == levl[x][y].typ
- + && (!IS_DOOR(tmp_dam->typ) || levl[x][y].doormask > D_BROKEN)))
- + /* no terrain fix necessary (trap removal or manually repaired) */
- + return disposition;
- +
- + /* door or wall repair; trap, if any, is now gone;
- + restore original terrain type and move any items away */
- levl[x][y].typ = tmp_dam->typ;
- - (void) memset((genericptr_t) litter, 0, sizeof(litter));
- - if ((otmp = level.objects[x][y]) != 0) {
- -/* Scatter objects haphazardly into the shop */
- + if (IS_DOOR(tmp_dam->typ))
- + levl[x][y].doormask = D_CLOSED; /* arbitrary */
- +
- + (void) memset((genericptr_t) litter, 0, sizeof litter);
- #define NEED_UPDATE 1
- #define OPEN 2
- #define INSHOP 4
- #define horiz(i) ((i % 3) - 1)
- #define vert(i) ((i / 3) - 1)
- + k = 0; /* number of adjacent shop spots */
- + if (level.objects[x][y] && !IS_ROOM(levl[x][y].typ)) {
- for (i = 0; i < 9; i++) {
- - if ((i == 4) || (!ZAP_POS(levl[x + horiz(i)][y + vert(i)].typ)))
- + ix = x + horiz(i);
- + iy = y + vert(i);
- + if (i == 4 || !isok(ix, iy) || !ZAP_POS(levl[ix][iy].typ))
- continue;
- litter[i] = OPEN;
- - if (inside_shop(x + horiz(i), y + vert(i))
- - == ESHK(shkp)->shoproom)
- + if (inside_shop(ix, iy) == ESHK(shkp)->shoproom) {
- litter[i] |= INSHOP;
- + ++k;
- + }
- }
- + }
- + /* placement below assumes there is always at least one adjacent
- + spot; the 'k' check guards against getting stuck in an infinite
- + loop if some irregularly shaped room breaks that assumption */
- + if (k > 0) {
- + /* Scatter objects haphazardly into the shop */
- if (Punished && !u.uswallow
- && ((uchain->ox == x && uchain->oy == y)
- || (uball->ox == x && uball->oy == y))) {
- /*
- * Either the ball or chain is in the repair location.
- - *
- * Take the easy way out and put ball&chain under hero.
- + *
- + * FIXME: message should be reworded; this might be the
- + * shop's doorway rather than a wall, there might be some
- + * other stuff here which isn't junk, and "your junk" has
- + * a slang connotation which could be applicable if hero
- + * has Passes_walls ability.
- */
- if (!Deaf && !muteshk(shkp))
- verbalize("Get your junk out of my wall!");
- @@ -3549,40 +3559,48 @@ boolean catchup; /* restoring a level */
- }
- while ((otmp = level.objects[x][y]) != 0)
- /* Don't mess w/ boulders -- just merge into wall */
- - if ((otmp->otyp == BOULDER) || (otmp->otyp == ROCK)) {
- + if (otmp->otyp == BOULDER || otmp->otyp == ROCK) {
- obj_extract_self(otmp);
- obfree(otmp, (struct obj *) 0);
- } else {
- - while (!(litter[i = rn2(9)] & INSHOP))
- - ;
- + int trylimit = 50;
- +
- + /* otmp must be moved otherwise level.objects[x][y] will
- + never become Null and while-loop won't terminate */
- + do {
- + i = rn2(9);
- + } while (--trylimit && !(litter[i] & INSHOP));
- + if ((litter[i] & (OPEN | INSHOP)) != 0) {
- + ix = x + horiz(i);
- + iy = y + vert(i);
- + } else {
- + /* we know shk isn't at <x,y> because repair
- + is deferred in that situation */
- + ix = shkp->mx;
- + iy = shkp->my;
- + }
- remove_object(otmp);
- - place_object(otmp, x + horiz(i), y + vert(i));
- + place_object(otmp, ix, iy);
- litter[i] |= NEED_UPDATE;
- }
- }
- if (catchup)
- - return 1; /* repair occurred while off level */
- + return 1; /* repair occurred while off level so no messages */
- block_point(x, y);
- - if (IS_DOOR(tmp_dam->typ)) {
- - levl[x][y].doormask = D_CLOSED; /* arbitrary */
- - newsym(x, y);
- - } else {
- - /* don't set doormask - it is (hopefully) the same as it was
- - if not, perhaps save it with the damage array... */
- -
- - if (IS_WALL(tmp_dam->typ) && cansee(x, y)) {
- - /* Player sees actual repair process, so they KNOW it's a wall */
- + if (cansee(x, y)) {
- + if (IS_WALL(tmp_dam->typ))
- + /* player sees actual repair process, so KNOWS it's a wall */
- levl[x][y].seenv = SVALL;
- - newsym(x, y);
- - }
- - /* Mark this wall as "repaired". There currently is no code
- - to do anything about repaired walls, so don't do it. */
- + newsym(x, y);
- }
- for (i = 0; i < 9; i++)
- if (litter[i] & NEED_UPDATE)
- newsym(x + horiz(i), y + vert(i));
- - return 2;
- +
- + if (disposition < 3)
- + disposition = 2;
- + return disposition;
- #undef NEED_UPDATE
- #undef OPEN
- #undef INSHOP
- @@ -3595,12 +3613,12 @@ boolean catchup; /* restoring a level */
- */
- int
- shk_move(shkp)
- -register struct monst *shkp;
- +struct monst *shkp;
- {
- - register xchar gx, gy, omx, omy;
- - register int udist;
- - register schar appr;
- - register struct eshk *eshkp = ESHK(shkp);
- + xchar gx, gy, omx, omy;
- + int udist;
- + schar appr;
- + struct eshk *eshkp = ESHK(shkp);
- int z;
- boolean uondoor = FALSE, satdoor, avoid = FALSE, badinv;
- @@ -3858,24 +3876,22 @@ boolean cant_mollify;
- {
- register struct monst *shkp = (struct monst *) 0;
- char shops_affected[5];
- - register boolean uinshp = (*u.ushops != '\0');
- + boolean uinshp = (*u.ushops != '\0');
- char qbuf[80];
- - register xchar x, y;
- + xchar x, y;
- boolean dugwall = (!strcmp(dmgstr, "dig into") /* wand */
- || !strcmp(dmgstr, "damage")); /* pick-axe */
- boolean animal, pursue;
- struct damage *tmp_dam, *appear_here = 0;
- - /* any number >= (80*80)+(24*24) would do, actually */
- long cost_of_damage = 0L;
- - unsigned int nearest_shk = 7000, nearest_damage = 7000;
- + unsigned int nearest_shk = (ROWNO * ROWNO) + (COLNO * COLNO),
- + nearest_damage = nearest_shk;
- int picks = 0;
- - for (tmp_dam = level.damagelist;
- - (tmp_dam && (tmp_dam->when == monstermoves));
- - tmp_dam = tmp_dam->next) {
- + for (tmp_dam = level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) {
- char *shp;
- - if (!tmp_dam->cost)
- + if (tmp_dam->when != monstermoves || !tmp_dam->cost)
- continue;
- cost_of_damage += tmp_dam->cost;
- Strcpy(shops_affected,
- diff --git i/src/sp_lev.c w/src/sp_lev.c
- index a1b1f6d..800b0aa 100644
- --- i/src/sp_lev.c
- +++ w/src/sp_lev.c
- @@ -52,7 +52,6 @@ STATIC_DCL void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
- STATIC_DCL void NDECL(shuffle_alignments);
- STATIC_DCL void NDECL(count_features);
- STATIC_DCL void NDECL(remove_boundary_syms);
- -STATIC_DCL void FDECL(set_door_orientation, (int, int));
- STATIC_DCL void FDECL(maybe_add_door, (int, int, struct mkroom *));
- STATIC_DCL void NDECL(link_doors_rooms);
- STATIC_DCL void NDECL(fill_rooms);
- @@ -704,7 +703,7 @@ remove_boundary_syms()
- }
- /* used by sel_set_door() and link_doors_rooms() */
- -STATIC_OVL void
- +void
- set_door_orientation(x, y)
- int x, y;
- {
- diff --git i/src/zap.c w/src/zap.c
- index 5750b27..5af1a8c 100644
- --- i/src/zap.c
- +++ w/src/zap.c
- @@ -3297,6 +3297,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
- case WAN_OPENING:
- case WAN_LOCKING:
- case WAN_STRIKING:
- + case WAN_MAKE_INVISIBLE:
- case SPE_KNOCK:
- case SPE_WIZARD_LOCK:
- case SPE_FORCE_BOLT:
- @@ -3304,7 +3305,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
- if (cansee(bhitpos.x, bhitpos.y)
- || (obj->otyp == WAN_STRIKING && !Deaf))
- learnwand(obj);
- - if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
- + if (IS_DOOR(levl[bhitpos.x][bhitpos.y].typ)
- + && levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
- && *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) {
- shopdoor = TRUE;
- add_damage(bhitpos.x, bhitpos.y, SHOP_DOOR_COST);
Add Comment
Please, Sign In to add comment