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}
};
/*
c_ptr = &cave[y][x];
/* Feature code */
- feat = c_ptr->feat;
-
- feat_priority = 10;
+ 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_lighting))
+ 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_lighting && 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_lighting)
- {
- /* 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_lighting &&
- 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_lighting)
- {
- /* 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_lighting && 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_lighting)
- {
- /* 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_lighting && 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_lighting)
- {
- /* 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_lighting && 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_lighting && 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_lighting &&
+ 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_lighting && 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_lighting && 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_lighting) ||
- (use_lighting && 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_lighting)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* Torch lite */
if (view_yellow_lite && !p_ptr->wild_mode)
{
- if (use_lighting)
+ if (use_graphics)
{
/* Use a brightly lit tile */
c += 2;
/* Not viewable */
if (!(c_ptr->info & CAVE_VIEW))
{
- if (use_lighting)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* Not glowing */
else if (!(c_ptr->info & CAVE_GLOW))
{
- if (use_lighting)
+ if (use_graphics)
{
/* Use a lit tile */
}
/* Check for "local" illumination */
if (!(cave[yy][xx].info & CAVE_GLOW))
{
- if (use_lighting)
+ 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)
{
if(match_autopick == -1)
continue;
- act = autopick_action[match_autopick];
+ act = autopick_list[match_autopick].action;
if ((act & DO_DISPLAY) && (act & display_autopick))
{
/* Normal attr */
(*ap) = object_attr(o_ptr);
- feat_priority = 15;
+ feat_priority = 20;
/* Hack -- hallucination */
if (p_ptr->image) image_object(ap, cp);
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 = 20;
+ 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[rand_int(strlen(image_object_hack))] :
- image_monster_hack[rand_int(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 = 21;
+ feat_priority = 31;
/* Get the "player" attr */
a = r_ptr->x_attr;
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 */
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++)
{
}
}
*c='\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
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)){
#else
{
char buf[13] = "\0";
- strncpy(buf,autopick_name[match_autopick],12);
+ 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);
}
int i;
byte flag;
+ int wid, hgt, row_message;
+
+ Term_get_size(&wid, &hgt);
+ row_message = hgt - 1;
+
#ifdef JP
- put_str("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤('M':½¦¤¦ 'N':ÊüÃÖ 'D':M+N 'K':²õ¤¹¥¢¥¤¥Æ¥à¤òɽ¼¨)", 23, 1);
+ put_str("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤('M':½¦¤¦ 'N':ÊüÃÖ 'D':M+N 'K':²õ¤¹¥¢¥¤¥Æ¥à¤òɽ¼¨)", row_message, 1);
#else
- put_str(" Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items.", 23, 1);
+ 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 */
* 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;
/* Forget that the grid is viewable */
c_ptr->info &= ~(CAVE_VIEW);
+ if (!panel_contains(y, x)) continue;
+
/* Update the screen */
lite_spot(y, x);
}
int y, x;
/* Create a table that controls the spread of scent */
- int scent_adjust[5][5] =
+ const int scent_adjust[5][5] =
{
- { 250, 0, 0, 0, 250 },
- { 0, 1, 1, 1, 0 },
- { 0, 1, 2, 1, 0 },
- { 0, 1, 1, 1, 0 },
- { 250, 0, 0, 0, 250 },
+ { -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++ == 250)
+ if (++scent_when == 254)
{
/* Scan the entire dungeon */
for (y = 0; y < cur_hgt; y++)
}
/* Restart */
- scent_when = 127;
+ scent_when = 126;
}
if (!player_has_los_bold(y, x)) continue;
/* Note grids that are too far away */
- if (scent_adjust[i][j] == 250) continue;
+ if (scent_adjust[i][j] == -1) continue;
/* Mark the grid with new scent */
c_ptr->when = scent_when + scent_adjust[i][j];
/*
* 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 */