return 0;
}
}
- else if ((lvl.terrain_at(c) == WALL) || (lvl.terrain_at(c) == HARDWALL) ||
- (lvl.terrain_at(c) == DOOR))
+ else if (terrain_blocks_missiles(lvl.terrain_at(c)))
{
- print_msg("Your %s hits the %s.\n", (wep->obj_id == PO_CROSSBOW) ? "bolt" : "arrow", (lvl.terrain_at(c) == DOOR) ? "door" : "wall");
+ print_msg("Your %s hits the %s.\n", (wep->obj_id == PO_CROSSBOW) ? "bolt" : "arrow", terrain_props[lvl.terrain_at(c)].name);
return 0;
}
}
{ "bone floor", '.', "·", Gcol_white, 0 },
{ "altar", '_', "_", Gcol_l_grey, 0 },
{ "stairs", '>', ">", Gcol_l_grey, 0 },
- { "lava", '}', "}", Gcol_red, TFLAG_fire_hazard },
- { "water", '}', "}", Gcol_blue, TFLAG_drown_hazard },
+ { "lava", '}', "≈", Gcol_red, TFLAG_fire_hazard },
+ { "water", '}', "≈", Gcol_blue, TFLAG_drown_hazard },
};
bool terrain_opacity[NUM_TERRAINS] =
return terrain_props[terr].flags & TFLAG_opaque;
}
+bool terrain_blocks_beings(Terrain terr)
+{
+ return terrain_props[terr].flags & TFLAG_block_beings;
+}
+
+bool terrain_blocks_missiles(Terrain terr)
+{
+ return terrain_props[terr].flags & TFLAG_block_missile;
+}
+
/* map.c */
// vim:cindent:ts=8:sw=4:expandtab
uint32_t flags;
};
+extern Terrain_props terrain_props[NUM_TERRAINS];
+
#define TFLAG_opaque 0x00000001u
#define TFLAG_block_beings 0x00000002u
#define TFLAG_block_ether 0x00000004u
extern void inject_player(void);
extern void look_around_you(void);
extern bool terrain_is_opaque(Terrain terr);
+extern bool terrain_blocks_beings(Terrain terr);
+extern bool terrain_blocks_missiles(Terrain terr);
#endif
/* map.h */
return true;
}
terr = lvl.terrain_at(c);
- switch (terr)
+ if (terrain_blocks_beings(terr))
{
- case WALL:
- case HARDWALL:
+ /* Let's *not* stuff all the wall types into a switch, eh? */
return false;
+ }
+ /* Keep the switch, so that we can maintain a convenient distinction
+ * between floor hazards and volumetric hazards. */
+ switch (terr)
+ {
case LAVA:
if (!can_fly() && !resists(DT_FIRE))
{
}
return 0;
}
- switch (terr)
+ if (terrain_blocks_beings(terr))
{
- case WALL:
- case HARDWALL:
print_mon_name(mon, 3);
print_msg(" is slammed against the wall.\n");
return 0;
+ }
+ switch (terr)
+ {
case LAVA:
if (mptr->can_fly())
{