OSDN Git Service
(root)
/
hengband
/
hengband.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Refactor] #37353 PROJECT_* 定義を新規ファイル projection.h へ移動。 / Move PROJECT_* definition...
[hengband/hengband.git]
/
src
/
cave.c
diff --git
a/src/cave.c
b/src/cave.c
index
570f3b0
..
5a0118f
100644
(file)
--- a/
src/cave.c
+++ b/
src/cave.c
@@
-17,6
+17,8
@@
#include "angband.h"
#include "angband.h"
+#include "world.h"
+#include "projection.h"
static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
static int match_autopick;
static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
static int match_autopick;
@@
-67,7
+69,7
@@
POSITION distance (POSITION y1, POSITION x1, POSITION y2, POSITION x2)
* @param feat 地形情報のID
* @return 罠持ちの地形ならばTRUEを返す。
*/
* @param feat 地形情報のID
* @return 罠持ちの地形ならばTRUEを返す。
*/
-bool is_trap(IDX feat)
+bool is_trap(
FEAT_
IDX feat)
{
return have_flag(f_info[feat].flags, FF_TRAP);
}
{
return have_flag(f_info[feat].flags, FF_TRAP);
}
@@
-90,7
+92,7
@@
bool is_known_trap(cave_type *c_ptr)
* @param feat 地形情報のID
* @return 閉じたドアのある地形ならばTRUEを返す。
*/
* @param feat 地形情報のID
* @return 閉じたドアのある地形ならばTRUEを返す。
*/
-bool is_closed_door(IDX feat)
+bool is_closed_door(
FEAT_
IDX feat)
{
feature_type *f_ptr = &f_info[feat];
{
feature_type *f_ptr = &f_info[feat];
@@
-160,22
+162,22
@@
bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
POSITION dx, dy;
/* Absolute */
POSITION dx, dy;
/* Absolute */
-
int
ax, ay;
+
POSITION
ax, ay;
/* Signs */
/* Signs */
-
int
sx, sy;
+
POSITION
sx, sy;
/* Fractions */
/* Fractions */
-
int
qx, qy;
+
POSITION
qx, qy;
/* Scanners */
/* Scanners */
-
int
tx, ty;
+
POSITION
tx, ty;
/* Scale factors */
/* Scale factors */
-
int
f1, f2;
+
POSITION
f1, f2;
/* Slope, or 1/Slope, of LOS */
/* Slope, or 1/Slope, of LOS */
-
int
m;
+
POSITION
m;
/* Extract the offset */
/* Extract the offset */
@@
-386,11
+388,11
@@
bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
* @param x x座標
* @return 指定された座標に照明がかかっているならTRUEを返す。。
*/
* @param x x座標
* @return 指定された座標に照明がかかっているならTRUEを返す。。
*/
-static bool check_local_illumination(
int y, int
x)
+static bool check_local_illumination(
POSITION y, POSITION
x)
{
/* Hack -- move towards player */
{
/* Hack -- move towards player */
-
int
yy = (y < p_ptr->y) ? (y + 1) : (y > p_ptr->y) ? (y - 1) : y;
-
int
xx = (x < p_ptr->x) ? (x + 1) : (x > p_ptr->x) ? (x - 1) : x;
+
POSITION
yy = (y < p_ptr->y) ? (y + 1) : (y > p_ptr->y) ? (y - 1) : y;
+
POSITION
xx = (x < p_ptr->x) ? (x + 1) : (x > p_ptr->x) ? (x - 1) : x;
/* Check for "local" illumination */
/* Check for "local" illumination */
@@
-423,7
+425,7
@@
static bool check_local_illumination(int y, int x)
if (player_has_los_bold((Y), (X))) \
{ \
/* Update the monster */ \
if (player_has_los_bold((Y), (X))) \
{ \
/* Update the monster */ \
- if (cave[(Y)][(X)].m_idx) update_mon(cave[(Y)][(X)].m_idx, FALSE); \
+ if (cave[(Y)][(X)].m_idx) update_mon
ster
(cave[(Y)][(X)].m_idx, FALSE); \
\
/* Notice and redraw */ \
note_spot((Y), (X)); \
\
/* Notice and redraw */ \
note_spot((Y), (X)); \
@@
-626,8
+628,6
@@
bool cave_valid_bold(POSITION y, POSITION x)
for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
-
- /* Acquire object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
@@
-661,7
+661,7
@@
static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
* @param cp 本来のシンボル
* @return なし
*/
* @param cp 本来のシンボル
* @return なし
*/
-static void image_monster(
byte
*ap, char *cp)
+static void image_monster(
TERM_COLOR
*ap, char *cp)
{
/* Random symbol from set above */
if (use_graphics)
{
/* Random symbol from set above */
if (use_graphics)
@@
-689,7
+689,7
@@
static void image_monster(byte *ap, char *cp)
* @param cp 本来のシンボル
* @return なし
*/
* @param cp 本来のシンボル
* @return なし
*/
-static void image_object(
byte
*ap, char *cp)
+static void image_object(
TERM_COLOR
*ap, char *cp)
{
if (use_graphics)
{
{
if (use_graphics)
{
@@
-716,7
+716,7
@@
static void image_object(byte *ap, char *cp)
* @param cp 本来のシンボル
* @return なし
*/
* @param cp 本来のシンボル
* @return なし
*/
-static void image_random(
byte
*ap, char *cp)
+static void image_random(
TERM_COLOR
*ap, char *cp)
{
/* Normally, assume monsters */
if (randint0(100) < 75)
{
/* Normally, assume monsters */
if (randint0(100) < 75)
@@
-795,10
+795,10
@@
static byte lighting_colours[16][2] =
* @brief 調査中
* @todo コメントを付加すること
*/
* @brief 調査中
* @todo コメントを付加すること
*/
-void apply_default_feat_lighting(
byte f_attr[F_LIT_MAX], byte
f_char[F_LIT_MAX])
+void apply_default_feat_lighting(
TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE
f_char[F_LIT_MAX])
{
{
-
byte
s_attr = f_attr[F_LIT_STANDARD];
-
byte
s_char = f_char[F_LIT_STANDARD];
+
TERM_COLOR
s_attr = f_attr[F_LIT_STANDARD];
+
SYMBOL_CODE
s_char = f_char[F_LIT_STANDARD];
int i;
if (is_ascii_graphics(s_attr)) /* For ASCII */
int i;
if (is_ascii_graphics(s_attr)) /* For ASCII */
@@
-942,20
+942,20
@@
void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
* "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
* then a whole lot of code should be changed... XXX XXX\n
*/
* "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
* then a whole lot of code should be changed... XXX XXX\n
*/
-void map_info(POSITION y, POSITION x,
byte *ap, char *cp, byte
*tap, char *tcp)
+void map_info(POSITION y, POSITION x,
TERM_COLOR *ap, char *cp, TERM_COLOR
*tap, char *tcp)
{
/* Get the cave */
cave_type *c_ptr = &cave[y][x];
{
/* Get the cave */
cave_type *c_ptr = &cave[y][x];
-
s16b
this_o_idx, next_o_idx = 0;
+
OBJECT_IDX
this_o_idx, next_o_idx = 0;
/* Feature code (applying "mimic" field) */
/* Feature code (applying "mimic" field) */
-
s16b
feat = get_feat_mimic(c_ptr);
+
FEAT_IDX
feat = get_feat_mimic(c_ptr);
/* Access floor */
feature_type *f_ptr = &f_info[feat];
/* Access floor */
feature_type *f_ptr = &f_info[feat];
-
byte
a;
+
TERM_COLOR
a;
byte c;
/* Boring grids (floors, etc) */
byte c;
/* Boring grids (floors, etc) */
@@
-1195,8
+1195,6
@@
void map_info(POSITION y, POSITION x, byte *ap, char *cp, byte *tap, char *tcp)
for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
-
- /* Acquire object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
@@
-1236,7
+1234,6
@@
void map_info(POSITION y, POSITION x, byte *ap, char *cp, byte *tap, char *tcp)
/* Hack -- hallucination */
if (p_ptr->image) image_object(ap, cp);
/* Hack -- hallucination */
if (p_ptr->image) image_object(ap, cp);
- /* Done */
break;
}
}
break;
}
}
@@
-1404,7
+1401,7
@@
void move_cursor_relative(int row, int col)
/*
* Place an attr/char pair at the given map coordinate, if legal.
*/
/*
* Place an attr/char pair at the given map coordinate, if legal.
*/
-void print_rel(char c, byte a,
int y, int
x)
+void print_rel(char c, byte a,
TERM_LEN y, TERM_LEN
x)
{
/* Only do "legal" locations */
if (panel_contains(y, x))
{
/* Only do "legal" locations */
if (panel_contains(y, x))
@@
-1562,11
+1559,11
@@
void note_spot(POSITION y, POSITION x)
void display_dungeon(void)
{
void display_dungeon(void)
{
-
int
x, y;
-
byte
a;
+
TERM_LEN
x, y;
+
TERM_COLOR
a;
char c;
char c;
-
byte
ta = 0;
+
TERM_COLOR
ta = 0;
char tc = '\0';
for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
char tc = '\0';
for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
@@
-1621,10
+1618,10
@@
void lite_spot(POSITION y, POSITION x)
/* Redraw if on screen */
if (panel_contains(y, x) && in_bounds2(y, x))
{
/* Redraw if on screen */
if (panel_contains(y, x) && in_bounds2(y, x))
{
-
byte
a;
+
TERM_COLOR
a;
char c;
char c;
-
byte
ta;
+
TERM_COLOR
ta;
char tc;
/* Examine the grid */
char tc;
/* Examine the grid */
@@
-1656,15
+1653,14
@@
void lite_spot(POSITION y, POSITION x)
*/
void prt_map(void)
{
*/
void prt_map(void)
{
-
int
x, y;
- int
v;
+
POSITION
x, y;
+ int v;
/* map bounds */
/* map bounds */
-
s16b
xmin, xmax, ymin, ymax;
+
POSITION
xmin, xmax, ymin, ymax;
-
int
wid, hgt;
+
TERM_LEN
wid, hgt;
- /* Get size */
Term_get_size(&wid, &hgt);
/* Remove map offset */
Term_get_size(&wid, &hgt);
/* Remove map offset */
@@
-1703,11
+1699,11
@@
void prt_map(void)
/* Scan the columns of row "y" */
for (x = xmin; x <= xmax; x++)
{
/* Scan the columns of row "y" */
for (x = xmin; x <= xmax; x++)
{
-
byte
a;
-
char
c;
+
TERM_COLOR
a;
+
SYMBOL_CODE
c;
-
byte
ta;
-
char
tc;
+
TERM_COLOR
ta;
+
SYMBOL_CODE
tc;
/* Determine what is there */
map_info(y, x, &a, &c, &ta, &tc);
/* Determine what is there */
map_info(y, x, &a, &c, &ta, &tc);
@@
-1751,26
+1747,23
@@
void prt_path(POSITION y, POSITION x)
/* Get projection path */
path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH|PROJECT_THRU);
/* Get projection path */
path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH|PROJECT_THRU);
- /* Redraw map */
p_ptr->redraw |= (PR_MAP);
p_ptr->redraw |= (PR_MAP);
-
- /* Redraw stuff */
- redraw_stuff();
+ handle_stuff();
/* Draw path */
for (i = 0; i < path_n; i++)
{
/* Draw path */
for (i = 0; i < path_n; i++)
{
-
int
ny = GRID_Y(path_g[i]);
-
int
nx = GRID_X(path_g[i]);
+
POSITION
ny = GRID_Y(path_g[i]);
+
POSITION
nx = GRID_X(path_g[i]);
cave_type *c_ptr = &cave[ny][nx];
if (panel_contains(ny, nx))
{
cave_type *c_ptr = &cave[ny][nx];
if (panel_contains(ny, nx))
{
-
byte
a = default_color;
+
TERM_COLOR
a = default_color;
char c;
char c;
-
byte ta
;
- char tc;
+
TERM_COLOR ta = default_color
;
+ char tc
= '*'
;
if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
{
if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
{
@@
-1807,7
+1800,7
@@
void prt_path(POSITION y, POSITION x)
}
}
-static cptr simplify_list[][2] =
+static c
onc
ptr simplify_list[][2] =
{
#ifdef JP
{"の魔法書", ""},
{
#ifdef JP
{"の魔法書", ""},
@@
-1837,7
+1830,7
@@
static void display_shortened_item_name(object_type *o_ptr, int y)
char buf[MAX_NLEN];
char *c = buf;
int len = 0;
char buf[MAX_NLEN];
char *c = buf;
int len = 0;
-
byte
attr;
+
TERM_COLOR
attr;
object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
attr = tval_to_attr[o_ptr->tval % 128];
object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
attr = tval_to_attr[o_ptr->tval % 128];
@@
-1853,7
+1846,7
@@
static void display_shortened_item_name(object_type *o_ptr, int y)
int i;
for (i = 0; simplify_list[i][1]; i++)
{
int i;
for (i = 0; simplify_list[i][1]; i++)
{
- cptr org_w = simplify_list[i][0];
+ c
onc
ptr org_w = simplify_list[i][0];
if (*org_w == '^')
{
if (*org_w == '^')
{
@@
-1866,7
+1859,7
@@
static void display_shortened_item_name(object_type *o_ptr, int y)
if (!strncmp(c, org_w, strlen(org_w)))
{
char *s = c;
if (!strncmp(c, org_w, strlen(org_w)))
{
char *s = c;
- cptr tmp = simplify_list[i][1];
+ c
onc
ptr tmp = simplify_list[i][1];
while (*tmp)
*s++ = *tmp++;
tmp = c + strlen(org_w);
while (*tmp)
*s++ = *tmp++;
tmp = c + strlen(org_w);
@@
-1908,16
+1901,16
@@
void display_map(int *cy, int *cx)
{
int i, j, x, y;
{
int i, j, x, y;
-
byte
ta;
+
TERM_COLOR
ta;
char tc;
byte tp;
char tc;
byte tp;
-
byte
**bigma;
+
TERM_COLOR
**bigma;
char **bigmc;
byte **bigmp;
char **bigmc;
byte **bigmp;
-
byte
**ma;
+
TERM_COLOR
**ma;
char **mc;
byte **mp;
char **mc;
byte **mp;
@@
-1930,7
+1923,6
@@
void display_map(int *cy, int *cx)
int **match_autopick_yx;
object_type ***object_autopick_yx;
int **match_autopick_yx;
object_type ***object_autopick_yx;
- /* Get size */
Term_get_size(&wid, &hgt);
hgt -= 2;
wid -= 14;
Term_get_size(&wid, &hgt);
hgt -= 2;
wid -= 14;
@@
-1944,7
+1936,7
@@
void display_map(int *cy, int *cx)
view_granite_lite = FALSE;
/* Allocate the maps */
view_granite_lite = FALSE;
/* Allocate the maps */
- C_MAKE(ma, (hgt + 2),
byte_ptr
);
+ C_MAKE(ma, (hgt + 2),
TERM_COLOR *
);
C_MAKE(mc, (hgt + 2), char_ptr);
C_MAKE(mp, (hgt + 2), byte_ptr);
C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
C_MAKE(mc, (hgt + 2), char_ptr);
C_MAKE(mp, (hgt + 2), byte_ptr);
C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
@@
-1954,7
+1946,7
@@
void display_map(int *cy, int *cx)
for (y = 0; y < (hgt + 2); y++)
{
/* Allocate one row each array */
for (y = 0; y < (hgt + 2); y++)
{
/* Allocate one row each array */
- C_MAKE(ma[y], (wid + 2),
byte
);
+ C_MAKE(ma[y], (wid + 2),
TERM_COLOR
);
C_MAKE(mc[y], (wid + 2), char);
C_MAKE(mp[y], (wid + 2), byte);
C_MAKE(match_autopick_yx[y], (wid + 2), int);
C_MAKE(mc[y], (wid + 2), char);
C_MAKE(mp[y], (wid + 2), byte);
C_MAKE(match_autopick_yx[y], (wid + 2), int);
@@
-1975,7
+1967,7
@@
void display_map(int *cy, int *cx)
}
/* Allocate the maps */
}
/* Allocate the maps */
- C_MAKE(bigma, (cur_hgt + 2),
byte_ptr
);
+ C_MAKE(bigma, (cur_hgt + 2),
TERM_COLOR *
);
C_MAKE(bigmc, (cur_hgt + 2), char_ptr);
C_MAKE(bigmp, (cur_hgt + 2), byte_ptr);
C_MAKE(bigmc, (cur_hgt + 2), char_ptr);
C_MAKE(bigmp, (cur_hgt + 2), byte_ptr);
@@
-1983,7
+1975,7
@@
void display_map(int *cy, int *cx)
for (y = 0; y < (cur_hgt + 2); y++)
{
/* Allocate one row each array */
for (y = 0; y < (cur_hgt + 2); y++)
{
/* Allocate one row each array */
- C_MAKE(bigma[y], (cur_wid + 2),
byte
);
+ C_MAKE(bigma[y], (cur_wid + 2),
TERM_COLOR
);
C_MAKE(bigmc[y], (cur_wid + 2), char);
C_MAKE(bigmp[y], (cur_wid + 2), byte);
C_MAKE(bigmc[y], (cur_wid + 2), char);
C_MAKE(bigmp[y], (cur_wid + 2), byte);
@@
-2003,7
+1995,6
@@
void display_map(int *cy, int *cx)
{
for (j = 0; j < cur_hgt; ++j)
{
{
for (j = 0; j < cur_hgt; ++j)
{
- /* Location */
x = i / xrat + 1;
y = j / yrat + 1;
x = i / xrat + 1;
y = j / yrat + 1;
@@
-2037,7
+2028,6
@@
void display_map(int *cy, int *cx)
{
for (i = 0; i < cur_wid; ++i)
{
{
for (i = 0; i < cur_wid; ++i)
{
- /* Location */
x = i / xrat + 1;
y = j / yrat + 1;
x = i / xrat + 1;
y = j / yrat + 1;
@@
-2157,7
+2147,7
@@
void display_map(int *cy, int *cx)
for (y = 0; y < (hgt + 2); y++)
{
/* Free one row each array */
for (y = 0; y < (hgt + 2); y++)
{
/* Free one row each array */
- C_KILL(ma[y], (wid + 2),
byte
);
+ C_KILL(ma[y], (wid + 2),
TERM_COLOR
);
C_KILL(mc[y], (wid + 2), char);
C_KILL(mp[y], (wid + 2), byte);
C_KILL(match_autopick_yx[y], (wid + 2), int);
C_KILL(mc[y], (wid + 2), char);
C_KILL(mp[y], (wid + 2), byte);
C_KILL(match_autopick_yx[y], (wid + 2), int);
@@
-2165,7
+2155,7
@@
void display_map(int *cy, int *cx)
}
/* Free each line map */
}
/* Free each line map */
- C_KILL(ma, (hgt + 2),
byte_ptr
);
+ C_KILL(ma, (hgt + 2),
TERM_COLOR *
);
C_KILL(mc, (hgt + 2), char_ptr);
C_KILL(mp, (hgt + 2), byte_ptr);
C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
C_KILL(mc, (hgt + 2), char_ptr);
C_KILL(mp, (hgt + 2), byte_ptr);
C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
@@
-2175,13
+2165,13
@@
void display_map(int *cy, int *cx)
for (y = 0; y < (cur_hgt + 2); y++)
{
/* Free one row each array */
for (y = 0; y < (cur_hgt + 2); y++)
{
/* Free one row each array */
- C_KILL(bigma[y], (cur_wid + 2),
byte
);
+ C_KILL(bigma[y], (cur_wid + 2),
TERM_COLOR
);
C_KILL(bigmc[y], (cur_wid + 2), char);
C_KILL(bigmp[y], (cur_wid + 2), byte);
}
/* Free each line map */
C_KILL(bigmc[y], (cur_wid + 2), char);
C_KILL(bigmp[y], (cur_wid + 2), byte);
}
/* Free each line map */
- C_KILL(bigma, (cur_hgt + 2),
byte_ptr
);
+ C_KILL(bigma, (cur_hgt + 2),
TERM_COLOR *
);
C_KILL(bigmc, (cur_hgt + 2), char_ptr);
C_KILL(bigmp, (cur_hgt + 2), byte_ptr);
}
C_KILL(bigmc, (cur_hgt + 2), char_ptr);
C_KILL(bigmp, (cur_hgt + 2), byte_ptr);
}
@@
-2190,23
+2180,18
@@
void display_map(int *cy, int *cx)
/*
* Display a "small-scale" map of the dungeon for the player
*
/*
* Display a "small-scale" map of the dungeon for the player
*
- * Currently, the "player" is displayed on the map.
XXX XXX XXX
+ * Currently, the "player" is displayed on the map.
*/
void do_cmd_view_map(void)
{
int cy, cx;
*/
void do_cmd_view_map(void)
{
int cy, cx;
-
- /* Save the screen */
screen_save();
/* Note */
prt(_("お待ち下さい...", "Please wait..."), 0, 0);
screen_save();
/* Note */
prt(_("お待ち下さい...", "Please wait..."), 0, 0);
- /* Flush */
Term_fresh();
Term_fresh();
-
- /* Clear the screen */
Term_clear();
display_autopick = 0;
Term_clear();
display_autopick = 0;
@@
-2269,8
+2254,6
@@
void do_cmd_view_map(void)
/* Get any key */
inkey();
}
/* Get any key */
inkey();
}
-
- /* Restore the screen */
screen_load();
}
screen_load();
}
@@
-2510,7
+2493,6
@@
void forget_lite(void)
/* Forget "LITE" flag */
cave[y][x].info &= ~(CAVE_LITE);
/* Forget "LITE" flag */
cave[y][x].info &= ~(CAVE_LITE);
- /* Redraw */
/* lite_spot(y, x); Perhaps don't need? */
}
/* lite_spot(y, x); Perhaps don't need? */
}
@@
-2544,8
+2526,6
@@
void forget_lite(void)
/*
/*
- * XXX XXX XXX
- *
* This macro allows us to efficiently add a grid to the "lite" array,
* note that we are never called for illegal grids, or for grids which
* have already been placed into the "lite" array, and we are never
* This macro allows us to efficiently add a grid to the "lite" array,
* note that we are never called for illegal grids, or for grids which
* have already been placed into the "lite" array, and we are never
@@
-3335,10
+3315,8
@@
void forget_view(void)
/* Clear them all */
for (i = 0; i < view_n; i++)
{
/* Clear them all */
for (i = 0; i < view_n; i++)
{
- int y = view_y[i];
- int x = view_x[i];
-
- /* Access the grid */
+ POSITION y = view_y[i];
+ POSITION x = view_x[i];
c_ptr = &cave[y][x];
/* Forget that the grid is viewable */
c_ptr = &cave[y][x];
/* Forget that the grid is viewable */
@@
-3390,7
+3368,7
@@
void forget_view(void)
*
* This function now returns "TRUE" if vision is "blocked" by grid (y,x).
*/
*
* This function now returns "TRUE" if vision is "blocked" by grid (y,x).
*/
-static bool update_view_aux(
int y, int x, int y1, int x1, int y2, int
x2)
+static bool update_view_aux(
POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION
x2)
{
bool f1, f2, v1, v2, z1, z2, wall;
{
bool f1, f2, v1, v2, z1, z2, wall;
@@
-3419,8
+3397,6
@@
static bool update_view_aux(int y, int x, int y1, int x1, int y2, int x2)
/* Totally blocked by "unviewable neighbors" */
if (!v1 && !v2) return (TRUE);
/* Totally blocked by "unviewable neighbors" */
if (!v1 && !v2) return (TRUE);
-
- /* Access the grid */
c_ptr = &cave[y][x];
c_ptr = &cave[y][x];
@@
-3620,8
+3596,6
@@
void update_view(void)
{
y = view_y[n];
x = view_x[n];
{
y = view_y[n];
x = view_x[n];
-
- /* Access the grid */
c_ptr = &cave[y][x];
/* Mark the grid as not in "view" */
c_ptr = &cave[y][x];
/* Mark the grid as not in "view" */
@@
-3644,8
+3618,6
@@
void update_view(void)
/* Now start on the player */
y = p_ptr->y;
x = p_ptr->x;
/* Now start on the player */
y = p_ptr->y;
x = p_ptr->x;
-
- /* Access the grid */
c_ptr = &cave[y][x];
/* Assume the player grid is easily viewable */
c_ptr = &cave[y][x];
/* Assume the player grid is easily viewable */
@@
-3993,8
+3965,6
@@
void update_view(void)
{
y = view_y[n];
x = view_x[n];
{
y = view_y[n];
x = view_x[n];
-
- /* Access the grid */
c_ptr = &cave[y][x];
/* Clear the "CAVE_XTRA" flag */
c_ptr = &cave[y][x];
/* Clear the "CAVE_XTRA" flag */
@@
-4012,8
+3982,6
@@
void update_view(void)
{
y = temp_y[n];
x = temp_x[n];
{
y = temp_y[n];
x = temp_x[n];
-
- /* Access the grid */
c_ptr = &cave[y][x];
/* No longer in the array */
c_ptr = &cave[y][x];
/* No longer in the array */
@@
-4048,8
+4016,6
@@
void delayed_visual_update(void)
{
y = redraw_y[i];
x = redraw_x[i];
{
y = redraw_y[i];
x = redraw_x[i];
-
- /* Access the grid */
c_ptr = &cave[y][x];
/* Update only needed grids (prevent multiple updating) */
c_ptr = &cave[y][x];
/* Update only needed grids (prevent multiple updating) */
@@
-4058,11
+4024,10
@@
void delayed_visual_update(void)
/* If required, note */
if (c_ptr->info & CAVE_NOTE) note_spot(y, x);
/* If required, note */
if (c_ptr->info & CAVE_NOTE) note_spot(y, x);
- /* Redraw */
lite_spot(y, x);
/* Hack -- Visual update of monster on this grid */
lite_spot(y, x);
/* Hack -- Visual update of monster on this grid */
- if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
+ if (c_ptr->m_idx) update_mon
ster
(c_ptr->m_idx, FALSE);
/* No longer in the array */
c_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
/* No longer in the array */
c_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
@@
-4078,7
+4043,7
@@
void delayed_visual_update(void)
*/
void forget_flow(void)
{
*/
void forget_flow(void)
{
-
int
x, y;
+
POSITION
x, y;
/* Check the entire dungeon */
for (y = 0; y < cur_hgt; y++)
/* Check the entire dungeon */
for (y = 0; y < cur_hgt; y++)
@@
-4229,8
+4194,8
@@
static int scent_when = 0;
*/
void update_smell(void)
{
*/
void update_smell(void)
{
-
int
i, j;
-
int
y, x;
+
POSITION
i, j;
+
POSITION
y, x;
/* Create a table that controls the spread of scent */
const int scent_adjust[5][5] =
/* Create a table that controls the spread of scent */
const int scent_adjust[5][5] =
@@
-4297,10
+4262,11
@@
void update_smell(void)
*/
void map_area(POSITION range)
{
*/
void map_area(POSITION range)
{
- int i, x, y;
- cave_type *c_ptr;
- s16b feat;
- feature_type *f_ptr;
+ int i;
+ POSITION x, y;
+ cave_type *c_ptr;
+ FEAT_IDX feat;
+ feature_type *f_ptr;
if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
@@
-4350,10
+4316,8
@@
void map_area(POSITION range)
}
}
}
}
- /* Redraw map */
p_ptr->redraw |= (PR_MAP);
p_ptr->redraw |= (PR_MAP);
- /* Window stuff */
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
@@
-4377,8
+4341,9
@@
void map_area(POSITION range)
*/
void wiz_lite(bool ninja)
{
*/
void wiz_lite(bool ninja)
{
- int i, y, x;
- s16b feat;
+ OBJECT_IDX i;
+ POSITION y, x;
+ FEAT_IDX feat;
feature_type *f_ptr;
/* Memorize objects */
feature_type *f_ptr;
/* Memorize objects */
@@
-4417,8
+4382,8
@@
void wiz_lite(bool ninja)
/* Scan all neighbors */
for (i = 0; i < 9; i++)
{
/* Scan all neighbors */
for (i = 0; i < 9; i++)
{
-
int
yy = y + ddy_ddd[i];
-
int
xx = x + ddx_ddd[i];
+
POSITION
yy = y + ddy_ddd[i];
+
POSITION
xx = x + ddx_ddd[i];
/* Get the grid */
c_ptr = &cave[yy][xx];
/* Get the grid */
c_ptr = &cave[yy][xx];
@@
-4454,13
+4419,8
@@
void wiz_lite(bool ninja)
}
}
}
}
- /* Update the monsters */
p_ptr->update |= (PU_MONSTERS);
p_ptr->update |= (PU_MONSTERS);
-
- /* Redraw map */
p_ptr->redraw |= (PR_MAP);
p_ptr->redraw |= (PR_MAP);
-
- /* Window stuff */
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
if (p_ptr->special_defense & NINJA_S_STEALTH)
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
if (p_ptr->special_defense & NINJA_S_STEALTH)
@@
-4475,8
+4435,8
@@
void wiz_lite(bool ninja)
*/
void wiz_dark(void)
{
*/
void wiz_dark(void)
{
-
int i, y, x
;
-
+
OBJECT_IDX i
;
+ POSITION y, x;
/* Forget every grid */
for (y = 1; y < cur_hgt - 1; y++)
/* Forget every grid */
for (y = 1; y < cur_hgt - 1; y++)
@@
-4523,30
+4483,17
@@
void wiz_dark(void)
/* Forget travel route when we have forgotten map */
forget_travel_flow();
/* Forget travel route when we have forgotten map */
forget_travel_flow();
- /* Mega-Hack -- Forget the view and lite */
p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
-
- /* Update the view and lite */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
-
- /* Update the monsters */
p_ptr->update |= (PU_MONSTERS);
p_ptr->update |= (PU_MONSTERS);
-
- /* Redraw map */
p_ptr->redraw |= (PR_MAP);
p_ptr->redraw |= (PR_MAP);
-
- /* Window stuff */
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
-
-
-
-
/*
* Change the "feat" flag for a grid, and notice/redraw the grid
*/
/*
* Change the "feat" flag for a grid, and notice/redraw the grid
*/
-void cave_set_feat(POSITION y, POSITION x, IDX feat)
+void cave_set_feat(POSITION y, POSITION x,
FEAT_
IDX feat)
{
cave_type *c_ptr = &cave[y][x];
feature_type *f_ptr = &f_info[feat];
{
cave_type *c_ptr = &cave[y][x];
feature_type *f_ptr = &f_info[feat];
@@
-4563,7
+4510,8
@@
void cave_set_feat(POSITION y, POSITION x, IDX feat)
/* Hack -- glow the GLOW terrain */
if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
/* Hack -- glow the GLOW terrain */
if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
- int i, yy, xx;
+ DIRECTION i;
+ POSITION yy, xx;
for (i = 0; i < 9; i++)
{
for (i = 0; i < 9; i++)
{
@@
-4599,14
+4547,10
@@
void cave_set_feat(POSITION y, POSITION x, IDX feat)
/* Check for change to boring grid */
if (!have_flag(f_ptr->flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
/* Check for change to boring grid */
if (!have_flag(f_ptr->flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+ if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
- /* Update the monster */
- if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
-
- /* Notice */
note_spot(y, x);
note_spot(y, x);
- /* Redraw */
lite_spot(y, x);
/* Check if los has changed */
lite_spot(y, x);
/* Check if los has changed */
@@
-4626,7
+4570,8
@@
void cave_set_feat(POSITION y, POSITION x, IDX feat)
/* Hack -- glow the GLOW terrain */
if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
/* Hack -- glow the GLOW terrain */
if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
- int i, yy, xx;
+ DIRECTION i;
+ POSITION yy, xx;
cave_type *cc_ptr;
for (i = 0; i < 9; i++)
cave_type *cc_ptr;
for (i = 0; i < 9; i++)
@@
-4639,13
+4584,10
@@
void cave_set_feat(POSITION y, POSITION x, IDX feat)
if (player_has_los_grid(cc_ptr))
{
if (player_has_los_grid(cc_ptr))
{
- /* Update the monster */
- if (cc_ptr->m_idx) update_mon(cc_ptr->m_idx, FALSE);
+ if (cc_ptr->m_idx) update_monster(cc_ptr->m_idx, FALSE);
- /* Notice */
note_spot(yy, xx);
note_spot(yy, xx);
- /* Redraw */
lite_spot(yy, xx);
}
lite_spot(yy, xx);
}
@@
-4660,7
+4602,7
@@
void cave_set_feat(POSITION y, POSITION x, IDX feat)
}
}
-
IDX conv_dungeon_feat(
IDX newfeat)
+
FEAT_IDX conv_dungeon_feat(FEAT_
IDX newfeat)
{
feature_type *f_ptr = &f_info[newfeat];
{
feature_type *f_ptr = &f_info[newfeat];
@@
-4694,7
+4636,7
@@
IDX conv_dungeon_feat(IDX newfeat)
* Take a feature, determine what that feature becomes
* through applying the given action.
*/
* Take a feature, determine what that feature becomes
* through applying the given action.
*/
-
IDX feat_state(
IDX feat, int action)
+
FEAT_IDX feat_state(FEAT_
IDX feat, int action)
{
feature_type *f_ptr = &f_info[feat];
int i;
{
feature_type *f_ptr = &f_info[feat];
int i;
@@
-4717,10
+4659,10
@@
IDX feat_state(IDX feat, int action)
void cave_alter_feat(POSITION y, POSITION x, int action)
{
/* Set old feature */
void cave_alter_feat(POSITION y, POSITION x, int action)
{
/* Set old feature */
- IDX oldfeat = cave[y][x].feat;
+
FEAT_
IDX oldfeat = cave[y][x].feat;
/* Get the new feat */
/* Get the new feat */
- IDX newfeat = feat_state(oldfeat, action);
+
FEAT_
IDX newfeat = feat_state(oldfeat, action);
/* No change */
if (newfeat == oldfeat) return;
/* No change */
if (newfeat == oldfeat) return;
@@
-4782,17
+4724,13
@@
void remove_mirror(POSITION y, POSITION x)
{
c_ptr->info &= ~(CAVE_GLOW);
if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
{
c_ptr->info &= ~(CAVE_GLOW);
if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
-
- /* Update the monster */
- if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
+ if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
update_local_illumination(y, x);
}
update_local_illumination(y, x);
}
- /* Notice */
note_spot(y, x);
note_spot(y, x);
- /* Redraw */
lite_spot(y, x);
}
lite_spot(y, x);
}
@@
-4992,7
+4930,6
@@
void monster_race_track(MONRACE_IDX r_idx)
/* Save this monster ID */
p_ptr->monster_race_idx = r_idx;
/* Save this monster ID */
p_ptr->monster_race_idx = r_idx;
- /* Window stuff */
p_ptr->window |= (PW_MONSTER);
}
p_ptr->window |= (PW_MONSTER);
}
@@
-5001,12
+4938,11
@@
void monster_race_track(MONRACE_IDX r_idx)
/*
* Hack -- track the given object kind
*/
/*
* Hack -- track the given object kind
*/
-void object_kind_track(IDX k_idx)
+void object_kind_track(
KIND_OBJECT_
IDX k_idx)
{
/* Save this monster ID */
p_ptr->object_kind_idx = k_idx;
{
/* Save this monster ID */
p_ptr->object_kind_idx = k_idx;
- /* Window stuff */
p_ptr->window |= (PW_OBJECT);
}
p_ptr->window |= (PW_OBJECT);
}
@@
-5021,7
+4957,7
@@
void object_kind_track(IDX k_idx)
*
* All disturbance cancels repeated commands, resting, and running.
*/
*
* All disturbance cancels repeated commands, resting, and running.
*/
-void disturb(
int stop_search, int
stop_travel)
+void disturb(
bool stop_search, bool
stop_travel)
{
#ifndef TRAVEL
/* Unused */
{
#ifndef TRAVEL
/* Unused */
@@
-5088,7
+5024,8
@@
void disturb(int stop_search, int stop_travel)
*/
void glow_deep_lava_and_bldg(void)
{
*/
void glow_deep_lava_and_bldg(void)
{
- int y, x, i, yy, xx;
+ POSITION y, x, yy, xx;
+ DIRECTION i;
cave_type *c_ptr;
/* Not in the darkness dungeon */
cave_type *c_ptr;
/* Not in the darkness dungeon */
@@
-5118,7
+5055,6
@@
void glow_deep_lava_and_bldg(void)
/* Update the view and lite */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
/* Update the view and lite */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
- /* Redraw map */
p_ptr->redraw |= (PR_MAP);
}
p_ptr->redraw |= (PR_MAP);
}