-
- /*!
- * @file grid.c
- * @brief グリッドの実装 / low level dungeon routines -BEN-
- * @date 2013/12/30
- * @author
- * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
- *\n
- * This software may be copied and distributed for educational, research,\n
- * and not for profit purposes provided that this copyright and statement\n
- * are included in all such copies. Other copyrights may also apply.\n
- * \n
- * Support for Adam Bolt's tileset, lighting and transparency effects\n
- * by Robert Ruehlmann (rr9@angband.org)\n
- * \n
- * 2013 Deskull Doxygen向けのコメント整理\n
- */
-
+/*!
+ * @file grid.c
+ * @brief グリッドの実装 / low level dungeon routines -BEN-
+ * @date 2013/12/30
+ * @author
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
+ *\n
+ * This software may be copied and distributed for educational, research,\n
+ * and not for profit purposes provided that this copyright and statement\n
+ * are included in all such copies. Other copyrights may also apply.\n
+ * \n
+ * Support for Adam Bolt's tileset, lighting and transparency effects\n
+ * by Robert Ruehlmann (rr9@angband.org)\n
+ * \n
+ * 2013 Deskull Doxygen向けのコメント整理\n
+ */
#include "angband.h"
#include "util.h"
}
/*!
- * @brief 特殊な部屋向けに各種アイテムを配置する(メインルーチン) / Place some traps with a given displacement of given location
- * @param y トラップを配置したいマスの中心Y座標
- * @param x トラップを配置したいマスの中心X座標
- * @param yd Y方向の配置分散マス数
- * @param xd X方向の配置分散マス数
- * @param num 配置したいトラップの数
- * @return なし
- * @details
- * Only really called by some of the "vault" routines.
- */
-void vault_traps(POSITION y, POSITION x, POSITION yd, POSITION xd, int num)
-{
- int i;
-
- for (i = 0; i < num; i++)
- {
- vault_trap_aux(p_ptr->current_floor_ptr, y, x, yd, xd);
- }
-}
-
-/*!
* @brief マスにフロア端用の永久壁を配置する / Set boundary mimic and add "solid" perma-wall
* @param g_ptr 永久壁を配置したいマス構造体の参照ポインタ
* @return なし
int i;
POSITION yy, xx;
- if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
+ if (!in_bounds(creature_ptr->current_floor_ptr, y, x)) return;
#ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */
/*
+ * todo ここにplayer_type を追加した時のコンパイルエラーに対処できなかったので保留
* Memorize interesting viewable object/features in the given grid
*
* This function should only be called on "legal" grids.
TERM_COLOR ta;
SYMBOL_CODE tc;
- map_info(y, x, &a, &c, &ta, &tc);
+ map_info(p_ptr, y, x, &a, &c, &ta, &tc);
/* Hack -- fake monochrome */
if (!use_graphics)
*/
/*
- * Mega-Hack -- Delayed visual update
- * Only used if update_view(), update_lite() or update_mon_lite() was called
- */
-void delayed_visual_update(void)
-{
- int i;
- POSITION y, x;
- grid_type *g_ptr;
-
- /* Update needed grids */
- for (i = 0; i < p_ptr->current_floor_ptr->redraw_n; i++)
- {
- y = p_ptr->current_floor_ptr->redraw_y[i];
- x = p_ptr->current_floor_ptr->redraw_x[i];
- g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
-
- /* Update only needed grids (prevent multiple updating) */
- if (!(g_ptr->info & CAVE_REDRAW)) continue;
-
- /* If required, note */
- if (g_ptr->info & CAVE_NOTE) note_spot(y, x);
-
- lite_spot(y, x);
-
- /* Hack -- Visual update of monster on this grid */
- if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
-
- /* No longer in the array */
- g_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
- }
-
- /* None left */
- p_ptr->current_floor_ptr->redraw_n = 0;
-}
-
-
-/*
* Hack - speed up the update_flow algorithm by only doing
* it everytime the player moves out of LOS of the last
* "way-point".
static POSITION flow_x = 0;
static POSITION flow_y = 0;
-
-
/*
* Hack -- fill in the "cost" field of every grid that the player
* can "reach" with the number of steps needed to reach that grid.
* Takes a location and action and changes the feature at that
* location through applying the given action.
*/
-void cave_alter_feat(POSITION y, POSITION x, int action)
+void cave_alter_feat(player_type *player_ptr, POSITION y, POSITION x, int action)
{
/* Set old feature */
- FEAT_IDX oldfeat = p_ptr->current_floor_ptr->grid_array[y][x].feat;
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ FEAT_IDX oldfeat = floor_ptr->grid_array[y][x].feat;
/* Get the new feat */
FEAT_IDX newfeat = feat_state(oldfeat, action);
if (newfeat == oldfeat) return;
/* Set the new feature */
- cave_set_feat(p_ptr->current_floor_ptr, y, x, newfeat);
+ cave_set_feat(player_ptr, y, x, newfeat);
if (!(feature_action_flags[action] & FAF_NO_DROP))
{
if (have_flag(old_f_ptr->flags, FF_HAS_GOLD) && !have_flag(f_ptr->flags, FF_HAS_GOLD))
{
/* Place some gold */
- place_gold(p_ptr->current_floor_ptr, y, x);
+ place_gold(floor_ptr, y, x);
found = TRUE;
}
/* Handle item */
- if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - p_ptr->current_floor_ptr->dun_level / 2)))
+ if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - floor_ptr->dun_level / 2)))
{
/* Place object */
- place_object(p_ptr->current_floor_ptr, y, x, 0L);
+ place_object(player_ptr, y, x, 0L);
found = TRUE;
}
- if (found && current_world_ptr->character_dungeon && player_can_see_bold(p_ptr, y, x))
+ if (found && current_world_ptr->character_dungeon && player_can_see_bold(player_ptr, y, x))
{
msg_print(_("何かを発見した!", "You have found something!"));
}
if (have_flag(old_f_ptr->flags, FF_GLASS) && current_world_ptr->character_dungeon)
{
- project(p_ptr, PROJECT_WHO_GLASS_SHARDS, 1, y, x, MIN(p_ptr->current_floor_ptr->dun_level, 100) / 4, GF_SHARDS,
+ project(player_ptr, PROJECT_WHO_GLASS_SHARDS, 1, y, x, MIN(floor_ptr->dun_level, 100) / 4, GF_SHARDS,
(PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
}
}
return TRUE;
}
+
+void place_solid_perm_grid(grid_type *g_ptr)
+{
+ g_ptr->feat = feat_permanent;
+ g_ptr->info &= ~(CAVE_MASK);
+ g_ptr->info |= CAVE_SOLID;
+ if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
+}
+
+
+void place_grid(grid_type *g_ptr, place_grid_type pg_type)
+{
+ switch (pg_type)
+ {
+ case floor:
+ {
+ g_ptr->feat = feat_ground_type[randint0(100)];
+ g_ptr->info |= CAVE_FLOOR;
+ break;
+ }
+ case extra:
+ {
+ g_ptr->feat = feat_wall_type[randint0(100)];
+ g_ptr->info |= CAVE_EXTRA;
+ break;
+ }
+ case inner:
+ {
+ g_ptr->feat = feat_wall_inner;
+ g_ptr->info |= CAVE_INNER;
+ break;
+ }
+ case inner_perm:
+ {
+ g_ptr->feat = feat_permanent;
+ g_ptr->info |= CAVE_INNER;
+ break;
+ }
+ case outer:
+ {
+ g_ptr->feat = feat_wall_outer;
+ g_ptr->info |= CAVE_OUTER;
+ break;
+ }
+ case outer_noperm:
+ {
+ feature_type *f_ptr = &f_info[feat_wall_outer];
+ if (permanent_wall(f_ptr))
+ {
+ g_ptr->feat = (s16b)feat_state(feat_wall_outer, FF_UNPERM);
+ }
+ else
+ {
+ g_ptr->feat = feat_wall_outer;
+ }
+
+ g_ptr->info |= (CAVE_OUTER | CAVE_VAULT);
+ break;
+ }
+ case solid_perm:
+ {
+ g_ptr->feat = feat_permanent;
+ g_ptr->info |= CAVE_SOLID;
+ break;
+ }
+ default:
+ return;
+ }
+
+ g_ptr->info &= ~(CAVE_MASK);
+ if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
+}
+
+
+/*!
+ * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param g_ptr グリッドへの参照ポインタ
+ * @return 照明が消されている地形ならばTRUE
+ */
+bool darkened_grid(player_type *player_ptr, grid_type *g_ptr)
+{
+ return ((g_ptr->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) &&
+ !player_ptr->see_nocto;
+}