diff --git a/src/gamelog/logstore.rs b/src/gamelog/logstore.rs index 32e63c2..072e46b 100644 --- a/src/gamelog/logstore.rs +++ b/src/gamelog/logstore.rs @@ -43,13 +43,7 @@ pub fn setup_log() { for _ in 0..5 { Logger::new().log(); } - Logger::new() - .append("Welcome!") - .colour(rltk::CYAN) - .append("(") - .append("pretend i wrote a paragraph explaining why you're here") - .append(")") - .log(); + Logger::new().append("Welcome!").colour(rltk::CYAN).append("Press [?] at any time to view controls").period().log(); } pub fn clone_log() -> Vec> { diff --git a/src/map_builders/fill_edges.rs b/src/map_builders/fill_edges.rs new file mode 100644 index 0000000..3c80bc4 --- /dev/null +++ b/src/map_builders/fill_edges.rs @@ -0,0 +1,35 @@ +use super::{BuilderMap, MetaMapBuilder, TileType}; +use rltk::RandomNumberGenerator; + +pub struct FillEdges { + fill_with: TileType, +} + +impl MetaMapBuilder for FillEdges { + #[allow(dead_code)] + fn build_map(&mut self, rng: &mut rltk::RandomNumberGenerator, build_data: &mut BuilderMap) { + self.fill_edges(rng, build_data); + } +} + +impl FillEdges { + #[allow(dead_code)] + pub fn wall() -> Box { + return Box::new(FillEdges { fill_with: TileType::Wall }); + } + + fn fill_edges(&mut self, _rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) { + for x in 0..build_data.map.width { + let mut idx = build_data.map.xy_idx(x, 0); + build_data.map.tiles[idx] = self.fill_with; + idx = build_data.map.xy_idx(x, build_data.map.height - 1); + build_data.map.tiles[idx] = self.fill_with; + } + for y in 0..build_data.map.height { + let mut idx = build_data.map.xy_idx(0, y); + build_data.map.tiles[idx] = self.fill_with; + idx = build_data.map.xy_idx(build_data.map.width - 1, y); + build_data.map.tiles[idx] = self.fill_with; + } + } +} diff --git a/src/map_builders/mod.rs b/src/map_builders/mod.rs index 3ecb2e2..0e2b5d3 100644 --- a/src/map_builders/mod.rs +++ b/src/map_builders/mod.rs @@ -56,6 +56,8 @@ mod rooms_corridors_spawner; use rooms_corridors_spawner::CorridorSpawner; mod door_placement; use door_placement::DoorPlacement; +mod fill_edges; +use fill_edges::FillEdges; // Shared data to be passed around build chain pub struct BuilderMap { @@ -283,8 +285,12 @@ pub fn random_builder(new_depth: i32, rng: &mut rltk::RandomNumberGenerator, wid _ => random_shape_builder(rng, &mut builder), } - /*if rng.roll_dice(1, 3)==1 { - builder.with(WaveformCollapseBuilder::new()); + /* + WFC needs polishing up before it makes good maps. Right now it leaves too much unusable area, + by making disconnected sections and having no methods to connect them. + + if rng.roll_dice(1, 1) == 1 { + builder.with(WaveFunctionCollapseBuilder::new()); // Now set the start to a random starting area let (start_x, start_y) = random_start_position(rng); @@ -293,7 +299,8 @@ pub fn random_builder(new_depth: i32, rng: &mut rltk::RandomNumberGenerator, wid // Setup an exit and spawn mobs builder.with(VoronoiSpawning::new()); builder.with(DistantExit::new()); - }*/ + } + */ if rng.roll_dice(1, 20) == 1 { builder.with(PrefabBuilder::sectional(prefab_builder::prefab_sections::UNDERGROUND_FORT)); @@ -301,6 +308,9 @@ pub fn random_builder(new_depth: i32, rng: &mut rltk::RandomNumberGenerator, wid builder.with(DoorPlacement::new()); builder.with(PrefabBuilder::vaults()); + // Regardless of anything else, fill the edges back in with walls. We can't walk + // there anyway, and we don't want an open line of sight into the unmapped void. + builder.with(FillEdges::wall()); builder } diff --git a/src/map_builders/prefab_builder/mod.rs b/src/map_builders/prefab_builder/mod.rs index 127ccec..c9a0fe5 100644 --- a/src/map_builders/prefab_builder/mod.rs +++ b/src/map_builders/prefab_builder/mod.rs @@ -83,6 +83,10 @@ impl PrefabBuilder { build_data.map.tiles[idx] = TileType::Floor; build_data.starting_position = Some(Position { x: x as i32, y: y as i32 }); } + '+' => { + build_data.map.tiles[idx] = TileType::Floor; + build_data.spawn_list.push((idx, "door".to_string())); + } 'g' => { build_data.map.tiles[idx] = TileType::Floor; build_data.spawn_list.push((idx, "goblin".to_string())); diff --git a/src/spawner.rs b/src/spawner.rs index 2d24231..6486dc0 100644 --- a/src/spawner.rs +++ b/src/spawner.rs @@ -228,7 +228,7 @@ pub fn scroll_table(_map_depth: i32) -> RandomTable { .add("fireball scroll", 2) .add("cursed fireball scroll", 2) .add("confusion scroll", 4) - .add("magic missile scroll", 10) + .add("magic missile scroll", 6) .add("magic map scroll", 4) .add("cursed magic map scroll", 2); }