/*!
* @brief 地形やその上のアイテムの隠された要素を全て明かす /
* Search for hidden things
+ * @param creature_ptr プレーヤーへの参照ポインタ
* @param y 対象となるマスのY座標
* @param x 対象となるマスのX座標
* @return なし
*/
-static void discover_hidden_things(POSITION y, POSITION x)
+static void discover_hidden_things(player_type *creature_ptr, POSITION y, POSITION x)
{
OBJECT_IDX this_o_idx, next_o_idx = 0;
grid_type *g_ptr;
- g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ g_ptr = &floor_ptr->grid_array[y][x];
/* Invisible trap */
if (g_ptr->mimic && is_trap(g_ptr->feat))
{
- disclose_grid(y, x);
+ disclose_grid(creature_ptr, y, x);
msg_print(_("トラップを発見した。", "You have found a trap."));
- disturb(p_ptr, FALSE, TRUE);
+ disturb(creature_ptr, FALSE, TRUE);
}
/* Secret door */
if (is_hidden_door(g_ptr))
{
msg_print(_("隠しドアを発見した。", "You have found a secret door."));
- disclose_grid(y, x);
- disturb(p_ptr, FALSE, FALSE);
+ disclose_grid(creature_ptr, y, x);
+ disturb(creature_ptr, FALSE, FALSE);
}
/* Scan all objects in the grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+ o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
if (o_ptr->tval != TV_CHEST) continue;
if (!chest_traps[o_ptr->pval]) continue;
{
msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
object_known(o_ptr);
- disturb(p_ptr, FALSE, FALSE);
+ disturb(creature_ptr, FALSE, FALSE);
}
}
}
+
/*!
* @brief プレイヤーの探索処理判定
* @return なし
/* Sometimes, notice things */
if (randint0(100) < chance)
{
- discover_hidden_things(creature_ptr->y + ddy_ddd[i], creature_ptr->x + ddx_ddd[i]);
+ discover_hidden_things(creature_ptr, creature_ptr->y + ddy_ddd[i], creature_ptr->x + ddx_ddd[i]);
}
}
}
* Add the given dungeon object to the character's inventory.\n
* Delete the object afterwards.\n
*/
-void py_pickup_aux(OBJECT_IDX o_idx)
+void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
{
INVENTORY_IDX slot;
object_type *o_ptr;
- o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
+ o_ptr = &owner_ptr->current_floor_ptr->o_list[o_idx];
#ifdef JP
object_desc(old_name, o_ptr, OD_NAME_ONLY);
hirottakazu = o_ptr->number;
#endif
/* Carry the object */
- slot = inven_carry(o_ptr);
+ slot = inven_carry(owner_ptr, o_ptr);
/* Get the object again */
- o_ptr = &p_ptr->inventory_list[slot];
+ o_ptr = &owner_ptr->inventory_list[slot];
- delete_object_idx(o_idx);
+ delete_object_idx(owner_ptr->current_floor_ptr, o_idx);
- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+ if (owner_ptr->pseikaku == SEIKAKU_MUNCHKIN)
{
- bool old_known = identify_item(p_ptr, o_ptr);
+ bool old_known = identify_item(owner_ptr, o_ptr);
/* Auto-inscription/destroy */
- autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
+ autopick_alter_item(owner_ptr, slot, (bool)(destroy_identify && !old_known));
/* If it is destroyed, don't pick it up */
if (o_ptr->marked & OM_AUTODESTROY) return;
object_desc(o_name, o_ptr, 0);
#ifdef JP
- if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
+ if ((o_ptr->name1 == ART_CRIMSON) && (owner_ptr->pseikaku == SEIKAKU_COMBAT))
{
- msg_format("こうして、%sは『クリムゾン』を手に入れた。", p_ptr->name);
+ msg_format("こうして、%sは『クリムゾン』を手に入れた。", owner_ptr->name);
msg_print("しかし今、『混沌のサーペント』の放ったモンスターが、");
- msg_format("%sに襲いかかる...", p_ptr->name);
+ msg_format("%sに襲いかかる...", owner_ptr->name);
}
else
{
record_turn = current_world_ptr->game_turn;
- check_find_art_quest_completion(o_ptr);
+ check_find_art_quest_completion(owner_ptr, o_ptr);
}
* @details
* Player "wants" to pick up an object or gold.
* Note that we ONLY handle things that can be picked up.
- * See "move_player(p_ptr, )" for handling of other things.
+ * See "move_player(creature_ptr, )" for handling of other things.
*/
void carry(player_type *creature_ptr, bool pickup)
{
creature_ptr->update |= (PU_MONSTERS);
creature_ptr->redraw |= (PR_MAP);
creature_ptr->window |= (PW_OVERHEAD);
- handle_stuff();
+ handle_stuff(creature_ptr);
/* Automatically pickup/destroy/inscribe items */
- autopick_pickup_items(g_ptr);
+ autopick_pickup_items(creature_ptr, g_ptr);
if (easy_floor)
{
int value = (long)o_ptr->pval;
/* Delete the gold */
- delete_object_idx(this_o_idx);
+ delete_object_idx(creature_ptr->current_floor_ptr, this_o_idx);
msg_format(_(" $%ld の価値がある%sを見つけた。", "You collect %ld gold pieces worth of %s."),
(long)value, o_name);
if (okay)
{
/* Pick up the object */
- py_pickup_aux(this_o_idx);
+ py_pickup_aux(creature_ptr, this_o_idx);
}
}
}
*/
bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
{
- feature_type *cur_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[c_y][c_x].feat];
- feature_type *new_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[n_y][n_x].feat];
+ feature_type *cur_f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[c_y][c_x].feat];
+ feature_type *new_f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[n_y][n_x].feat];
bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
int pattern_type_cur, pattern_type_new;
}
}
+
/*!
* @brief 移動に伴うプレイヤーのステータス変化処理
* @param ny 移動先Y座標
{
POSITION oy = creature_ptr->y;
POSITION ox = creature_ptr->x;
- grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx];
- grid_type *oc_ptr = &p_ptr->current_floor_ptr->grid_array[oy][ox];
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
+ grid_type *oc_ptr = &floor_ptr->grid_array[oy][ox];
feature_type *f_ptr = &f_info[g_ptr->feat];
feature_type *of_ptr = &f_info[oc_ptr->feat];
if (om_idx > 0) /* Monster on old spot (or creature_ptr->riding) */
{
- monster_type *om_ptr = &p_ptr->current_floor_ptr->m_list[om_idx];
+ monster_type *om_ptr = &floor_ptr->m_list[om_idx];
om_ptr->fy = ny;
om_ptr->fx = nx;
update_monster(creature_ptr, om_idx, TRUE);
if (nm_idx > 0) /* Monster on new spot */
{
- monster_type *nm_ptr = &p_ptr->current_floor_ptr->m_list[nm_idx];
+ monster_type *nm_ptr = &floor_ptr->m_list[nm_idx];
nm_ptr->fy = oy;
nm_ptr->fx = ox;
update_monster(creature_ptr, nm_idx, TRUE);
if (mpe_mode & MPE_FORGET_FLOW)
{
- forget_flow(creature_ptr->current_floor_ptr);
+ forget_flow(floor_ptr);
creature_ptr->update |= (PU_UN_VIEW);
creature_ptr->redraw |= (PR_MAP);
if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
/* For get everything when requested hehe I'm *NASTY* */
- if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr);
- if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
+ if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr);
+ if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff(creature_ptr);
if (creature_ptr->pclass == CLASS_NINJA)
{
/* Handle "store doors" */
if (have_flag(f_ptr->flags, FF_STORE))
{
- disturb(p_ptr, FALSE, TRUE);
+ disturb(creature_ptr, FALSE, TRUE);
free_turn(creature_ptr);
/* Hack -- Enter store */
/* Handle "building doors" -KMW- */
else if (have_flag(f_ptr->flags, FF_BLDG))
{
- disturb(p_ptr, FALSE, TRUE);
+ disturb(creature_ptr, FALSE, TRUE);
free_turn(creature_ptr);
/* Hack -- Enter building */
/* Handle quest areas -KMW- */
else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
{
- disturb(p_ptr, FALSE, TRUE);
+ disturb(creature_ptr, FALSE, TRUE);
free_turn(creature_ptr);
/* Hack -- Enter quest level */
else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
{
- if (quest[creature_ptr->current_floor_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
+ if (quest[floor_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
{
- complete_quest(creature_ptr->current_floor_ptr->inside_quest);
+ complete_quest(creature_ptr, floor_ptr->inside_quest);
}
leave_quest_check(creature_ptr);
- creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
- p_ptr->current_floor_ptr->dun_level = 0;
+ floor_ptr->inside_quest = g_ptr->special;
+ floor_ptr->dun_level = 0;
creature_ptr->oldpx = 0;
creature_ptr->oldpy = 0;
/* Set off a trap */
else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
{
- disturb(p_ptr, FALSE, TRUE);
+ disturb(creature_ptr, FALSE, TRUE);
/* Hidden trap */
if (g_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
msg_print(_("トラップだ!", "You found a trap!"));
/* Pick a trap */
- disclose_grid(creature_ptr->y, creature_ptr->x);
+ disclose_grid(creature_ptr, creature_ptr->y, creature_ptr->x);
}
/* Hit the trap */
msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
}
- if (disturb_trap_detect) disturb(p_ptr, FALSE, TRUE);
+ if (disturb_trap_detect) disturb(creature_ptr, FALSE, TRUE);
}
}
return player_bold(creature_ptr, ny, nx) && !creature_ptr->is_dead && !creature_ptr->leaving;
}
+
/*!
* @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す
* @param feat 地形ID
POSITION x = creature_ptr->x + ddx[dir];
/* Examine the destination */
- grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ grid_type *g_ptr = &floor_ptr->grid_array[y][x];
feature_type *f_ptr = &f_info[g_ptr->feat];
monster_type *m_ptr;
- monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
+ monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
monster_race *riding_r_ptr = &r_info[creature_ptr->riding ? riding_m_ptr->r_idx : 0];
GAME_TEXT m_name[MAX_NLEN];
bool do_past = FALSE;
/* Exit the area */
- if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->wild_mode &&
+ if (!floor_ptr->dun_level && !creature_ptr->wild_mode &&
((x == 0) || (x == MAX_WID - 1) ||
(y == 0) || (y == MAX_HGT - 1)))
{
{
creature_ptr->wilderness_y--;
creature_ptr->wilderness_x--;
- creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
- creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+ creature_ptr->oldpy = floor_ptr->height - 2;
+ creature_ptr->oldpx = floor_ptr->width - 2;
creature_ptr->ambush_flag = FALSE;
}
{
creature_ptr->wilderness_y--;
creature_ptr->wilderness_x++;
- creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
+ creature_ptr->oldpy = floor_ptr->height - 2;
creature_ptr->oldpx = 1;
creature_ptr->ambush_flag = FALSE;
}
creature_ptr->wilderness_y++;
creature_ptr->wilderness_x--;
creature_ptr->oldpy = 1;
- creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+ creature_ptr->oldpx = floor_ptr->width - 2;
creature_ptr->ambush_flag = FALSE;
}
else if (y == 0)
{
creature_ptr->wilderness_y--;
- creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
+ creature_ptr->oldpy = floor_ptr->height - 2;
creature_ptr->oldpx = x;
creature_ptr->ambush_flag = FALSE;
}
else if (x == 0)
{
creature_ptr->wilderness_x--;
- creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+ creature_ptr->oldpx = floor_ptr->width - 2;
creature_ptr->oldpy = y;
creature_ptr->ambush_flag = FALSE;
}
p_can_enter = FALSE;
}
- m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+ m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
if (creature_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
if (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
py_attack(creature_ptr, y, x, 0);
oktomove = FALSE;
}
- else if (monster_can_cross_terrain(creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
+ else if (monster_can_cross_terrain(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
{
do_past = TRUE;
}
}
else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
{
- msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name);
+ msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name);
free_turn(creature_ptr);
oktomove = FALSE;
disturb(creature_ptr, FALSE, TRUE);
if (p_can_kill_walls)
{
- cave_alter_feat(y, x, FF_HURT_DISI);
+ cave_alter_feat(creature_ptr, y, x, FF_HURT_DISI);
/* Update some things -- similar to GF_KILL_WALL */
creature_ptr->update |= (PU_FLOW);
x += ddx[dir];
/* Illegal grids are not known walls */
- if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return (FALSE);
+ if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return FALSE;
/* Access grid */
g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
x += ddx[dir];
/* Illegal grids are unknown */
- if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return (TRUE);
+ if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return TRUE;
/* Memorized grids are always known */
- if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE);
+ if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return FALSE;
/* Viewable door/wall grids are known */
- if (player_can_see_bold(p_ptr, y, x)) return (FALSE);
+ if (player_can_see_bold(p_ptr, y, x)) return FALSE;
/* Default */
- return (TRUE);
+ return TRUE;
}
monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
/* Visible monster */
- if (m_ptr->ml) return (TRUE);
+ if (m_ptr->ml) return TRUE;
}
/* Visible objects abort running */
next_o_idx = o_ptr->next_o_idx;
/* Visible object */
- if (o_ptr->marked & OM_FOUND) return (TRUE);
+ if (o_ptr->marked & OM_FOUND) return TRUE;
}
/* Assume unknown */
}
/* Interesting feature */
- if (notice) return (TRUE);
+ if (notice) return TRUE;
/* The grid is "visible" */
inv = FALSE;
/* Three new directions. Stop running. */
else if (option2)
{
- return (TRUE);
+ return TRUE;
}
/* Two non-adjacent new directions. Stop running. */
else if (option != cycle[chome[prev_dir] + i - 1])
{
- return (TRUE);
+ return TRUE;
}
/* Two new (adjacent) directions (case 1) */
/* Looking to break right */
if (find_breakright)
{
- return (TRUE);
+ return TRUE;
}
}
/* Looking to break left */
if (find_breakleft)
{
- return (TRUE);
+ return TRUE;
}
}
}
/* Looking to break left */
if (find_breakleft)
{
- return (TRUE);
+ return TRUE;
}
}
/* Looking to break right */
if (find_breakright)
{
- return (TRUE);
+ return TRUE;
}
}
}
/* No options */
if (!option)
{
- return (TRUE);
+ return TRUE;
}
/* One option */
/* STOP: we are next to an intersection or a room */
else
{
- return (TRUE);
+ return TRUE;
}
}
/* About to hit a known wall, stop */
if (see_wall(find_current, p_ptr->y, p_ptr->x))
{
- return (TRUE);
+ return TRUE;
}
/* Failure */
- return (FALSE);
+ return FALSE;
}
-
/*!
* @brief 継続的なダッシュ処理 /
* Take one step along the current "run" path
static POSITION temp2_x[MAX_SHORT];
static POSITION temp2_y[MAX_SHORT];
+
/*!
* @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
* @return なし
travel.y = travel.x = 0;
}
+
/*!
* @brief トラベル処理中に地形に応じた移動コスト基準を返す
* @param y 該当地点のY座標
if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
}
- return (cost);
+ return cost;
}
+
/*!
* @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
* @param y 目標地点のY座標
/* Hack -- notice overflow by forgetting new entry */
if (flow_head == flow_tail) flow_head = old_head;
-
- return;
}
+
/*!
* @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
* @param ty 目標地点のY座標
flow_head = flow_tail = 0;
}
+
/*!
* @brief トラベル処理のメインルーチン
* @return なし
}
#endif
+
/*
* Something has happened to disturb the player.
* The first arg indicates a major disturbance, which affects search.