-
- /*!
- * @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"
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)
* 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;
+}