Guest User

NetHack secret doors patch

a guest
Aug 5th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.57 KB | None | 0 0
  1. diff --git i/include/extern.h w/include/extern.h
  2. index b6f4825..399c940 100644
  3. --- i/include/extern.h
  4. +++ w/include/extern.h
  5. @@ -355,6 +355,7 @@ E int FDECL(back_to_glyph, (XCHAR_P, XCHAR_P));
  6.  E int FDECL(zapdir_to_glyph, (int, int, int));
  7.  E int FDECL(glyph_at, (XCHAR_P, XCHAR_P));
  8.  E void NDECL(set_wall_state);
  9. +E int FDECL(set_wall, (int, int, int));
  10.  E void FDECL(unset_seenv, (struct rm *, int, int, int, int));
  11.  E int FDECL(warning_of, (struct monst *));
  12.  
  13. @@ -2283,6 +2284,7 @@ E void FDECL(fill_room, (struct mkroom *, BOOLEAN_P));
  14.  E boolean FDECL(load_special, (const char *));
  15.  E xchar FDECL(selection_getpoint, (int, int, struct opvar *));
  16.  E struct opvar *FDECL(selection_opvar, (char *));
  17. +E void FDECL(set_door_orientation, (int, int));
  18.  E void FDECL(opvar_free_x, (struct opvar *));
  19.  E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int))));
  20.  E void FDECL(selection_floodfill, (struct opvar *, int, int, BOOLEAN_P));
  21. diff --git i/src/display.c w/src/display.c
  22. index 5c98c8a..1c6b6f7 100644
  23. --- i/src/display.c
  24. +++ w/src/display.c
  25. @@ -131,7 +131,6 @@ STATIC_DCL boolean FDECL(more_than_one, (int, int, int, int, int));
  26.  #endif
  27.  
  28.  STATIC_DCL int FDECL(set_twall, (int, int, int, int, int, int, int, int));
  29. -STATIC_DCL int FDECL(set_wall, (int, int, int));
  30.  STATIC_DCL int FDECL(set_corn, (int, int, int, int, int, int, int, int));
  31.  STATIC_DCL int FDECL(set_crosswall, (int, int));
  32.  STATIC_DCL void FDECL(set_seenv, (struct rm *, int, int, int, int));
  33. @@ -1921,7 +1920,7 @@ int x1, y1, x2, y2, x3, y3;
  34.  }
  35.  
  36.  /* Return wall mode for a horizontal or vertical wall. */
  37. -STATIC_OVL int
  38. +int
  39.  set_wall(x, y, horiz)
  40.  int x, y, horiz;
  41.  {
  42. diff --git i/src/lock.c w/src/lock.c
  43. index 067eb6c..60ce3d6 100644
  44. --- i/src/lock.c
  45. +++ w/src/lock.c
  46. @@ -1031,6 +1031,35 @@ int x, y;
  47.          } else
  48.              res = FALSE;
  49.          break;
  50. +    case WAN_MAKE_INVISIBLE:
  51. +        if (door->doormask & (D_LOCKED | D_CLOSED)) {
  52. +            /* Riders shall not be blocked */
  53. +            if (Is_astralevel(&u.uz))
  54. +              {
  55. +                msg = "The door momentarily fades.";
  56. +                res = FALSE;
  57. +                break;
  58. +              }
  59. +            /* Probably should not count as vandalism,
  60. +             * but the original shop door will still reappear */
  61. +            if (*in_rooms(x, y, SHOPBASE))
  62. +                add_damage(x, y, 0L);
  63. +            /* BUG: secret doors can only pretend to be straight walls,
  64. +             * so a door created with wizard lock in a room corner
  65. +             * or other weird position will display as a wrong kind
  66. +             * of wall when made invisible.  This is not noticeable
  67. +             * with the default symset, but all others will glitch.
  68. +             * There's no easy way to fix it short of arbitrarily refusing
  69. +             * to vanish doors at weird positions, which is also ugly. */
  70. +            door->typ = SDOOR;
  71. +            set_door_orientation(x, y);
  72. +            door->doormask &= ~WM_MASK;
  73. +            door->wall_info |= set_wall(x, y, door->horizontal);
  74. +            newsym(x, y);
  75. +            msg = "The door vanishes!";
  76. +        } else
  77. +            res = FALSE;
  78. +        break;
  79.      default:
  80.          impossible("magic (%d) attempted on door.", otmp->otyp);
  81.          break;
  82. diff --git i/src/shk.c w/src/shk.c
  83. index 1b42f27..4bce8a5 100644
  84. --- i/src/shk.c
  85. +++ w/src/shk.c
  86. @@ -3499,7 +3499,8 @@ boolean catchup; /* restoring a level */
  87.              (void) mpickobj(shkp, otmp);
  88.          }
  89.          deltrap(ttmp);
  90. -        if (IS_DOOR(tmp_dam->typ) && !(levl[x][y].doormask & D_ISOPEN)) {
  91. +        if (IS_DOOR(tmp_dam->typ) && IS_DOOR(levl[x][y].typ)
  92. +            && !(levl[x][y].doormask & D_ISOPEN)) {
  93.              levl[x][y].doormask = D_CLOSED;
  94.              block_point(x, y);
  95.          } else if (IS_WALL(tmp_dam->typ)) {
  96. diff --git i/src/sp_lev.c w/src/sp_lev.c
  97. index a1b1f6d..800b0aa 100644
  98. --- i/src/sp_lev.c
  99. +++ w/src/sp_lev.c
  100. @@ -52,7 +52,6 @@ STATIC_DCL void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
  101.  STATIC_DCL void NDECL(shuffle_alignments);
  102.  STATIC_DCL void NDECL(count_features);
  103.  STATIC_DCL void NDECL(remove_boundary_syms);
  104. -STATIC_DCL void FDECL(set_door_orientation, (int, int));
  105.  STATIC_DCL void FDECL(maybe_add_door, (int, int, struct mkroom *));
  106.  STATIC_DCL void NDECL(link_doors_rooms);
  107.  STATIC_DCL void NDECL(fill_rooms);
  108. @@ -704,7 +703,7 @@ remove_boundary_syms()
  109.  }
  110.  
  111.  /* used by sel_set_door() and link_doors_rooms() */
  112. -STATIC_OVL void
  113. +void
  114.  set_door_orientation(x, y)
  115.  int x, y;
  116.  {
  117. diff --git i/src/zap.c w/src/zap.c
  118. index 5750b27..2c2ab38 100644
  119. --- i/src/zap.c
  120. +++ w/src/zap.c
  121. @@ -3297,6 +3297,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
  122.              case WAN_OPENING:
  123.              case WAN_LOCKING:
  124.              case WAN_STRIKING:
  125. +            case WAN_MAKE_INVISIBLE:
  126.              case SPE_KNOCK:
  127.              case SPE_WIZARD_LOCK:
  128.              case SPE_FORCE_BOLT:
  129. @@ -3304,7 +3305,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
  130.                      if (cansee(bhitpos.x, bhitpos.y)
  131.                          || (obj->otyp == WAN_STRIKING && !Deaf))
  132.                          learnwand(obj);
  133. -                    if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
  134. +                    if (IS_DOOR(levl[bhitpos.x][bhitpos.y].typ)
  135. +                        && levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
  136.                          && *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) {
  137.                          shopdoor = TRUE;
  138.                          add_damage(bhitpos.x, bhitpos.y, SHOP_DOOR_COST);
Add Comment
Please, Sign In to add comment