#include "monster.h"
#include "quest.h"
#include "feature.h"
+#include "monster-status.h"
static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
static int match_autopick;
{
object_type *o_ptr;
o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
-
- /* Acquire next object */
next_o_idx = o_ptr->next_o_idx;
/* Forbid artifact grids */
{
object_type *o_ptr;
o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
-
- /* Acquire next object */
next_o_idx = o_ptr->next_o_idx;
/* Memorized objects */
/* Hack -- fake monochrome */
if (!use_graphics)
{
- if (world_monster) a = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
-
- /* Acquire next object */
next_o_idx = o_ptr->next_o_idx;
/* Memorize objects */
/* Hack -- fake monochrome */
if (!use_graphics)
{
- if (world_monster) a = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
/* Hack -- fake monochrome */
if (!use_graphics)
{
- if (world_monster) a = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
/* Hack -- fake monochrome */
if (!use_graphics)
{
- if (world_monster) a = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
if (!use_graphics)
{
- if (world_monster) a = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
/* Hack -- fake monochrome */
if (!use_graphics)
{
- if (world_monster) ta = TERM_DARK;
+ if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
else if (p_ptr->wraith_form) ta = TERM_L_DARK;
}
*/
void forget_lite(void)
{
- int i, x, y;
+ int i;
+ POSITION x, y;
/* None to forget */
if (!current_floor_ptr->lite_n) return;
if (!((C)->info & CAVE_REDRAW)) \
{ \
(C)->info |= CAVE_REDRAW; \
- redraw_y[redraw_n] = (Y); \
- redraw_x[redraw_n++] = (X); \
+ current_floor_ptr->redraw_y[current_floor_ptr->redraw_n] = (Y); \
+ current_floor_ptr->redraw_x[current_floor_ptr->redraw_n++] = (X); \
} \
}
{
int i;
POSITION x, y, min_x, max_x, min_y, max_y;
- int p = p_ptr->cur_lite;
+ POSITION p = p_ptr->cur_lite;
grid_type *g_ptr;
/*** Special case ***/
current_floor_ptr->grid_array[y][x].info |= (CAVE_TEMP);
/* Add it to the "seen" set */
- temp_y[temp_n] = y;
- temp_x[temp_n] = x;
- temp_n++;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.n++;
}
/* None left */
}
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- y = temp_y[i];
- x = temp_x[i];
+ y = tmp_pos.y[i];
+ x = tmp_pos.x[i];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
}
}
- /* We trust temp_n does not exceed TEMP_MAX */
+ /* We trust tmp_pos.n does not exceed TEMP_MAX */
/* New grid */
if (!(g_ptr->info & CAVE_MNDK))
{
/* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.n++;
}
/* Darkened grid */
}
}
- /* We trust temp_n does not exceed TEMP_MAX */
+ /* We trust tmp_pos.n does not exceed TEMP_MAX */
/* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.n++;
/* Darken it */
g_ptr->info |= CAVE_MNDK;
}
/* Empty temp list of new squares to lite up */
- temp_n = 0;
+ tmp_pos.n = 0;
/* If a monster stops time, don't process */
- if (!world_monster)
+ if (!current_world_ptr->timewalk_m_idx)
{
monster_type *m_ptr;
monster_race *r_ptr;
{
m_ptr = ¤t_floor_ptr->m_list[i];
r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Is it too far away? */
if (m_ptr->cdis > dis_lim) continue;
}
/* Save end of list of new squares */
- end_temp = temp_n;
+ end_temp = tmp_pos.n;
/*
* Look at old set flags to see if there are any changes.
}
/* Add to end of temp array */
- temp_x[temp_n] = fx;
- temp_y[temp_n] = fy;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = fx;
+ tmp_pos.y[tmp_pos.n] = fy;
+ tmp_pos.n++;
}
/* Clear the lite array */
/* Copy the temp array into the lit array lighting the new squares. */
for (i = 0; i < end_temp; i++)
{
- fx = temp_x[i];
- fy = temp_y[i];
+ fx = tmp_pos.x[i];
+ fy = tmp_pos.y[i];
/* We trust this grid is in bounds */
}
/* Clear the temp flag for the old lit or darken grids */
- for (i = end_temp; i < temp_n; i++)
+ for (i = end_temp; i < tmp_pos.n; i++)
{
/* We trust this grid is in bounds */
- current_floor_ptr->grid_array[temp_y[i]][temp_x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
+ current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
}
- /* Finished with temp_n */
- temp_n = 0;
+ /* Finished with tmp_pos.n */
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
grid_type *g_ptr;
/* None to forget */
- if (!view_n) return;
+ if (!current_floor_ptr->view_n) return;
/* Clear them all */
- for (i = 0; i < view_n; i++)
+ for (i = 0; i < current_floor_ptr->view_n; i++)
{
- POSITION y = view_y[i];
- POSITION x = view_x[i];
+ POSITION y = current_floor_ptr->view_y[i];
+ POSITION x = current_floor_ptr->view_x[i];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Forget that the grid is viewable */
}
/* None left */
- view_n = 0;
+ current_floor_ptr->view_n = 0;
}
{\
if (!((C)->info & (CAVE_VIEW))){\
(C)->info |= (CAVE_VIEW); \
- view_y[view_n] = (Y); \
- view_x[view_n] = (X); \
- view_n++;}\
+ current_floor_ptr->view_y[current_floor_ptr->view_n] = (Y); \
+ current_floor_ptr->view_x[current_floor_ptr->view_n] = (X); \
+ current_floor_ptr->view_n++;}\
}
/*** Step 0 -- Begin ***/
/* Save the old "view" grids for later */
- for (n = 0; n < view_n; n++)
+ for (n = 0; n < current_floor_ptr->view_n; n++)
{
- y = view_y[n];
- x = view_x[n];
+ y = current_floor_ptr->view_y[n];
+ x = current_floor_ptr->view_x[n];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Mark the grid as not in "view" */
g_ptr->info |= (CAVE_TEMP);
/* Add it to the "seen" set */
- temp_y[temp_n] = y;
- temp_x[temp_n] = x;
- temp_n++;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.n++;
}
/* Start over with the "view" array */
- view_n = 0;
+ current_floor_ptr->view_n = 0;
/*** Step 1 -- adjacent grids ***/
/*** Step 5 -- Complete the algorithm ***/
/* Update all the new grids */
- for (n = 0; n < view_n; n++)
+ for (n = 0; n < current_floor_ptr->view_n; n++)
{
- y = view_y[n];
- x = view_x[n];
+ y = current_floor_ptr->view_y[n];
+ x = current_floor_ptr->view_x[n];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Clear the "CAVE_XTRA" flag */
}
/* Wipe the old grids, update as needed */
- for (n = 0; n < temp_n; n++)
+ for (n = 0; n < tmp_pos.n; n++)
{
- y = temp_y[n];
- x = temp_x[n];
+ y = tmp_pos.y[n];
+ x = tmp_pos.x[n];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* No longer in the array */
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
grid_type *g_ptr;
/* Update needed grids */
- for (i = 0; i < redraw_n; i++)
+ for (i = 0; i < current_floor_ptr->redraw_n; i++)
{
- y = redraw_y[i];
- x = redraw_x[i];
+ y = current_floor_ptr->redraw_y[i];
+ x = current_floor_ptr->redraw_x[i];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Update only needed grids (prevent multiple updating) */
}
/* None left */
- redraw_n = 0;
+ current_floor_ptr->redraw_n = 0;
}
int flow_tail = 0;
/* Paranoia -- make sure the array is empty */
- if (temp_n) return;
+ if (tmp_pos.n) return;
/* The last way-point is on the map */
if (running && in_bounds(flow_y, flow_x))
flow_x = p_ptr->x;
/* Add the player's grid to the queue */
- temp_y[0] = p_ptr->y;
- temp_x[0] = p_ptr->x;
+ tmp_pos.y[0] = p_ptr->y;
+ tmp_pos.x[0] = p_ptr->x;
/* Now process the queue */
while (flow_head != flow_tail)
int ty, tx;
/* Extract the next entry */
- ty = temp_y[flow_tail];
- tx = temp_x[flow_tail];
+ ty = tmp_pos.y[flow_tail];
+ tx = tmp_pos.x[flow_tail];
/* Forget that entry */
if (++flow_tail == TEMP_MAX) flow_tail = 0;
if (n == MONSTER_FLOW_DEPTH) continue;
/* Enqueue that entry */
- temp_y[flow_head] = y;
- temp_x[flow_head] = x;
+ tmp_pos.y[flow_head] = y;
+ tmp_pos.x[flow_head] = x;
/* Advance the queue */
if (++flow_head == TEMP_MAX) flow_head = 0;
/*
- * Something has happened to disturb the player.
- *
- * The first arg indicates a major disturbance, which affects search.
- *
- * The second arg is currently unused, but could induce output flush.
- *
- * All disturbance cancels repeated commands, resting, and running.
- */
-void disturb(bool stop_search, bool stop_travel)
-{
-#ifndef TRAVEL
- /* Unused */
- stop_travel = stop_travel;
-#endif
-
- /* Cancel auto-commands */
- /* command_new = 0; */
-
- /* Cancel repeated commands */
- if (command_rep)
- {
- /* Cancel */
- command_rep = 0;
-
- /* Redraw the state (later) */
- p_ptr->redraw |= (PR_STATE);
- }
-
- /* Cancel Resting */
- if ((p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH) || (stop_search && (p_ptr->action == ACTION_SEARCH)))
- {
- /* Cancel */
- set_action(ACTION_NONE);
- }
-
- /* Cancel running */
- if (running)
- {
- /* Cancel */
- running = 0;
-
- /* Check for new panel if appropriate */
- if (center_player && !center_running) verify_panel();
-
- /* Calculate torch radius */
- p_ptr->update |= (PU_TORCH);
-
- /* Update monster flow */
- p_ptr->update |= (PU_FLOW);
- }
-
-#ifdef TRAVEL
- if (stop_travel)
- {
- /* Cancel */
- travel.run = 0;
-
- /* Check for new panel if appropriate */
- if (center_player && !center_running) verify_panel();
-
- /* Calculate torch radius */
- p_ptr->update |= (PU_TORCH);
- }
-#endif
-
- /* Flush the input if requested */
- if (flush_disturb) flush();
-}
-
-
-/*
* Glow deep lava and building entrances in the floor
*/
void glow_deep_lava_and_bldg(void)