OSDN Git Service

AM_OKAY、ホソソオカ、ユ、ヒ、キ, AM_NO_FIXED_ART、ネハムケケ.
[hengband/hengband.git] / src / grid.c
index 7a2298a..444351a 100644 (file)
@@ -4,11 +4,11 @@
  */
 
 /*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
 #include "angband.h"
@@ -107,14 +107,14 @@ void place_random_stairs(int y, int x)
 /*
  * Place a random type of door at the given location
  */
-void place_random_door(int y, int x)
+void place_random_door(int y, int x, bool room)
 {
        int tmp;
-        cave_type *c_ptr = &cave[y][x];
+       cave_type *c_ptr = &cave[y][x];
 
-        /* Initialize mimic info */
-        c_ptr->mimic = 0;
-        
+       /* Initialize mimic info */
+       c_ptr->mimic = 0;
+       
        if (d_info[dungeon_type].flags1 & DF1_NO_DOORS)
        {
                place_floor_bold(y, x);
@@ -142,10 +142,17 @@ void place_random_door(int y, int x)
        else if (tmp < 600)
        {
                /* Create secret door */
-                place_closed_door(y, x);
+               place_closed_door(y, x);
 
-                /* Hide */
-                c_ptr->mimic = fill_type[randint0(100)];
+               /* Hide. If on the edge of room, use outer wall. */
+               c_ptr->mimic = room ? feat_wall_outer : fill_type[randint0(100)];
+
+               /* Floor type terrain cannot hide a door */
+               if (!(c_ptr->mimic & 0x20))
+               {
+                       c_ptr->feat = c_ptr->mimic;
+                       c_ptr->mimic = 0;
+               }
        }
 
        /* Closed, locked, or stuck doors (400/1000) */
@@ -189,6 +196,9 @@ void place_closed_door(int y, int x)
                /* Create jammed door */
                cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8));
        }
+
+       /* Now it is not floor */
+       cave[y][x].info &= ~(CAVE_MASK);
 }
 
 
@@ -285,7 +295,7 @@ msg_print("
                        /* Place an item */
                        if (randint0(100) < 75)
                        {
-                               place_object(j, k, FALSE, FALSE);
+                               place_object(j, k, 0L);
                        }
 
                        /* Place gold */
@@ -781,6 +791,10 @@ static bool set_tunnel(int *x, int *y, bool affectwall)
                                }
                        }
                }
+
+               /* Clear mimic type */
+               cave[*y][*x].mimic = 0;
+
                place_floor_bold(*y, *x);
 
                return TRUE;
@@ -1004,7 +1018,6 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
 {
        int x3, y3, dx, dy;
        int changex, changey;
-       int midval;
        int length;
        int i;
        bool retval, firstsuccede;
@@ -1036,9 +1049,8 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
                        x3 = (x1 + x2) / 2;
                        y3 = (y1 + y2) / 2;
                }
-               /* cache midvalue */
+               /* cache c_ptr */
                c_ptr = &cave[y3][x3];
-               midval = cave[y3][x3].feat;
                if (is_solid_grid(c_ptr))
                {
                        /* move midpoint a bit to avoid problem. */
@@ -1069,7 +1081,6 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
                        y3 += dy;
                        x3 += dx;
                        c_ptr = &cave[y3][x3];
-                       midval = cave[y3][x3].feat;
                }
 
                if (is_floor_grid(c_ptr))