/* 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;
}
}
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)
/* 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 (use_lighting)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* Use lightened colour */
a = lighting_colours[a][0];
}
- else if (use_lighting &&
+ else if (use_graphics &&
feat_supports_lighting(feat))
{
/* Use a brightly lit tile */
/* Torch lite */
if (view_yellow_lite)
{
- if (use_lighting)
+ if (use_graphics)
{
/* Use a brightly lit tile */
c += 2;
/* 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 (use_lighting)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* 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 (use_lighting)
+ if (use_graphics)
{
/* Use a dark tile */
c++;
/* 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 */
}
}
}
- switch (feat)
+ if (feat_priority == -1)
{
- case FEAT_NONE:
- 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_DIRT:
- case FEAT_GRASS:
- case FEAT_FLOWER:
- case FEAT_DEEP_GRASS:
- case FEAT_SWAMP:
- case FEAT_TREES:
- feat_priority = 0;
- break;
-
- case FEAT_OPEN:
- case FEAT_BROKEN:
- feat_priority = 5;
- break;
-
- 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:
- case FEAT_DARK_PIT:
- feat_priority = 6;
- break;
-
- case FEAT_MAGMA_K:
- case FEAT_QUARTZ_K:
- feat_priority = 7;
- break;
-
- case FEAT_MOUNTAIN:
- case FEAT_PERM_EXTRA:
- case FEAT_PERM_INNER:
- case FEAT_PERM_OUTER:
- case FEAT_PERM_SOLID:
- feat_priority = 8;
- break;
-
- 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;
+ switch (feat)
+ {
+ case FEAT_NONE:
+ case FEAT_DARK_PIT:
+ feat_priority = 1;
+ break;
- default:
- feat_priority = 10;
- 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_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;
+ }
}
/* Hack -- rare random hallucination, except on outer dungeon walls */
- if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !rand_int(256))
+ if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !randint0(256))
{
/* Hallucinate */
image_random(ap, cp);
{
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;
case CLASS_CHAOS_WARRIOR:
do
{
- a = randint(15);
+ a = randint1(15);
}
while (a == TERM_DARK);
break;
byte tp;
+ byte bigma[MAX_HGT+2][MAX_WID+2];
+ char bigmc[MAX_HGT+2][MAX_WID+2];
+ byte bigmp[MAX_HGT+2][MAX_WID+2];
+
byte ma[SCREEN_HGT + 2][SCREEN_WID + 2];
char mc[SCREEN_HGT + 2][SCREEN_WID + 2];
}
}
+ for (j = 0; j < cur_hgt + 2; ++j)
+ {
+ for (i = 0; i < cur_wid + 2; ++i)
+ {
+ /* Nothing here */
+ bigma[j][i] = TERM_WHITE;
+ bigmc[j][i] = ' ';
+
+ /* No priority */
+ bigmp[j][i] = 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;
}
}
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];
/* Calculate torch radius */
p_ptr->update |= (PU_TORCH);
+
+ /* Update monster flow */
+ p_ptr->update |= (PU_FLOW);
}
/* Flush the input if requested */