optional darken by distance and viewshed multiplier
This commit is contained in:
parent
f8c74ea6f9
commit
2c7671b348
7 changed files with 40 additions and 16 deletions
|
|
@ -33,7 +33,8 @@ pub fn render_camera(ecs: &World, ctx: &mut Rltk) {
|
|||
if t_x >= 0 && t_x < map.width && t_y >= 0 && t_y < map.height {
|
||||
let idx = map.xy_idx(t_x, t_y);
|
||||
if map.revealed_tiles[idx] {
|
||||
let (glyph, fg, bg) = crate::map::themes::get_tile_renderables_for_id(idx, &*map);
|
||||
let (glyph, fg, bg) =
|
||||
crate::map::themes::get_tile_renderables_for_id(idx, &*map, Some(*ecs.fetch::<Point>()));
|
||||
ctx.set(x + x_offset, y + y_offset, fg, bg, glyph);
|
||||
}
|
||||
} else if SHOW_BOUNDARIES {
|
||||
|
|
@ -63,18 +64,15 @@ pub fn render_camera(ecs: &World, ctx: &mut Rltk) {
|
|||
if pos.x < max_x && pos.y < max_y && pos.x >= min_x && pos.y >= min_y {
|
||||
let mut draw = false;
|
||||
let mut fg = render.fg;
|
||||
let mut bg = if render.bg == (RGB { r: 0.0, g: 0.0, b: 0.0 }) {
|
||||
crate::map::themes::get_tile_renderables_for_id(idx, &*map).2
|
||||
} else {
|
||||
render.bg
|
||||
};
|
||||
let mut bg = crate::map::themes::get_tile_renderables_for_id(idx, &*map, Some(*ecs.fetch::<Point>())).2;
|
||||
// Draw entities on visible tiles
|
||||
if map.visible_tiles[idx] {
|
||||
draw = true;
|
||||
} else {
|
||||
fg = fg.mul(0.75);
|
||||
fg = fg.mul(crate::map::NON_VISIBLE_MULTIPLIER);
|
||||
// We don't darken BG, because get_tile_renderables_for_id handles this.
|
||||
}
|
||||
|
||||
// Draw entities with minds within telepath range
|
||||
if !draw {
|
||||
if map.telepath_tiles[idx] {
|
||||
|
|
@ -124,7 +122,7 @@ pub fn render_debug_map(map: &Map, ctx: &mut Rltk) {
|
|||
if tx >= 0 && tx < map_width && ty >= 0 && ty < map_height {
|
||||
let idx = map.xy_idx(tx, ty);
|
||||
if map.revealed_tiles[idx] {
|
||||
let (glyph, fg, bg) = crate::map::themes::get_tile_renderables_for_id(idx, &*map);
|
||||
let (glyph, fg, bg) = crate::map::themes::get_tile_renderables_for_id(idx, &*map, None);
|
||||
ctx.set(x, y, fg, bg, glyph);
|
||||
}
|
||||
} else if SHOW_BOUNDARIES {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue