* by Robert Ruehlmann (rr9@angband.org)
*/
-static int display_autopick;
+static byte display_autopick;
static int match_autopick;
static object_type *autopick_obj;
+static int feat_priority;
/*
* Distance between two points via Newton-Raphson technique
case FEAT_TRAP_POISON:
case FEAT_TRAP_SLEEP:
case FEAT_TRAP_TRAPS:
+ case FEAT_TRAP_ALARM:
{
/* A trap */
return (TRUE);
/* Normal graphics */
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = r_info[randint(max_r_idx-1)].x_char;
- (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+ (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+ (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
}
else
/* IBM-pseudo graphics */
{
n = strlen(image_monster_hack_ibm);
- (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+ (*cp) = (image_monster_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
/* Text mode */
{
- (*cp) = (image_monster_hack[rand_int(n)]);
+ (*cp) = (image_monster_hack[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
{
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = k_info[randint(max_k_idx-1)].x_char;
- (*ap) = k_info[randint(max_k_idx-1)].x_attr;
+ (*cp) = k_info[randint1(max_k_idx-1)].x_char;
+ (*ap) = k_info[randint1(max_k_idx-1)].x_attr;
}
else
{
n = strlen(image_object_hack_ibm);
- (*cp) = (image_object_hack_ibm[rand_int(n)]);
+ (*cp) = (image_object_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
{
- (*cp) = (image_object_hack[rand_int(n)]);
+ (*cp) = (image_object_hack[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
static void image_random(byte *ap, char *cp)
{
/* Normally, assume monsters */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
image_monster(ap, cp);
}
switch (feat)
{
- case FEAT_FLOOR:
- case FEAT_INVIS:
- case FEAT_GLYPH:
- case FEAT_LESS:
- case FEAT_MORE:
- case FEAT_LESS_LESS:
- case FEAT_MORE_MORE:
- case FEAT_SECRET:
- case FEAT_RUBBLE:
- case FEAT_MAGMA:
- case FEAT_QUARTZ:
- case FEAT_MAGMA_H:
- case FEAT_QUARTZ_H:
- case FEAT_MAGMA_K:
- case FEAT_QUARTZ_K:
- case FEAT_WALL_EXTRA:
- case FEAT_WALL_INNER:
- case FEAT_WALL_OUTER:
- case FEAT_WALL_SOLID:
- case FEAT_PERM_EXTRA:
- case FEAT_PERM_INNER:
- case FEAT_PERM_OUTER:
- case FEAT_PERM_SOLID:
- case FEAT_MINOR_GLYPH:
- case FEAT_DEEP_WATER:
- case FEAT_SHAL_WATER:
- case FEAT_DEEP_LAVA:
- case FEAT_SHAL_LAVA:
- case FEAT_DARK_PIT:
- case FEAT_DIRT:
- case FEAT_GRASS:
- case FEAT_FLOWER:
- case FEAT_DEEP_GRASS:
- case FEAT_TREES:
- case FEAT_MOUNTAIN:
- return TRUE;
- default:
- return FALSE;
+ case FEAT_FLOOR:
+ case FEAT_INVIS:
+ case FEAT_GLYPH:
+ case FEAT_LESS:
+ case FEAT_MORE:
+ case FEAT_LESS_LESS:
+ case FEAT_MORE_MORE:
+ case FEAT_SECRET:
+ case FEAT_RUBBLE:
+ case FEAT_MAGMA:
+ case FEAT_QUARTZ:
+ case FEAT_MAGMA_H:
+ case FEAT_QUARTZ_H:
+ case FEAT_MAGMA_K:
+ case FEAT_QUARTZ_K:
+ case FEAT_WALL_EXTRA:
+ case FEAT_WALL_INNER:
+ case FEAT_WALL_OUTER:
+ case FEAT_WALL_SOLID:
+ case FEAT_PERM_EXTRA:
+ case FEAT_PERM_INNER:
+ case FEAT_PERM_OUTER:
+ case FEAT_PERM_SOLID:
+ case FEAT_MINOR_GLYPH:
+ case FEAT_DEEP_WATER:
+ case FEAT_SHAL_WATER:
+ case FEAT_DEEP_LAVA:
+ case FEAT_SHAL_LAVA:
+ case FEAT_DARK_PIT:
+ case FEAT_DIRT:
+ case FEAT_GRASS:
+ case FEAT_FLOWER:
+ case FEAT_DEEP_GRASS:
+ case FEAT_TREES:
+ case FEAT_MOUNTAIN:
+ case FEAT_MIRROR:
+ return TRUE;
+ default:
+ return FALSE;
}
}
{TERM_WHITE, TERM_L_DARK},
/* TERM_ORANGE */
- {TERM_YELLOW, TERM_UMBER},
+ {TERM_L_UMBER, TERM_UMBER},
/* TERM_RED */
{TERM_RED, TERM_RED},
{TERM_L_BLUE, TERM_L_BLUE},
/* TERM_L_UMBER */
- {TERM_YELLOW, TERM_UMBER}
+ {TERM_L_UMBER, TERM_UMBER}
};
/*
s16b this_o_idx, next_o_idx = 0;
- int feat;
+ byte feat;
byte a;
byte c;
c_ptr = &cave[y][x];
/* Feature code */
- feat = c_ptr->feat;
+ feat = c_ptr->mimic ? c_ptr->mimic : c_ptr->feat;
/* Floors (etc) */
if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
a = f_ptr->x_attr;
/* Special lighting effects */
- if (view_special_lite && (!p_ptr->wild_mode) && ((a == TERM_WHITE) || use_transparency))
+ if (view_special_lite && (!p_ptr->wild_mode) && ((a == TERM_WHITE) || use_graphics))
{
/* Handle "blind" */
if (p_ptr->blind)
{
- if (new_ascii_graphics)
+ if (use_graphics)
{
- if (is_ascii_graphics(c,a))
- {
- /* Use darkened colour */
- a = lighting_colours[a][1];
- }
- else if (use_transparency && feat_supports_lighting(feat))
- {
- /* Use a dark tile */
- c++;
- }
+ /*
+ * feat_supports_lighting(feat)
+ * is always TRUE here
+ */
+
+ /* Use a dark tile */
+ c++;
}
else
{
- if (use_transparency)
- {
- /* Use a dark tile */
- c++;
- }
- else
- {
- /* Use "dark gray" */
- a = TERM_L_DARK;
- }
+ /* Use "dark gray" */
+ a = TERM_L_DARK;
}
}
/* Torch lite */
if (view_yellow_lite && !p_ptr->wild_mode)
{
- if (new_ascii_graphics)
+ if (use_graphics)
{
- if (is_ascii_graphics(c,a))
- {
- /* Use lightened colour */
- a = lighting_colours[a][0];
- }
- else if (use_transparency &&
- feat_supports_lighting(feat))
- {
- /* Use a brightly lit tile */
- c += 2;
- }
+ /*
+ * feat_supports_lighting(feat)
+ * is always TRUE here
+ */
+
+ /* Use a brightly lit tile */
+ c += 2;
}
else
{
- /* Torch lite */
- if (view_yellow_lite)
- {
- if (use_transparency)
- {
- /* Use a brightly lit tile */
- c += 2;
- }
- else
- {
- /* Use "yellow" */
- a = TERM_YELLOW;
- }
- }
+ /* Use "yellow" */
+ a = TERM_YELLOW;
}
}
}
/* Handle "dark" grids */
else if (!(c_ptr->info & CAVE_GLOW))
{
- if (new_ascii_graphics)
+ if (use_graphics)
{
- if (is_ascii_graphics(c,a))
- {
- /* Use darkened colour */
- a = lighting_colours[a][1];
- }
- else if (use_transparency && feat_supports_lighting(feat))
- {
- /* Use a dark tile */
- c++;
- }
+ /*
+ * feat_supports_lighting(feat)
+ * is always TRUE here
+ */
+
+ /* Use a dark tile */
+ c++;
}
else
{
- if (use_transparency)
- {
- /* Use a dark tile */
- c++;
- }
- else
- {
- /* Use "dark gray" */
- a = TERM_L_DARK;
- }
+ /* Use "dark gray" */
+ a = TERM_L_DARK;
}
}
/* Special flag */
if (view_bright_lite && !p_ptr->wild_mode)
{
- if (new_ascii_graphics)
+ if (use_graphics)
{
- if (is_ascii_graphics(c,a))
- {
- /* Use darkened colour */
- a = lighting_colours[a][1];
- }
- else if (use_transparency && feat_supports_lighting(feat))
- {
- /* Use a dark tile */
- c++;
- }
+ /*
+ * feat_supports_lighting(feat)
+ * is always TRUE here
+ */
+
+ /* Use a dark tile */
+ c++;
}
else
{
- if (use_transparency)
- {
- /* Use a dark tile */
- c++;
- }
- else
- {
- /* Use "gray" */
- a = TERM_SLATE;
- }
+ /* Use "gray" */
+ a = TERM_SLATE;
}
}
}
/* Unknown */
else
{
+ /* Unsafe cave grid -- idea borrowed from Unangband */
+ if (view_unsafe_grids && !(c_ptr->info & (CAVE_DETECT)))
+ feat = FEAT_UNDETECTD;
+ else
+ feat = FEAT_NONE;
+
/* Access darkness */
- f_ptr = &f_info[FEAT_NONE];
+ f_ptr = &f_info[feat];
/* Normal attr */
a = f_ptr->x_attr;
else
{
/* Memorized grids */
- if ((c_ptr->info & CAVE_MARK) && (view_granite_lite || !new_ascii_graphics))
+ if ((c_ptr->info & CAVE_MARK) && (view_granite_lite || new_ascii_graphics))
{
/* Apply "mimic" field */
if (c_ptr->mimic)
/* Use darkened colour */
a = lighting_colours[a][1];
}
- else if (use_transparency && feat_supports_lighting(feat))
+ else if (use_graphics && feat_supports_lighting(feat))
{
/* Use a dark tile */
c++;
else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
{
/* Torch lite */
- if (view_yellow_lite && !p_ptr->wild_mode && (!use_transparency || feat_supports_lighting(feat) || is_ascii_graphics(c,a)))
+ if (view_yellow_lite && !p_ptr->wild_mode && ((use_graphics && feat_supports_lighting(feat)) || is_ascii_graphics(c,a)))
{
if (is_ascii_graphics(c,a))
{
/* Use lightened colour */
a = lighting_colours[a][0];
}
- else if (use_transparency &&
+ else if (use_graphics &&
feat_supports_lighting(c_ptr->feat))
{
/* Use a brightly lit tile */
}
/* Handle "view_bright_lite" */
- else if (view_bright_lite && !p_ptr->wild_mode && (!use_transparency || feat_supports_lighting(feat) || is_ascii_graphics(c,a)))
+ else if (view_bright_lite && !p_ptr->wild_mode && ((use_graphics && feat_supports_lighting(feat)) || is_ascii_graphics(c,a)))
{
/* Not viewable */
if (!(c_ptr->info & CAVE_VIEW))
/* Use darkened colour */
a = lighting_colours[a][1];
}
- else if (use_transparency && feat_supports_lighting(feat))
+ else if (use_graphics && feat_supports_lighting(feat))
{
/* Use a dark tile */
c++;
}
/* Special lighting effects */
else if (view_granite_lite && !p_ptr->wild_mode &&
- (((a == TERM_WHITE) && !use_transparency) ||
- (use_transparency && feat_supports_lighting(c_ptr->feat))))
+ (((a == TERM_WHITE) && !use_graphics) ||
+ (use_graphics && feat_supports_lighting(c_ptr->feat))))
{
/* Handle "blind" */
if (p_ptr->blind)
{
- if (use_transparency)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* Torch lite */
if (view_yellow_lite && !p_ptr->wild_mode)
{
- if (use_transparency)
+ if (use_graphics)
{
/* Use a brightly lit tile */
c += 2;
/* Not viewable */
if (!(c_ptr->info & CAVE_VIEW))
{
- if (use_transparency)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* Not glowing */
else if (!(c_ptr->info & CAVE_GLOW))
{
- if (use_transparency)
+ if (use_graphics)
{
/* Use a lit tile */
}
/* Check for "local" illumination */
if (!(cave[yy][xx].info & CAVE_GLOW))
{
- if (use_transparency)
+ if (use_graphics)
{
/* Use a lit tile */
}
/* "Simple Lighting" */
else
{
- /* Access feature */
- f_ptr = &f_info[feat];
-
/* Handle "blind" */
if (!(c_ptr->info & CAVE_MARK))
{
- /* Access darkness */
- f_ptr = &f_info[FEAT_NONE];
+ /* Unsafe cave grid -- idea borrowed from Unangband */
+ if (view_unsafe_grids && !(c_ptr->info & (CAVE_DETECT)))
+ feat = FEAT_UNDETECTD;
+ else
+ feat = FEAT_NONE;
}
+ /* Access feature */
+ f_ptr = &f_info[feat];
+
/* Normal attr */
a = f_ptr->x_attr;
}
}
- /* Hack -- rare random hallucination, except on outer dungeon walls */
- if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !rand_int(256))
+ if (feat_priority == -1)
{
- /* Hallucinate */
- image_random(ap, cp);
+ switch (feat)
+ {
+ case FEAT_NONE:
+ case FEAT_DARK_PIT:
+ feat_priority = 1;
+ break;
+
+ case FEAT_FLOOR:
+ case FEAT_INVIS:
+ case FEAT_TRAP_TRAPDOOR:
+ case FEAT_TRAP_PIT:
+ case FEAT_TRAP_SPIKED_PIT:
+ case FEAT_TRAP_POISON_PIT:
+ case FEAT_TRAP_TY_CURSE:
+ case FEAT_TRAP_TELEPORT:
+ case FEAT_TRAP_FIRE:
+ case FEAT_TRAP_ACID:
+ case FEAT_TRAP_SLOW:
+ case FEAT_TRAP_LOSE_STR:
+ case FEAT_TRAP_LOSE_DEX:
+ case FEAT_TRAP_LOSE_CON:
+ case FEAT_TRAP_BLIND:
+ case FEAT_TRAP_CONFUSE:
+ case FEAT_TRAP_POISON:
+ case FEAT_TRAP_SLEEP:
+ case FEAT_TRAP_TRAPS:
+ case FEAT_TRAP_ALARM:
+ case FEAT_DIRT:
+ case FEAT_GRASS:
+ case FEAT_FLOWER:
+ case FEAT_DEEP_GRASS:
+ case FEAT_SWAMP:
+ case FEAT_TREES:
+ case FEAT_SECRET:
+ case FEAT_RUBBLE:
+ case FEAT_MAGMA:
+ case FEAT_QUARTZ:
+ case FEAT_MAGMA_H:
+ case FEAT_QUARTZ_H:
+ case FEAT_WALL_EXTRA:
+ case FEAT_WALL_INNER:
+ case FEAT_WALL_OUTER:
+ case FEAT_WALL_SOLID:
+ case FEAT_DEEP_WATER:
+ case FEAT_SHAL_WATER:
+ case FEAT_DEEP_LAVA:
+ case FEAT_SHAL_LAVA:
+ feat_priority = 2;
+ break;
+
+ case FEAT_MAGMA_K:
+ case FEAT_QUARTZ_K:
+ feat_priority = 3;
+ break;
+
+ case FEAT_MOUNTAIN:
+ case FEAT_PERM_EXTRA:
+ case FEAT_PERM_INNER:
+ case FEAT_PERM_OUTER:
+ case FEAT_PERM_SOLID:
+ feat_priority = 5;
+ break;
+
+ /* default is feat_priority = 20; (doors and stores) */
+
+ case FEAT_GLYPH:
+ case FEAT_MINOR_GLYPH:
+ case FEAT_MIRROR:
+ case FEAT_PATTERN_START:
+ case FEAT_PATTERN_1:
+ case FEAT_PATTERN_2:
+ case FEAT_PATTERN_3:
+ case FEAT_PATTERN_4:
+ case FEAT_PATTERN_END:
+ case FEAT_PATTERN_OLD:
+ case FEAT_PATTERN_XTRA1:
+ case FEAT_PATTERN_XTRA2:
+ feat_priority = 16;
+ break;
+
+ /* objects have feat_priority = 20 */
+ /* monsters have feat_priority = 30 */
+
+ case FEAT_LESS:
+ case FEAT_MORE:
+ case FEAT_QUEST_ENTER:
+ case FEAT_QUEST_EXIT:
+ case FEAT_QUEST_DOWN:
+ case FEAT_QUEST_UP:
+ case FEAT_LESS_LESS:
+ case FEAT_MORE_MORE:
+ case FEAT_TOWN:
+ case FEAT_ENTRANCE:
+ feat_priority = 35;
+ break;
+
+ default:
+ feat_priority = 10;
+ break;
+ }
}
#ifdef USE_TRANSPARENCY
(*ap) = a;
(*cp) = c;
+ /* Hack -- rare random hallucination, except on outer dungeon walls */
+ if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !randint0(256))
+ {
+ /* Hallucinate */
+ image_random(ap, cp);
+ }
+
/* Objects */
for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
/* Memorized objects */
if (o_ptr->marked)
{
- if(display_autopick == 1){
+ if (display_autopick)
+ {
+ byte act;
+
match_autopick = is_autopick(o_ptr);
- if(match_autopick == -1) continue;
- else if (((autopick_action[match_autopick] == DO_AUTOPICK) && display_pick) || ((autopick_action[match_autopick] == DONT_AUTOPICK) && display_nopick) || ((autopick_action[match_autopick] == DO_AUTODESTROY) && display_destroy))
+ if(match_autopick == -1)
+ continue;
+
+ act = autopick_list[match_autopick].action;
+
+ if ((act & DO_DISPLAY) && (act & display_autopick))
+ {
autopick_obj = o_ptr;
+ }
else
- {match_autopick = -1; continue;}
+ {
+ match_autopick = -1;
+ continue;
+ }
}
/* Normal char */
(*cp) = object_char(o_ptr);
/* Normal attr */
(*ap) = object_attr(o_ptr);
+ feat_priority = 20;
+
/* Hack -- hallucination */
if (p_ptr->image) image_object(ap, cp);
/* Handle monsters */
- if (c_ptr->m_idx && display_autopick==0 )
+ if (c_ptr->m_idx && display_autopick == 0 )
{
monster_type *m_ptr = &m_list[c_ptr->m_idx];
if (m_ptr->ml)
{
monster_race *r_ptr;
- if (m_ptr->mflag2 & MFLAG_KAGE) r_ptr = &r_info[MON_KAGE];
- else r_ptr = &r_info[m_ptr->r_idx];
+ r_ptr = &r_info[m_ptr->ap_r_idx];
/* Desired attr */
a = r_ptr->x_attr;
/* Desired char */
c = r_ptr->x_char;
+ feat_priority = 30;
+
/* Mimics' colors vary */
if (strchr("\"!=", c) && !(r_ptr->flags1 & RF1_UNIQUE))
{
{
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = r_info[randint(max_r_idx-1)].x_char;
- (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+ (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+ (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
}
else
{
int n = strlen(image_monster_hack_ibm);
- (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+ (*cp) = (image_monster_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
{
- (*cp) = (randint(25) == 1 ?
- image_object_hack[randint(strlen(image_object_hack))] :
- image_monster_hack[randint(strlen(image_monster_hack))]);
+ (*cp) = (one_in_(25) ?
+ image_object_hack[randint0(strlen(image_object_hack))] :
+ image_monster_hack[randint0(strlen(image_monster_hack))]);
}
}
else
/* Multi-hued attr */
if (r_ptr->flags2 & RF2_ATTR_ANY)
- (*ap) = randint(15);
- else switch (randint(7))
+ (*ap) = randint1(15);
+ else switch (randint1(7))
{
case 1:
(*ap) = TERM_RED;
{
monster_race *r_ptr = &r_info[0];
+ feat_priority = 31;
+
/* Get the "player" attr */
a = r_ptr->x_attr;
if (!streq(ANGBAND_GRAF, "new"))
{
- if (!streq(ANGBAND_SYS,"ibm"))
- {
-
- if (use_graphics && player_symbols)
- {
- a = BMP_FIRST_PC_CLASS + p_ptr->pclass;
- c = BMP_FIRST_PC_RACE + p_ptr->prace;
- }
- }
- else
+ if (streq(ANGBAND_SYS,"ibm"))
{
if (use_graphics && player_symbols)
{
case CLASS_CHAOS_WARRIOR:
do
{
- a = randint(15);
+ a = randint1(15);
}
while (a == TERM_DARK);
break;
}
+#ifdef JP
+/*
+ * Table of Ascii-to-Zenkaku
+ * ¡Ö¢£¡×¤ÏÆóÇÜÉýƦÉå¤ÎÆâÉô¥³¡¼¥É¤Ë»ÈÍÑ¡£
+ */
+static char ascii_to_zenkaku[2*128+1] = "\
+¡¡¡ª¡É¡ô¡ð¡ó¡õ¡Ç¡Ê¡Ë¡ö¡Ü¡¤¡Ý¡¥¡¿\
+£°£±£²£³£´£µ£¶£·£¸£¹¡§¡¨¡ã¡á¡ä¡©\
+¡÷£Á£Â£Ã£Ä£Å£Æ£Ç£È£É£Ê£Ë£Ì£Í£Î£Ï\
+£Ð£Ñ£Ò£Ó£Ô£Õ£Ö£×£Ø£Ù£Ú¡Î¡À¡Ï¡°¡²\
+¡Æ£á£â£ã£ä£å£æ£ç£è£é£ê£ë£ì£í£î£ï\
+£ð£ñ£ò£ó£ô£õ£ö£÷£ø£ù£ú¡Ð¡Ã¡Ñ¡Á¢£";
+#endif
+
+/*
+ * Prepare Bigtile or 2-bytes character attr/char pairs
+ */
+static void bigtile_attr(char *cp, byte *ap, char *cp2, byte *ap2)
+{
+ if (*ap & 0x80)
+ {
+ *ap2 = 255;
+ *cp2 = -1;
+ return;
+ }
+
+#ifdef JP
+ if (isprint(*cp) || *cp == 127)
+ {
+ *ap2 = (*ap) | 0xf0;
+ *cp2 = ascii_to_zenkaku[2*(*cp-' ') + 1];
+ *cp = ascii_to_zenkaku[2*(*cp-' ')];
+ return;
+ }
+#endif
+
+ *ap2 = TERM_WHITE;
+ *cp2 = ' ';
+}
+
+
+/*
+ * Calculate panel colum of a location in the map
+ */
+static int panel_col_of(int col)
+{
+ col -= panel_col_min;
+ if (use_bigtile) col *= 2;
+ return col + 13;
+}
+
/*
* Moves the cursor to a given MAP (y,x) location
{
/* Real co-ords convert to screen positions */
row -= panel_row_prt;
- col -= panel_col_prt;
/* Go there */
- Term_gotoxy(col, row);
+ Term_gotoxy(panel_col_of(col), row);
}
*/
void print_rel(char c, byte a, int y, int x)
{
+ char c2;
+ byte a2;
+
/* Only do "legal" locations */
if (panel_contains(y, x))
{
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
+ if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
+
/* Draw the char using the attr */
- Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);
+ Term_draw(panel_col_of(x), y-panel_row_prt, a, c);
+ if (use_bigtile)
+ Term_draw(panel_col_of(x)+1, y-panel_row_prt, a2, c2);
}
}
void lite_spot(int y, int x)
{
/* Redraw if on screen */
- if (panel_contains(y, x))
+ if (panel_contains(y, x) && in_bounds2(y, x))
{
byte a;
char c;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
+#ifdef JP
+ if (use_bigtile && !(a & 0x80) && (isprint(c) || c == 127))
+ {
+ /* Term_queue_chars ¤ÏÁ´³ÑASCIIÃÏ·Á¤òÀµ¤·¤¯update¤¹¤ë¡£ */
+ Term_queue_chars(panel_col_of(x), y-panel_row_prt, 2, a, &ascii_to_zenkaku[2*(c-' ')]);
+ return;
+ }
+#endif
+
#ifdef USE_TRANSPARENCY
/* Hack -- Queue it */
- Term_queue_char(x-panel_col_prt, y-panel_row_prt, a, c, ta, tc);
+ Term_queue_char(panel_col_of(x), y-panel_row_prt, a, c, ta, tc);
+ if (use_bigtile)
+ Term_queue_char(panel_col_of(x)+1, y-panel_row_prt, 255, -1, 0, 0);
#else /* USE_TRANSPARENCY */
/* Hack -- Queue it */
- Term_queue_char(x-panel_col_prt, y-panel_row_prt, a, c);
+ Term_queue_char(panel_col_of(x), y-panel_row_prt, a, c);
+ if (use_bigtile)
+ Term_queue_char(panel_col_of(x)+1, y-panel_row_prt, 255, -1);
#endif /* USE_TRANSPARENCY */
}
}
{
int x, y;
int v;
+
+ /* map bounds */
+ s16b xmin, xmax, ymin, ymax;
+
+ int wid, hgt;
+
bool fake_monochrome = (!use_graphics || streq(ANGBAND_SYS, "ibm"));
+ /* Get size */
+ Term_get_size(&wid, &hgt);
+
+ /* Remove map offset */
+ wid -= COL_MAP + 2;
+ hgt -= ROW_MAP + 2;
/* Access the cursor state */
(void)Term_get_cursor(&v);
/* Hide the cursor */
(void)Term_set_cursor(0);
+ /* Get bounds */
+ xmin = (0 < panel_col_min) ? panel_col_min : 0;
+ xmax = (cur_wid - 1 > panel_col_max) ? panel_col_max : cur_wid - 1;
+ ymin = (0 < panel_row_min) ? panel_row_min : 0;
+ ymax = (cur_hgt - 1 > panel_row_max) ? panel_row_max : cur_hgt - 1;
+
+ /* Bottom section of screen */
+ for (y = 1; y <= ymin - panel_row_prt; y++)
+ {
+ /* Erase the section */
+ Term_erase(COL_MAP, y, wid);
+ }
+
+ /* Top section of screen */
+ for (y = ymax - panel_row_prt; y <= hgt; y++)
+ {
+ /* Erase the section */
+ Term_erase(COL_MAP, y, wid);
+ }
+
/* Dump the map */
- for (y = panel_row_min; y <= panel_row_max; y++)
+ for (y = ymin; y <= ymax; y++)
{
/* Scan the columns of row "y" */
- for (x = panel_col_min; x <= panel_col_max; x++)
+ for (x = xmin; x <= xmax; x++)
{
- byte a;
- char c;
+ byte a, a2;
+ char c, c2;
#ifdef USE_TRANSPARENCY
byte ta;
/* Determine what is there */
map_info(y, x, &a, &c, &ta, &tc);
-
- /* Hack -- fake monochrome */
- if (fake_monochrome)
- {
- if (world_monster) a = TERM_DARK;
- else if (p_ptr->invuln || world_player) a = TERM_WHITE;
- else if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] == MUSIC_INVULN)) a = TERM_WHITE;
- else if (p_ptr->wraith_form) a = TERM_L_DARK;
- }
-
- /* Efficiency -- Redraw that grid of the map */
- Term_queue_char(x-panel_col_prt, y-panel_row_prt, a, c, ta, tc);
-#else /* USE_TRANSPARENCY */
+#else
/* Determine what is there */
map_info(y, x, &a, &c);
+#endif
/* Hack -- fake monochrome */
if (fake_monochrome)
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
+ if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
+
/* Efficiency -- Redraw that grid of the map */
- Term_queue_char(x-panel_col_prt, y-panel_row_prt, a, c);
-#endif /* USE_TRANSPARENCY */
+#ifdef USE_TRANSPARENCY
+ Term_queue_char(panel_col_of(x), y-panel_row_prt, a, c, ta, tc);
+ if (use_bigtile) Term_queue_char(panel_col_of(x)+1, y-panel_row_prt, a2, c2, 0, 0);
+#else
+ Term_queue_char(panel_col_of(x), y-panel_row_prt, a, c);
+ if (use_bigtile) Term_queue_char(panel_col_of(x)+1, y-panel_row_prt, a2, c2);
+#endif
}
}
if (panel_contains(ny, nx))
{
- byte a = default_color;
- char c;
+ byte a2, a = default_color;
+ char c, c2;
#ifdef USE_TRANSPARENCY
byte ta;
char tc;
+#endif
if (cave[ny][nx].m_idx && m_list[cave[ny][nx].m_idx].ml)
{
/* Determine what is there */
+#ifdef USE_TRANSPARENCY
map_info(ny, nx, &a, &c, &ta, &tc);
-
- if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
- a = default_color;
- else if (a == default_color)
- a = TERM_WHITE;
- }
-
- if (fake_monochrome)
- {
- if (world_monster) a = TERM_DARK;
- else if (p_ptr->invuln || world_player) a = TERM_WHITE;
- else if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] == MUSIC_INVULN)) a = TERM_WHITE;
- else if (p_ptr->wraith_form) a = TERM_L_DARK;
- }
-
-
- /* Hack -- Queue it */
- Term_queue_char(nx-panel_col_prt, ny-panel_row_prt, a, '*', ta, tc);
-#else /* USE_TRANSPARENCY */
-
- if (cave[ny][nx].m_idx && m_list[cave[ny][nx].m_idx].ml)
- {
- /* Determine what is there */
+#else
map_info(ny, nx, &a, &c);
-
- if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
+#endif
+ if (a & 0x80)
+ a = default_color;
+ else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
a = default_color;
else if (a == default_color)
a = TERM_WHITE;
else if (p_ptr->wraith_form) a = TERM_L_DARK;
}
+ c = '*';
+ if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
+
/* Hack -- Queue it */
- Term_queue_char(nx-panel_col_prt, ny-panel_row_prt, a, '*');
-#endif /* USE_TRANSPARENCY */
+#ifdef USE_TRANSPARENCY
+ Term_queue_char(panel_col_of(nx), ny-panel_row_prt, a, c, ta, tc);
+ if (use_bigtile) Term_queue_char(panel_col_of(nx)+1, ny-panel_row_prt, a, c2, 0, 0);
+#else
+ Term_queue_char(panel_col_of(nx), ny-panel_row_prt, a, c);
+ if (use_bigtile) Term_queue_char(panel_col_of(nx)+1, ny-panel_row_prt, a, c2);
+#endif
}
/* Known Wall */
}
-
-
-/*
- * Display highest priority object in the RATIO by RATIO area
- */
-#define RATIO 3
-
-
-/*
- * Hack -- priority array (see below)
- *
- * Note that all "walls" always look like "secret doors" (see "map_info()").
- */
-static byte priority_table[][2] =
-{
- /* Dark */
- { FEAT_NONE, 2 },
-
- /* Floors */
- { FEAT_FLOOR, 5 },
-
- /* Walls */
- { FEAT_SECRET, 10 },
-
- /* Quartz */
- { FEAT_QUARTZ, 11 },
-
- /* Magma */
- { FEAT_MAGMA, 12 },
-
- /* Rubble */
- { FEAT_RUBBLE, 13 },
-
- /* Open doors */
- { FEAT_OPEN, 15 },
- { FEAT_BROKEN, 15 },
-
- /* Closed doors */
- { FEAT_DOOR_HEAD + 0x00, 17 },
-
- /* Hidden gold */
- { FEAT_QUARTZ_K, 19 },
- { FEAT_MAGMA_K, 19 },
-
- /* water, lava, & trees */
- { FEAT_DEEP_WATER, 20 },
- { FEAT_SHAL_WATER, 20 },
- { FEAT_DEEP_LAVA, 20 },
- { FEAT_SHAL_LAVA, 20 },
- { FEAT_DIRT, 6 },
- { FEAT_GRASS, 6 },
- { FEAT_FLOWER, 6 },
- { FEAT_DEEP_GRASS, 6 },
- { FEAT_DARK_PIT, 20 },
- { FEAT_TREES, 6 },
- { FEAT_MOUNTAIN, 20 },
-
- /* Stairs */
- { FEAT_LESS, 25 },
- { FEAT_MORE, 25 },
- { FEAT_LESS_LESS, 25 },
- { FEAT_MORE_MORE, 25 },
- { FEAT_ENTRANCE, 25 },
-
- { FEAT_QUEST_ENTER, 25 },
- { FEAT_QUEST_EXIT, 25 },
- { FEAT_QUEST_DOWN, 25 },
- { FEAT_QUEST_UP, 25 },
-
- /* End */
- { 0, 0 }
-};
-
-
-/*
- * Hack -- a priority function (see below)
- */
-static byte priority(byte a, char c)
-{
- int i, p0, p1;
-
- feature_type *f_ptr;
-
- /* Scan the table */
- for (i = 0; TRUE; i++)
- {
- /* Priority level */
- p1 = priority_table[i][1];
-
- /* End of table */
- if (!p1) break;
-
- /* Feature index */
- p0 = priority_table[i][0];
-
- /* Access the feature */
- f_ptr = &f_info[p0];
-
- /* Check character and attribute, accept matches */
- if ((f_ptr->x_char == c) && (f_ptr->x_attr == a)) return (p1);
- }
-
- /* Default */
- return (20);
-}
-
static cptr simplify_list[][2] =
{
#ifdef JP
{"¤ÎËâË¡½ñ", ""},
{NULL, NULL}
#else
- {"Ring of ", "="},
- {"Amulet of ", "\""},
- {"Scroll of ", "?"},
- {"Wand of " , "-"},
- {"Rod of " , "-"},
- {"Staff of " , "_"},
- {"Potion of ", "!"},
+ {"^Ring of ", "="},
+ {"^Amulet of ", "\""},
+ {"^Scroll of ", "?"},
+ {"^Scroll titled ", "?"},
+ {"^Wand of " , "-"},
+ {"^Rod of " , "-"},
+ {"^Staff of " , "_"},
+ {"^Potion of ", "!"},
{" Spellbook ",""},
- {"Book of ", ""},
+ {"^Book of ", ""},
{" Magic [", "["},
{" Book [", "["},
{" Arts [", "["},
- {"Set of ", ""},
- {"Pair of ", ""},
+ {"^Set of ", ""},
+ {"^Pair of ", ""},
{NULL, NULL}
#endif
};
static void display_shortened_item_name(object_type *o_ptr, int y)
{
- unsigned char buf[MAX_NLEN];
+ char buf[MAX_NLEN];
char *c = buf;
int len = 0;
+ byte attr;
object_desc(buf, o_ptr, FALSE, 0);
+ attr = tval_to_attr[o_ptr->tval % 128];
+
+ if (p_ptr->image)
+ {
+ attr = TERM_WHITE;
+#ifdef JP
+ strcpy(buf, "²¿¤«´ñ̯¤Êʪ");
+#else
+ strcpy(buf, "something strange");
+#endif
+ }
for (c = buf; *c; c++)
{
for (i = 0; simplify_list[i][1]; i++)
{
cptr org_w = simplify_list[i][0];
+
+ if (*org_w == '^')
+ {
+ if (c == buf)
+ org_w++;
+ else
+ continue;
+ }
+
if (!strncmp(c, org_w, strlen(org_w)))
{
char *s = c;
}
}
*c='\0';
-// put_str(buf,y,0);
- Term_putstr(0, y, 12, tval_to_attr[o_ptr->tval % 128], buf);
+ Term_putstr(0, y, 12, attr, buf);
}
/*
* Display a "small-scale" map of the dungeon in the active Term
- *
- * Note that the "map_info()" function must return fully colorized
- * data or this function will not work correctly.
- *
- * Note that this function must "disable" the special lighting
- * effects so that the "priority" function will work.
- *
- * Note the use of a specialized "priority" function to allow this
- * function to work with any graphic attr/char mappings, and the
- * attempts to optimize this function where possible.
*/
void display_map(int *cy, int *cx)
{
int i, j, x, y;
- byte ta;
- char tc;
+ byte ta, a2;
+ char tc, c2;
byte tp;
- byte ma[SCREEN_HGT + 2][SCREEN_WID + 2];
- char mc[SCREEN_HGT + 2][SCREEN_WID + 2];
+ byte **bigma;
+ char **bigmc;
+ byte **bigmp;
- byte mp[SCREEN_HGT + 2][SCREEN_WID + 2];
+ byte **ma;
+ char **mc;
+ byte **mp;
- bool old_view_special_lite;
- bool old_view_granite_lite;
+ /* Save lighting effects */
+ bool old_view_special_lite = view_special_lite;
+ bool old_view_granite_lite = view_granite_lite;
bool fake_monochrome = (!use_graphics || streq(ANGBAND_SYS, "ibm"));
- int yrat = cur_hgt / SCREEN_HGT;
- int xrat = cur_wid / SCREEN_WID;
+ int hgt, wid, yrat, xrat;
+ int **match_autopick_yx;
+ object_type ***object_autopick_yx;
- int match_autopick_yx[SCREEN_HGT+2][SCREEN_WID+2];
- object_type *object_autopick_yx[SCREEN_HGT+2][SCREEN_WID+2];
+ /* Get size */
+ Term_get_size(&wid, &hgt);
+ hgt -= 2;
+ wid -= 14;
+ if (use_bigtile) wid /= 2;
- /* Save lighting effects */
- old_view_special_lite = view_special_lite;
- old_view_granite_lite = view_granite_lite;
+ yrat = (cur_hgt + hgt - 1) / hgt;
+ xrat = (cur_wid + wid - 1) / wid;
/* Disable lighting effects */
view_special_lite = FALSE;
view_granite_lite = FALSE;
- /* Clear the chars and attributes */
- for (y = 0; y < SCREEN_HGT + 2; ++y)
+ /* Allocate the maps */
+ C_MAKE(ma, (hgt + 2), byte_ptr);
+ 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(object_autopick_yx, (hgt + 2), object_type **);
+
+ /* Allocate and wipe each line map */
+ for (y = 0; y < (hgt + 2); y++)
{
- for (x = 0; x < SCREEN_WID + 2; ++x)
+ /* Allocate one row each array */
+ C_MAKE(ma[y], (wid + 2), byte);
+ 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(object_autopick_yx[y], (wid + 2), object_type *);
+
+ for (x = 0; x < wid + 2; ++x)
{
match_autopick_yx[y][x] = -1;
object_autopick_yx[y][x] = NULL;
}
}
+ /* Allocate the maps */
+ C_MAKE(bigma, (cur_hgt + 2), byte_ptr);
+ C_MAKE(bigmc, (cur_hgt + 2), char_ptr);
+ C_MAKE(bigmp, (cur_hgt + 2), byte_ptr);
+
+ /* Allocate and wipe each line map */
+ for (y = 0; y < (cur_hgt + 2); y++)
+ {
+ /* Allocate one row each array */
+ C_MAKE(bigma[y], (cur_wid + 2), byte);
+ C_MAKE(bigmc[y], (cur_wid + 2), char);
+ C_MAKE(bigmp[y], (cur_wid + 2), byte);
+
+ for (x = 0; x < cur_wid + 2; ++x)
+ {
+ /* Nothing here */
+ bigma[y][x] = TERM_WHITE;
+ bigmc[y][x] = ' ';
+
+ /* No priority */
+ bigmp[y][x] = 0;
+ }
+ }
+
/* Fill in the map */
for (i = 0; i < cur_wid; ++i)
{
match_autopick=-1;
autopick_obj=NULL;
+ feat_priority = -1;
/* Extract the current attr/char at that map location */
#ifdef USE_TRANSPARENCY
map_info(j, i, &ta, &tc);
#endif /* USE_TRANSPARENCY */
- /* Extract the priority of that attr/char */
- tp = priority(ta, tc);
+ /* Extract the priority */
+ tp = feat_priority;
if(match_autopick!=-1
&& (match_autopick_yx[y][x] == -1
tp = 0x7f;
}
+ /* Save the char, attr and priority */
+ bigmc[j+1][i+1] = tc;
+ bigma[j+1][i+1] = ta;
+ bigmp[j+1][i+1] = tp;
+ }
+ }
+
+ for (j = 0; j < cur_hgt; ++j)
+ {
+ for (i = 0; i < cur_wid; ++i)
+ {
+ /* Location */
+ x = i / xrat + 1;
+ y = j / yrat + 1;
+
+ tc = bigmc[j+1][i+1];
+ ta = bigma[j+1][i+1];
+ tp = bigmp[j+1][i+1];
+
+ /* rare feature has more priority */
+ if (mp[y][x] == tp)
+ {
+ int t;
+ int cnt = 0;
+
+ for (t = 0; t < 8; t++)
+ {
+ if (tc == bigmc[j+1+ddy_cdd[t]][i+1+ddx_cdd[t]] &&
+ ta == bigma[j+1+ddy_cdd[t]][i+1+ddx_cdd[t]])
+ cnt++;
+ }
+ if (cnt <= 4)
+ tp++;
+ }
+
/* Save "best" */
- if (mp[y][x] <= tp)
+ if (mp[y][x] < tp)
{
- /* Save the char */
+ /* Save the char, attr and priority */
mc[y][x] = tc;
-
- /* Save the attr */
ma[y][x] = ta;
-
- /* Save priority */
mp[y][x] = tp;
}
}
/* Corners */
- x = SCREEN_WID + 1;
- y = SCREEN_HGT + 1;
+ x = wid + 1;
+ y = hgt + 1;
/* Draw the corners */
mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
/* Draw the horizontal edges */
- for (x = 1; x <= SCREEN_WID; x++) mc[0][x] = mc[y][x] = '-';
+ for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
/* Draw the vertical edges */
- for (y = 1; y <= SCREEN_HGT; y++) mc[y][0] = mc[y][x] = '|';
+ for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
/* Display each map line in order */
- for (y = 0; y < SCREEN_HGT+2; ++y)
+ for (y = 0; y < hgt + 2; ++y)
{
/* Start a new line */
Term_gotoxy(COL_MAP, y);
/* Display the line */
- for (x = 0; x < SCREEN_WID+2; ++x)
+ for (x = 0; x < wid + 2; ++x)
{
ta = ma[y][x];
tc = mc[y][x];
else if (p_ptr->wraith_form) ta = TERM_L_DARK;
}
+ if (use_bigtile) bigtile_attr(&tc, &ta, &c2, &a2);
+
/* Add the character */
Term_addch(ta, tc);
+ if (use_bigtile) Term_addch(a2, c2);
}
}
- for (y = 1; y < SCREEN_HGT+1; ++y)
+ for (y = 1; y < hgt + 1; ++y)
{
match_autopick = -1;
- for (x = 1; x <= SCREEN_WID; x++){
+ for (x = 1; x <= wid; x++){
if (match_autopick_yx[y][x] != -1 &&
(match_autopick > match_autopick_yx[y][x] ||
match_autopick == -1)){
autopick_obj = object_autopick_yx[y][x];
}
}
+
+ /* Clear old display */
+ Term_putstr(0, y, 12, 0, " ");
+
if (match_autopick != -1)
#if 1
display_shortened_item_name(autopick_obj, y);
#else
{
- unsigned char buf[13] = "\0";
- strncpy(buf,autopick_name[match_autopick],12);
+ char buf[13] = "\0";
+ strncpy(buf,autopick_list[match_autopick].name,12);
buf[12] = '\0';
put_str(buf,y,0);
}
}
/* Player location */
- (*cy) = py / yrat + 1 + ROW_MAP;
- (*cx) = px / xrat + 1 + COL_MAP;
-
+ (*cy) = py / yrat + 1 + ROW_MAP;
+ if (!use_bigtile)
+ (*cx) = px / xrat + 1 + COL_MAP;
+ else
+ (*cx) = (px / xrat + 1) * 2 + COL_MAP;
/* Restore lighting effects */
view_special_lite = old_view_special_lite;
view_granite_lite = old_view_granite_lite;
+
+ /* Free each line map */
+ for (y = 0; y < (hgt + 2); y++)
+ {
+ /* Free one row each array */
+ C_FREE(ma[y], (wid + 2), byte);
+ C_FREE(mc[y], (wid + 2), char);
+ C_FREE(mp[y], (wid + 2), byte);
+ C_FREE(match_autopick_yx[y], (wid + 2), int);
+ C_FREE(object_autopick_yx[y], (wid + 2), object_type **);
+ }
+
+ /* Free each line map */
+ C_FREE(ma, (hgt + 2), byte_ptr);
+ C_FREE(mc, (hgt + 2), char_ptr);
+ C_FREE(mp, (hgt + 2), byte_ptr);
+ C_FREE(match_autopick_yx, (hgt + 2), sint_ptr);
+ C_FREE(object_autopick_yx, (hgt + 2), object_type **);
+
+ /* Free each line map */
+ for (y = 0; y < (cur_hgt + 2); y++)
+ {
+ /* Free one row each array */
+ C_FREE(bigma[y], (cur_wid + 2), byte);
+ C_FREE(bigmc[y], (cur_wid + 2), char);
+ C_FREE(bigmp[y], (cur_wid + 2), byte);
+ }
+
+ /* Free each line map */
+ C_FREE(bigma, (cur_hgt + 2), byte_ptr);
+ C_FREE(bigmc, (cur_hgt + 2), char_ptr);
+ C_FREE(bigmp, (cur_hgt + 2), byte_ptr);
}
/* Clear the screen */
Term_clear();
- display_autopick=0;
+ display_autopick = 0;
/* Display the map */
display_map(&cy, &cx);
/* Wait for it */
- if(max_autopick && !p_ptr->wild_mode && (display_pick || display_nopick || display_destroy))
+ if(max_autopick && !p_ptr->wild_mode)
{
+ display_autopick = ITEM_DISPLAY;
+
+ while (1)
+ {
+ int i;
+ byte flag;
+
+ int wid, hgt, row_message;
+
+ Term_get_size(&wid, &hgt);
+ row_message = hgt - 1;
+
#ifdef JP
- put_str("²¿¤«¥¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹('M':¥¢¥¤¥Æ¥à¤Î¤ßɽ¼¨)", 23, 17);
+ put_str("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤('M':½¦¤¦ 'N':ÊüÃÖ 'D':M+N 'K':²õ¤¹¥¢¥¤¥Æ¥à¤òɽ¼¨)", row_message, 1);
#else
- put_str("Hit M for display items, hit any other key to continue.", 23, 17);
+ put_str(" Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items.", row_message, 1);
#endif
- /* Hilite the player */
- move_cursor(cy, cx);
-
- /* Get any key */
- if( inkey()=='M')
- {
+
+ /* Hilite the player */
+ move_cursor(cy, cx);
+
+ i = inkey();
+
+ if ('M' == i)
+ flag = DO_AUTOPICK;
+ else if ('N' == i)
+ flag = DONT_AUTOPICK;
+ else if ('K' == i)
+ flag = DO_AUTODESTROY;
+ else if ('D' == i)
+ flag = (DO_AUTOPICK | DONT_AUTOPICK);
+ else
+ break;
+
Term_fresh();
+ if (~display_autopick & flag)
+ display_autopick |= flag;
+ else
+ display_autopick &= ~flag;
/* Display the map */
- display_autopick=1;
display_map(&cy, &cx);
- display_autopick=0;
-#ifdef JP
- put_str("²¿¤«¥¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹", 23, 30);
-#else
- put_str("Hit any key to continue", 23, 30);
-#endif
- /* Hilite the player */
- move_cursor(cy, cx);
- /* Get any key */
- inkey();
}
+
+ display_autopick = 0;
+
}
else
{
* list the "nearby" grids before the more "distant" ones in the
* array of torch-lit grids.
*
- * We will correctly handle "large" radius lites, though currently,
- * it is impossible for the player to have more than radius 3 lite.
- *
* We assume that "radius zero" lite is in fact no lite at all.
*
* Torch Lantern Artifacts
int d;
/* Paranoia -- see "LITE_MAX" */
- if (p > 5) p = 5;
+ if (p > 14) p = 14;
/* South-East of the player */
if (cave_floor_bold(py+1, px+1))
s16b end_temp;
- bool daytime = ((turn % (20L * TOWN_DAWN)) < ((20L * TOWN_DAWN) / 2));
-
/* Clear all monster lit squares */
for (i = 0; i < mon_lite_n; i++)
{
/* Exit if has no light */
if (!rad) continue;
- if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (m_ptr->csleep || (!dun_level && daytime) || p_ptr->inside_battle)) continue;
+ if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (m_ptr->csleep || (!dun_level && is_daytime()) || p_ptr->inside_battle)) continue;
if (world_monster) continue;
}
/* Add to end of temp array */
- temp_x[temp_n] = fx;
- temp_y[temp_n] = fy;
+ temp_x[temp_n] = (byte)fx;
+ temp_y[temp_n] = (byte)fy;
temp_n++;
}
/* Forget that the grid is viewable */
c_ptr->info &= ~(CAVE_VIEW);
+ if (!panel_contains(y, x)) continue;
+
/* Update the screen */
lite_spot(y, x);
}
/*
- * Hack -- Allow us to treat the "seen" array as a queue
- */
-static int flow_head = 0;
-static int flow_tail = 0;
-
-
-/*
- * Take note of a reachable grid. Assume grid is legal.
- */
-static void update_flow_aux(int y, int x, int m, int n)
-{
- cave_type *c_ptr;
-
- int old_head = flow_head;
-
-
- /* Get the grid */
- c_ptr = &cave[y][x];
-
- /* Ignore "pre-stamped" entries */
- if (c_ptr->when == flow_n && (c_ptr->dist <= n) && (c_ptr->cost <= m)) return;
-
- /* Ignore "walls" and "rubble" */
- if ((c_ptr->feat > FEAT_SECRET) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) return;
-
- /* Save the flow cost */
- if (c_ptr->when != flow_n || c_ptr->cost > m) c_ptr->cost = m;
- if (c_ptr->when != flow_n || c_ptr->dist > n) c_ptr->dist = n;
-
- /* Save the time-stamp */
- c_ptr->when = flow_n;
-
- /* Hack -- limit flow depth */
- if (n == MONSTER_FLOW_DEPTH) return;
-
- /* Enqueue that entry */
- temp_y[flow_head] = y;
- temp_x[flow_head] = x;
-
- /* Advance the queue */
- if (++flow_head == TEMP_MAX) flow_head = 0;
-
- /* Hack -- notice overflow by forgetting new entry */
- if (flow_head == flow_tail) flow_head = old_head;
-}
-
-
-/*
* Hack - speed up the update_flow algorithm by only doing
* it everytime the player moves out of LOS of the last
* "way-point".
void update_flow(void)
{
int x, y, d;
+ int flow_head = 1;
+ int flow_tail = 0;
/* Hack -- disabled */
if (stupid_monsters) return;
/* Paranoia -- make sure the array is empty */
if (temp_n) return;
-#if 0
/* The last way-point is on the map */
if (running && in_bounds(flow_y, flow_x))
{
/* The way point is in sight - do not update. (Speedup) */
if (cave[flow_y][flow_x].info & CAVE_VIEW) return;
}
-#endif
+
+ /* Erase all of the current flow information */
+ for (y = 0; y < cur_hgt; y++)
+ {
+ for (x = 0; x < cur_wid; x++)
+ {
+ cave[y][x].cost = 0;
+ cave[y][x].dist = 0;
+ }
+ }
/* Save player position */
flow_y = py;
flow_x = px;
- /* Cycle the old entries (once per 128 updates) */
- if (flow_n == 255)
+ /* Add the player's grid to the queue */
+ temp_y[0] = py;
+ temp_x[0] = px;
+
+ /* 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];
+
+ /* Forget that entry */
+ if (++flow_tail == TEMP_MAX) flow_tail = 0;
+
+ /* Add the "children" */
+ for (d = 0; d < 8; d++)
+ {
+ int old_head = flow_head;
+ int m = cave[ty][tx].cost + 1;
+ int n = cave[ty][tx].dist + 1;
+ cave_type *c_ptr;
+
+ /* Child location */
+ y = ty + ddy_ddd[d];
+ x = tx + ddx_ddd[d];
+
+ /* Ignore player's grid */
+ if (x == px && y == py) continue;
+
+ c_ptr = &cave[y][x];
+
+ if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_SECRET)) m += 3;
+
+ /* Ignore "pre-stamped" entries */
+ if (c_ptr->dist != 0 && c_ptr->dist <= n && c_ptr->cost <= m) continue;
+
+ /* Ignore "walls" and "rubble" */
+ if ((c_ptr->feat > FEAT_SECRET) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
+
+ /* Save the flow cost */
+ if (c_ptr->cost == 0 || c_ptr->cost > m) c_ptr->cost = m;
+ if (c_ptr->dist == 0 || c_ptr->dist > n) c_ptr->dist = n;
+
+ /* Hack -- limit flow depth */
+ if (n == MONSTER_FLOW_DEPTH) continue;
+
+ /* Enqueue that entry */
+ temp_y[flow_head] = y;
+ temp_x[flow_head] = x;
+
+ /* Advance the queue */
+ if (++flow_head == TEMP_MAX) flow_head = 0;
+
+ /* Hack -- notice overflow by forgetting new entry */
+ if (flow_head == flow_tail) flow_head = old_head;
+ }
+ }
+}
+
+
+static int scent_when = 0;
+
+/*
+ * Characters leave scent trails for perceptive monsters to track.
+ *
+ * Smell is rather more limited than sound. Many creatures cannot use
+ * it at all, it doesn't extend very far outwards from the character's
+ * current position, and monsters can use it to home in the character,
+ * but not to run away from him.
+ *
+ * Smell is valued according to age. When a character takes his turn,
+ * scent is aged by one, and new scent of the current age is laid down.
+ * Speedy characters leave more scent, true, but it also ages faster,
+ * which makes it harder to hunt them down.
+ *
+ * Whenever the age count loops, most of the scent trail is erased and
+ * the age of the remainder is recalculated.
+ */
+void update_smell(void)
+{
+ int i, j;
+ int y, x;
+
+ /* Create a table that controls the spread of scent */
+ const int scent_adjust[5][5] =
+ {
+ { -1, 0, 0, 0,-1 },
+ { 0, 1, 1, 1, 0 },
+ { 0, 1, 2, 1, 0 },
+ { 0, 1, 1, 1, 0 },
+ { -1, 0, 0, 0,-1 },
+ };
+
+ /* Loop the age and adjust scent values when necessary */
+ if (++scent_when == 254)
{
- /* Rotate the time-stamps */
+ /* Scan the entire dungeon */
for (y = 0; y < cur_hgt; y++)
{
for (x = 0; x < cur_wid; x++)
}
/* Restart */
- flow_n = 127;
+ scent_when = 126;
}
- /* Start a new flow (never use "zero") */
- flow_n++;
+ /* Lay down new scent */
+ for (i = 0; i < 5; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ cave_type *c_ptr;
+
+ /* Translate table to map grids */
+ y = i + py - 2;
+ x = j + px - 2;
- /* Reset the "queue" */
- flow_head = flow_tail = 0;
+ /* Check Bounds */
+ if (!in_bounds(y, x)) continue;
- /* Add the player's grid to the queue */
- update_flow_aux(py, px, 0, 0);
+ c_ptr = &cave[y][x];
- /* Now process the queue */
- while (flow_head != flow_tail)
- {
- /* Extract the next entry */
- y = temp_y[flow_tail];
- x = temp_x[flow_tail];
+ /* Walls, water, and lava cannot hold scent. */
+ if ((c_ptr->feat > FEAT_SECRET) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
- /* Forget that entry */
- if (++flow_tail == TEMP_MAX) flow_tail = 0;
+ /* Grid must not be blocked by walls from the character */
+ if (!player_has_los_bold(y, x)) continue;
- /* Add the "children" */
- for (d = 0; d < 8; d++)
- {
- int tmp = cave[y][x].cost+1;
- int yy = y+ddy_ddd[d];
- int xx = x+ddx_ddd[d];
+ /* Note grids that are too far away */
+ if (scent_adjust[i][j] == -1) continue;
- if ((cave[yy][xx].feat >= FEAT_DOOR_HEAD) && (cave[yy][xx].feat <= FEAT_SECRET)) tmp += 3;
- /* Add that child if "legal" */
- update_flow_aux(yy, xx, tmp, cave[y][x].dist+1);
+ /* Mark the grid with new scent */
+ c_ptr->when = scent_when + scent_adjust[i][j];
}
}
-
- /* Forget the flow info */
- flow_head = flow_tail = 0;
}
-
/*
* Hack -- map the current panel (plus some) ala "magic mapping"
*/
/*
* Hack -- track the given monster race
*/
-void monster_race_track(bool kage, int r_idx)
+void monster_race_track(int r_idx)
{
- if (kage) r_idx = MON_KAGE;
-
/* Save this monster ID */
p_ptr->monster_race_idx = r_idx;
/* Calculate torch radius */
p_ptr->update |= (PU_TORCH);
+
+ /* Update monster flow */
+ p_ptr->update |= (PU_FLOW);
}
/* Flush the input if requested */