SHARE
TWEET

NetHack secret doors patch (rebased against 3.6.2)

a guest Sep 2nd, 2019 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git c/include/extern.h w/include/extern.h
  2. index 6959e24..5f7e299 100644
  3. --- c/include/extern.h
  4. +++ w/include/extern.h
  5. @@ -365,6 +365,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. @@ -2326,6 +2327,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 c/src/display.c w/src/display.c
  22. index c5b155b..e673644 100644
  23. --- c/src/display.c
  24. +++ w/src/display.c
  25. @@ -138,7 +138,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. @@ -2007,7 +2006,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 c/src/lock.c w/src/lock.c
  43. index 270ab18..9e29ca9 100644
  44. --- c/src/lock.c
  45. +++ w/src/lock.c
  46. @@ -1049,6 +1049,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 c/src/sp_lev.c w/src/sp_lev.c
  83. index cd95210..dba499e 100644
  84. --- c/src/sp_lev.c
  85. +++ w/src/sp_lev.c
  86. @@ -52,7 +52,6 @@ STATIC_DCL void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
  87.  STATIC_DCL void NDECL(shuffle_alignments);
  88.  STATIC_DCL void NDECL(count_features);
  89.  STATIC_DCL void NDECL(remove_boundary_syms);
  90. -STATIC_DCL void FDECL(set_door_orientation, (int, int));
  91.  STATIC_DCL void FDECL(maybe_add_door, (int, int, struct mkroom *));
  92.  STATIC_DCL void NDECL(link_doors_rooms);
  93.  STATIC_DCL void NDECL(fill_rooms);
  94. @@ -717,7 +716,7 @@ remove_boundary_syms()
  95.  }
  96.  
  97.  /* used by sel_set_door() and link_doors_rooms() */
  98. -STATIC_OVL void
  99. +void
  100.  set_door_orientation(x, y)
  101.  int x, y;
  102.  {
  103. diff --git c/src/zap.c w/src/zap.c
  104. index a9350eb..ebe80fe 100644
  105. --- c/src/zap.c
  106. +++ w/src/zap.c
  107. @@ -3394,6 +3394,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
  108.              case WAN_OPENING:
  109.              case WAN_LOCKING:
  110.              case WAN_STRIKING:
  111. +            case WAN_MAKE_INVISIBLE:
  112.              case SPE_KNOCK:
  113.              case SPE_WIZARD_LOCK:
  114.              case SPE_FORCE_BOLT:
  115. @@ -3401,7 +3402,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
  116.                      if (cansee(bhitpos.x, bhitpos.y)
  117.                          || (obj->otyp == WAN_STRIKING && !Deaf))
  118.                          learnwand(obj);
  119. -                    if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
  120. +                    if (IS_DOOR(levl[bhitpos.x][bhitpos.y].typ)
  121. +                        && levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
  122.                          && *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) {
  123.                          shopdoor = TRUE;
  124.                          add_damage(bhitpos.x, bhitpos.y, SHOP_DOOR_COST);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top