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

@ -1,4 +1,4 @@
use rltk::prelude::*;
use bracket_lib::prelude::*;
use serde::{ Deserialize, Serialize };
use std::collections::{ HashSet, HashMap };
mod tiletype;
@ -75,7 +75,7 @@ impl Map {
lit_tiles: vec![true; map_tile_count], // NYI: Light sources. Once those exist, we can set this to false.
telepath_tiles: vec![false; map_tile_count],
colour_offset: vec![((0.0, 0.0, 0.0), (0.0, 0.0, 0.0)); map_tile_count],
additional_fg_offset: rltk::RGB::from_u8(
additional_fg_offset: RGB::from_u8(
BRIGHTEN_FG_COLOUR_BY as u8,
BRIGHTEN_FG_COLOUR_BY as u8,
BRIGHTEN_FG_COLOUR_BY as u8
@ -90,7 +90,7 @@ impl Map {
view_blocked: HashSet::new(),
};
let mut rng = rltk::RandomNumberGenerator::new();
let mut rng = RandomNumberGenerator::new();
for idx in 0..map.colour_offset.len() {
map.colour_offset[idx].0 = (
@ -146,12 +146,12 @@ impl BaseMap for Map {
let w = self.width as usize;
let p1 = Point::new(idx1 % w, idx1 / w);
let p2 = Point::new(idx2 % w, idx2 / w);
rltk::DistanceAlg::Pythagoras.distance2d(p1, p2)
DistanceAlg::Pythagoras.distance2d(p1, p2)
}
/// Evaluate every possible exit from a given tile in a cardinal direction, and return it as a vector.
fn get_available_exits(&self, idx: usize) -> rltk::SmallVec<[(usize, f32); 10]> {
let mut exits = rltk::SmallVec::new();
fn get_available_exits(&self, idx: usize) -> SmallVec<[(usize, f32); 10]> {
let mut exits = SmallVec::new();
let x = (idx as i32) % self.width;
let y = (idx as i32) / self.width;
let w = self.width as usize;