Merge branch 'master' into switching_to_draw_batches

This commit is contained in:
Llywelwyn 2023-09-23 10:12:26 +01:00
commit 441b22439f
119 changed files with 1851 additions and 3612 deletions

View file

@ -13,7 +13,8 @@ use super::{
gui::renderable_colour,
tile_blocks_telepathy,
};
use rltk::{ FieldOfViewAlg::SymmetricShadowcasting, Point };
use bracket_lib::prelude::*;
use bracket_lib::pathfinding::FieldOfViewAlg::SymmetricShadowcasting;
use specs::prelude::*;
pub struct VisibilitySystem {}
@ -23,7 +24,7 @@ const BLIND_TELEPATHY_RANGE_MULTIPLIER: i32 = 3;
impl<'a> System<'a> for VisibilitySystem {
type SystemData = (
WriteExpect<'a, Map>,
WriteExpect<'a, rltk::RandomNumberGenerator>,
WriteExpect<'a, RandomNumberGenerator>,
Entities<'a>,
WriteStorage<'a, Viewshed>,
WriteStorage<'a, Telepath>,
@ -74,8 +75,7 @@ impl<'a> System<'a> for VisibilitySystem {
p.y >= 0 &&
p.y < map.height &&
(map.lit_tiles[map.xy_idx(p.x, p.y)] == true ||
rltk::DistanceAlg::Pythagoras.distance2d(Point::new(p.x, p.y), origin) <
1.5)
DistanceAlg::Pythagoras.distance2d(Point::new(p.x, p.y), origin) < 1.5)
});
// If this is the player, reveal what they can see
@ -101,7 +101,7 @@ impl<'a> System<'a> for VisibilitySystem {
.append("You spot a")
.colour(renderable_colour(&renderables, e))
.append_n(&name.name)
.colour(rltk::WHITE)
.colour(WHITE)
.period()
.log();
}
@ -121,7 +121,7 @@ impl<'a> System<'a> for VisibilitySystem {
if let Some(_is_blind) = blind_entities.get(ent) {
range *= BLIND_TELEPATHY_RANGE_MULTIPLIER;
}
telepath.telepath_tiles = fast_fov(pos.x, pos.y, range, &map);
telepath.telepath_tiles = fast_fov(pos.x, pos.y, range);
telepath.telepath_tiles.retain(
|p| p.x >= 0 && p.x < map.width && p.y >= 0 && p.y < map.height
);