diff --git a/src/data/ids.rs b/src/data/ids.rs index 017bc3d..ca38810 100644 --- a/src/data/ids.rs +++ b/src/data/ids.rs @@ -22,6 +22,7 @@ pub fn get_local_desc(id: i32) -> String { pub fn get_local_col(id: i32) -> RGB { let col = match id { ID_TOWN => TO_TOWN_COLOUR, + ID_TOWN2 => GRASS_COLOUR, ID_OVERMAP => TO_OVERMAP_COLOUR, _ => (255, 255, 255), }; diff --git a/src/data/names.rs b/src/data/names.rs index 76d44a1..299a701 100644 --- a/src/data/names.rs +++ b/src/data/names.rs @@ -1,4 +1,8 @@ -pub const NAME_OVERMAP: &str = "WORLD MAP"; +pub const NAME_OVERMAP: &str = "the travel map"; +pub const SHORTNAME_OVERMAP: &str = "Travel"; pub const NAME_DUNGEON_RANDOM: &str = "the dungeon"; -pub const NAME_STARTER_TOWN: &str = "TOWN NAME"; +pub const SHORTNAME_DUNGEON_RANDOM: &str = "D"; +pub const NAME_STARTER_TOWN: &str = "the town of Saff"; +pub const SHORTNAME_STARTER_TOWN: &str = "Saff"; pub const NAME_FOREST_BUILDER: &str = "the woods outside of town"; +pub const SHORTNAME_FOREST_BUILDER: &str = "Woods"; diff --git a/src/gui/farlook.rs b/src/gui/farlook.rs index ba2e3a0..beea815 100644 --- a/src/gui/farlook.rs +++ b/src/gui/farlook.rs @@ -12,7 +12,7 @@ pub enum FarlookResult { pub fn show_farlook(gs: &mut State, ctx: &mut Rltk) -> FarlookResult { let runstate = gs.ecs.fetch::(); - let (min_x, _max_x, min_y, _max_y, x_offset, y_offset) = get_screen_bounds(&gs.ecs, ctx); + let (_min_x, _max_x, _min_y, _max_y, x_offset, y_offset) = get_screen_bounds(&gs.ecs, ctx); ctx.print_color( 1 + x_offset, diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 5ddba30..f9dd105 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -32,6 +32,7 @@ use super::{ State, Viewshed, BUC, + get_local_col, }; use crate::data::entity::CARRY_CAPACITY_PER_STRENGTH; use rltk::prelude::*; @@ -323,17 +324,12 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) { // Render id let map = ecs.fetch::(); - let id = format!("D{}", map.id); - ctx.print_color_right(70, 54, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), &id); + let id = if map.depth > 0 { format!("{}{}", map.short_name, map.depth) } else { format!("{}", map.short_name) }; + ctx.print_color_right(70, 54, get_local_col(map.id), RGB::named(rltk::BLACK), &id); // Render turn - ctx.print_color_right( - 64, - 54, - RGB::named(rltk::YELLOW), - RGB::named(rltk::BLACK), - &format!("T{}", crate::gamelog::get_event_count(EVENT::COUNT_TURN)) - ); + let turns = crate::gamelog::get_event_count(EVENT::COUNT_TURN); + ctx.print_color_right(69 - id.len(), 54, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), &format!("T{}", turns)); // Boxes and tooltips last, so they draw over everything else. ctx.draw_hollow_box(0, 0, 70, 8, RGB::named(rltk::WHITE), RGB::named(rltk::BLACK)); // Log box diff --git a/src/main.rs b/src/main.rs index 6c09c58..7361782 100644 --- a/src/main.rs +++ b/src/main.rs @@ -743,7 +743,7 @@ fn main() -> rltk::BError { // Insert calls gs.ecs.insert(rltk::RandomNumberGenerator::new()); gs.ecs.insert(map::MasterDungeonMap::new()); // Master map list - gs.ecs.insert(Map::new(true, 1, 64, 64, 0, "New Map")); // Map + gs.ecs.insert(Map::new(true, 1, 64, 64, 0, "New Map", "N", 0)); // Map gs.ecs.insert(Point::new(0, 0)); // Player pos gs.ecs.insert(gui::Ancestry::Dwarf); // ancestry let player_entity = spawner::player(&mut gs.ecs, 0, 0); diff --git a/src/map/mod.rs b/src/map/mod.rs index 39a621f..0444c7a 100644 --- a/src/map/mod.rs +++ b/src/map/mod.rs @@ -28,6 +28,8 @@ pub struct Map { pub additional_fg_offset: rltk::RGB, pub id: i32, pub name: String, + pub short_name: String, + pub depth: i32, pub difficulty: i32, pub bloodstains: HashSet, pub view_blocked: HashSet, @@ -38,7 +40,16 @@ impl Map { (y as usize) * (self.width as usize) + (x as usize) } - pub fn new(overmap: bool, new_id: i32, width: i32, height: i32, difficulty: i32, name: S) -> Map { + pub fn new( + overmap: bool, + new_id: i32, + width: i32, + height: i32, + difficulty: i32, + name: S, + short_name: S, + depth: i32 + ) -> Map { let map_tile_count = (width * height) as usize; crate::spatial::set_size(map_tile_count); let mut map = Map { @@ -58,6 +69,8 @@ impl Map { ), id: new_id, name: name.to_string(), + short_name: short_name.to_string(), + depth: depth, difficulty: difficulty, bloodstains: HashSet::new(), view_blocked: HashSet::new(), diff --git a/src/map/tiletype.rs b/src/map/tiletype.rs index 253b5bc..c3b2858 100644 --- a/src/map/tiletype.rs +++ b/src/map/tiletype.rs @@ -42,9 +42,9 @@ pub fn tile_opaque(tt: TileType) -> bool { } pub fn tile_cost(tt: TileType) -> f32 { match tt { - TileType::Road => 0.5, - TileType::Grass => 1.1, - TileType::ShallowWater => 1.3, + TileType::Road => 0.75, + TileType::Grass => 1.2, + TileType::ShallowWater => 1.5, _ => 1.0, } } diff --git a/src/map_builders/forest.rs b/src/map_builders/forest.rs index 2c74be8..6bb7c94 100644 --- a/src/map_builders/forest.rs +++ b/src/map_builders/forest.rs @@ -29,6 +29,8 @@ pub fn forest_builder( height, difficulty, NAME_FOREST_BUILDER, + SHORTNAME_FOREST_BUILDER, + 0, initial_player_level ); chain.start_with(CellularAutomataBuilder::floor(TileType::Grass)); diff --git a/src/map_builders/mod.rs b/src/map_builders/mod.rs index fa3769d..b35018b 100644 --- a/src/map_builders/mod.rs +++ b/src/map_builders/mod.rs @@ -107,6 +107,8 @@ impl BuilderChain { height: i32, difficulty: i32, name: S, + short_name: S, + depth: i32, initial_player_level: i32 ) -> BuilderChain { BuilderChain { @@ -114,7 +116,7 @@ impl BuilderChain { builders: Vec::new(), build_data: BuilderMap { spawn_list: Vec::new(), - map: Map::new(overmap, new_id, width, height, difficulty, name), + map: Map::new(overmap, new_id, width, height, difficulty, name, short_name, depth), starting_position: None, rooms: None, corridors: None, @@ -326,7 +328,7 @@ fn random_shape_builder(rng: &mut rltk::RandomNumberGenerator, builder: &mut Bui } fn overmap_builder() -> BuilderChain { - let mut builder = BuilderChain::new(true, ID_OVERMAP, 69, 41, 0, NAME_OVERMAP, 1); + let mut builder = BuilderChain::new(true, ID_OVERMAP, 69, 41, 0, NAME_OVERMAP, SHORTNAME_OVERMAP, 0, 1); builder.start_with(PrefabBuilder::overmap()); builder.with(Foliage::percent(TileType::Grass, 30)); return builder; @@ -344,6 +346,7 @@ pub fn random_builder( width: i32, height: i32, difficulty: i32, + depth: i32, initial_player_level: i32, end: bool, build_type: BuildType @@ -356,6 +359,8 @@ pub fn random_builder( height, difficulty, NAME_DUNGEON_RANDOM, + SHORTNAME_DUNGEON_RANDOM, + depth, initial_player_level ); let mut want_doors = true; @@ -421,8 +426,19 @@ pub fn level_builder( ID_OVERMAP => overmap_builder(), ID_TOWN => town_builder(new_id, rng, width, height, 0, initial_player_level), ID_TOWN2 => forest_builder(new_id, rng, width, height, 1, initial_player_level), - ID_TOWN3 => random_builder(new_id, rng, width, height, 2, initial_player_level, true, BuildType::Room), - ID_INFINITE => random_builder(new_id, rng, width, height, 3, initial_player_level, false, BuildType::Room), - _ => random_builder(new_id, rng, width, height, difficulty, initial_player_level, false, BuildType::Any), + ID_TOWN3 => random_builder(new_id, rng, width, height, 2, 1, initial_player_level, true, BuildType::Room), + _ if new_id >= ID_INFINITE => + random_builder( + new_id, + rng, + width, + height, + difficulty, + new_id - ID_INFINITE + 1, + initial_player_level, + false, + BuildType::Room + ), + _ => random_builder(new_id, rng, width, height, difficulty, 404, initial_player_level, false, BuildType::Room), } } diff --git a/src/map_builders/prefab_builder/prefab_levels.rs b/src/map_builders/prefab_builder/prefab_levels.rs index 336df4f..746c3ee 100644 --- a/src/map_builders/prefab_builder/prefab_levels.rs +++ b/src/map_builders/prefab_builder/prefab_levels.rs @@ -93,7 +93,7 @@ const OVERMAP_TEMPLATE: &str = ^^^^^^^........................≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈.....≈ ^^^^^^^^........@..............≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈....≈ ^^^^^^^^..................≈...≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈...≈≈≈...≈≈≈≈≈≈≈≈.≈≈ -^^^^^^^^^.............1...≈≈....≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈....≈≈......≈≈≈≈≈≈≈≈≈ +^^^^^^^^^.................≈≈1...≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈....≈≈......≈≈≈≈≈≈≈≈≈ ^^^^^^^^^........≈≈≈≈...≈≈≈≈....≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈..≈≈≈......≈≈≈≈≈≈≈≈≈ ^^^^^^^^^^......≈≈≈≈≈≈≈≈≈≈≈≈≈..≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈........≈≈≈≈≈≈≈≈ ^^^^^^^^^^.....≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈........≈≈≈≈≈≈≈≈≈ diff --git a/src/map_builders/town.rs b/src/map_builders/town.rs index 1727f56..ea423f9 100644 --- a/src/map_builders/town.rs +++ b/src/map_builders/town.rs @@ -18,6 +18,8 @@ pub fn town_builder( height, difficulty, NAME_STARTER_TOWN, + SHORTNAME_STARTER_TOWN, + 0, initial_player_level ); chain.start_with(TownBuilder::new()); diff --git a/src/map_builders/wfc/mod.rs b/src/map_builders/wfc/mod.rs index 8132e38..2cc2ff2 100644 --- a/src/map_builders/wfc/mod.rs +++ b/src/map_builders/wfc/mod.rs @@ -37,7 +37,9 @@ impl WaveFunctionCollapseBuilder { build_data.map.width, build_data.map.height, build_data.map.difficulty, - &build_data.map.name + &build_data.map.name, + &build_data.map.short_name, + build_data.map.depth ); loop { let mut solver = Solver::new(constraints.clone(), CHUNK_SIZE, &build_data.map); @@ -53,7 +55,16 @@ impl WaveFunctionCollapseBuilder { } fn render_tile_gallery(&mut self, constraints: &[MapChunk], chunk_size: i32, build_data: &mut BuilderMap) { - build_data.map = Map::new(false, 0, build_data.width, build_data.height, 0, &build_data.map.name); + build_data.map = Map::new( + false, + 0, + build_data.width, + build_data.height, + 0, + &build_data.map.name, + &build_data.map.short_name, + build_data.map.depth + ); let mut counter = 0; let mut x = 1; let mut y = 1; @@ -69,7 +80,16 @@ impl WaveFunctionCollapseBuilder { if y + chunk_size > build_data.map.height { // Move to the next page build_data.take_snapshot(); - build_data.map = Map::new(false, 0, build_data.width, build_data.height, 0, &build_data.map.name); + build_data.map = Map::new( + false, + 0, + build_data.width, + build_data.height, + 0, + &build_data.map.name, + &build_data.map.short_name, + build_data.map.depth + ); x = 1; y = 1;