Add bsp interior

This commit is contained in:
2022-01-30 14:24:56 +01:00
parent c1893aec74
commit 5a00ebf1f1
11 changed files with 317 additions and 38 deletions

View File

@@ -0,0 +1,22 @@
use crate::{Map, TileType};
#[inline(always)]
pub fn draw_corridor(map: &mut Map, x1: i32, y1: i32, x2: i32, y2: i32) {
let mut x = x1;
let mut y = y1;
while x != x2 || y != y2 {
if x < x2 {
x += 1;
} else if x > x2 {
x -= 1;
} else if y < y2 {
y += 1;
} else if y > y2 {
y -= 1;
}
let idx = map.xy_idx(x, y);
map.tiles[idx] = TileType::Floor;
}
}