mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'christof/cave_in_maps' into 'master'
Show cave entries in the map See merge request veloren/veloren!1540
This commit is contained in:
BIN
assets/voxygen/element/map/cave.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/map/cave_bg.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave_bg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/map/cave_hover.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/map/cave_hover.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -418,6 +418,8 @@ magically infused items?"#,
|
|||||||
"hud.map.towns": "Towns",
|
"hud.map.towns": "Towns",
|
||||||
"hud.map.castles": "Castles",
|
"hud.map.castles": "Castles",
|
||||||
"hud.map.dungeons": "Dungeons",
|
"hud.map.dungeons": "Dungeons",
|
||||||
|
"hud.map.caves": "Caves",
|
||||||
|
"hud.map.cave": "Cave",
|
||||||
"hud.map.town": "Town",
|
"hud.map.town": "Town",
|
||||||
"hud.map.castle": "Castle",
|
"hud.map.castle": "Castle",
|
||||||
"hud.map.dungeon": "Dungeon",
|
"hud.map.dungeon": "Dungeon",
|
||||||
|
@ -136,4 +136,5 @@ pub enum SiteKind {
|
|||||||
Town,
|
Town,
|
||||||
Dungeon { difficulty: u32 },
|
Dungeon { difficulty: u32 },
|
||||||
Castle,
|
Castle,
|
||||||
|
Cave,
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,9 @@ image_ids! {
|
|||||||
mmap_site_castle: "voxygen.element.map.castle",
|
mmap_site_castle: "voxygen.element.map.castle",
|
||||||
mmap_site_castle_hover: "voxygen.element.map.castle_hover",
|
mmap_site_castle_hover: "voxygen.element.map.castle_hover",
|
||||||
mmap_site_castle_bg: "voxygen.element.map.castle_bg",
|
mmap_site_castle_bg: "voxygen.element.map.castle_bg",
|
||||||
|
mmap_site_cave_bg: "voxygen.element.map.cave_bg",
|
||||||
|
mmap_site_cave_hover: "voxygen.element.map.cave_hover",
|
||||||
|
mmap_site_cave: "voxygen.element.map.cave",
|
||||||
|
|
||||||
// Window Parts
|
// Window Parts
|
||||||
window_3: "voxygen.element.frames.window_3",
|
window_3: "voxygen.element.frames.window_3",
|
||||||
|
@ -55,7 +55,9 @@ widget_ids! {
|
|||||||
drag_ico,
|
drag_ico,
|
||||||
zoom_txt,
|
zoom_txt,
|
||||||
zoom_ico,
|
zoom_ico,
|
||||||
|
show_caves_img,
|
||||||
|
show_caves_box,
|
||||||
|
show_caves_text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ pub enum Event {
|
|||||||
ShowTowns(bool),
|
ShowTowns(bool),
|
||||||
ShowCastles(bool),
|
ShowCastles(bool),
|
||||||
ShowDungeons(bool),
|
ShowDungeons(bool),
|
||||||
|
ShowCaves(bool),
|
||||||
Close,
|
Close,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +145,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
let show_towns = self.global_state.settings.gameplay.map_show_towns;
|
let show_towns = self.global_state.settings.gameplay.map_show_towns;
|
||||||
let show_dungeons = self.global_state.settings.gameplay.map_show_dungeons;
|
let show_dungeons = self.global_state.settings.gameplay.map_show_dungeons;
|
||||||
let show_castles = self.global_state.settings.gameplay.map_show_castles;
|
let show_castles = self.global_state.settings.gameplay.map_show_castles;
|
||||||
|
let show_caves = self.global_state.settings.gameplay.map_show_caves;
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
let i18n = &self.localized_strings;
|
let i18n = &self.localized_strings;
|
||||||
// Tooltips
|
// Tooltips
|
||||||
@ -453,6 +457,40 @@ impl<'a> Widget for Map<'a> {
|
|||||||
.graphics_for(state.ids.show_dungeons_box)
|
.graphics_for(state.ids.show_dungeons_box)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.show_dungeons_text, ui);
|
.set(state.ids.show_dungeons_text, ui);
|
||||||
|
// Caves
|
||||||
|
Image::new(self.imgs.mmap_site_cave)
|
||||||
|
.down_from(state.ids.show_dungeons_img, 10.0)
|
||||||
|
.w_h(20.0, 20.0)
|
||||||
|
.set(state.ids.show_caves_img, ui);
|
||||||
|
if Button::image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox
|
||||||
|
})
|
||||||
|
.w_h(18.0, 18.0)
|
||||||
|
.hover_image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked_mo
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox_mo
|
||||||
|
})
|
||||||
|
.press_image(if show_caves {
|
||||||
|
self.imgs.checkbox_checked
|
||||||
|
} else {
|
||||||
|
self.imgs.checkbox_press
|
||||||
|
})
|
||||||
|
.right_from(state.ids.show_caves_img, 10.0)
|
||||||
|
.set(state.ids.show_caves_box, ui)
|
||||||
|
.was_clicked()
|
||||||
|
{
|
||||||
|
events.push(Event::ShowCaves(!show_caves));
|
||||||
|
}
|
||||||
|
Text::new(i18n.get("hud.map.caves"))
|
||||||
|
.right_from(state.ids.show_caves_box, 10.0)
|
||||||
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
|
.graphics_for(state.ids.show_caves_box)
|
||||||
|
.color(TEXT_COLOR)
|
||||||
|
.set(state.ids.show_caves_text, ui);
|
||||||
// Map icons
|
// Map icons
|
||||||
if state.ids.mmap_site_icons.len() < self.client.sites().len() {
|
if state.ids.mmap_site_icons.len() < self.client.sites().len() {
|
||||||
state.update(|state| {
|
state.update(|state| {
|
||||||
@ -493,6 +531,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
SiteKind::Town => i18n.get("hud.map.town"),
|
SiteKind::Town => i18n.get("hud.map.town"),
|
||||||
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
|
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
|
||||||
SiteKind::Castle => i18n.get("hud.map.castle"),
|
SiteKind::Castle => i18n.get("hud.map.castle"),
|
||||||
|
SiteKind::Cave => i18n.get("hud.map.cave"),
|
||||||
});
|
});
|
||||||
let (difficulty, desc) = match &site.kind {
|
let (difficulty, desc) = match &site.kind {
|
||||||
SiteKind::Town => (0, i18n.get("hud.map.town").to_string()),
|
SiteKind::Town => (0, i18n.get("hud.map.town").to_string()),
|
||||||
@ -502,6 +541,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
.replace("{difficulty}", difficulty.to_string().as_str()),
|
.replace("{difficulty}", difficulty.to_string().as_str()),
|
||||||
),
|
),
|
||||||
SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()),
|
SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()),
|
||||||
|
SiteKind::Cave => (0, i18n.get("hud.map.cave").to_string()),
|
||||||
};
|
};
|
||||||
let site_btn = Button::image(match &site.kind {
|
let site_btn = Button::image(match &site.kind {
|
||||||
SiteKind::Town => {
|
SiteKind::Town => {
|
||||||
@ -525,6 +565,13 @@ impl<'a> Widget for Map<'a> {
|
|||||||
self.imgs.nothing
|
self.imgs.nothing
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
self.imgs.mmap_site_cave
|
||||||
|
} else {
|
||||||
|
self.imgs.nothing
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.x_y_position_relative_to(
|
.x_y_position_relative_to(
|
||||||
state.ids.grid,
|
state.ids.grid,
|
||||||
@ -536,6 +583,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town_hover,
|
SiteKind::Town => self.imgs.mmap_site_town_hover,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_hover,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_hover,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle_hover,
|
SiteKind::Castle => self.imgs.mmap_site_castle_hover,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave_hover,
|
||||||
})
|
})
|
||||||
.image_color(UI_HIGHLIGHT_0)
|
.image_color(UI_HIGHLIGHT_0)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
@ -555,6 +603,7 @@ impl<'a> Widget for Map<'a> {
|
|||||||
5 => QUALITY_DEBUG,
|
5 => QUALITY_DEBUG,
|
||||||
_ => TEXT_COLOR,
|
_ => TEXT_COLOR,
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => TEXT_COLOR,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// Only display sites that are toggled on
|
// Only display sites that are toggled on
|
||||||
@ -574,6 +623,11 @@ impl<'a> Widget for Map<'a> {
|
|||||||
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
site_btn.set(state.ids.mmap_site_icons[i], ui);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Difficulty from 0-6
|
// Difficulty from 0-6
|
||||||
@ -626,6 +680,11 @@ impl<'a> Widget for Map<'a> {
|
|||||||
dif_img.set(state.ids.site_difs[i], ui)
|
dif_img.set(state.ids.site_difs[i], ui)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => {
|
||||||
|
if show_caves {
|
||||||
|
dif_img.set(state.ids.site_difs[i], ui)
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town_bg,
|
SiteKind::Town => self.imgs.mmap_site_town_bg,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_bg,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_bg,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle_bg,
|
SiteKind::Castle => self.imgs.mmap_site_castle_bg,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave_bg,
|
||||||
})
|
})
|
||||||
.x_y_position_relative_to(
|
.x_y_position_relative_to(
|
||||||
state.ids.grid,
|
state.ids.grid,
|
||||||
@ -277,6 +278,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
5 => QUALITY_DEBUG,
|
5 => QUALITY_DEBUG,
|
||||||
_ => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
_ => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
||||||
},
|
},
|
||||||
|
SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0),
|
||||||
}))
|
}))
|
||||||
.parent(state.ids.grid)
|
.parent(state.ids.grid)
|
||||||
.set(state.ids.mmap_site_icons_bgs[i], ui);
|
.set(state.ids.mmap_site_icons_bgs[i], ui);
|
||||||
@ -284,6 +286,7 @@ impl<'a> Widget for MiniMap<'a> {
|
|||||||
SiteKind::Town => self.imgs.mmap_site_town,
|
SiteKind::Town => self.imgs.mmap_site_town,
|
||||||
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
|
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
|
||||||
SiteKind::Castle => self.imgs.mmap_site_castle,
|
SiteKind::Castle => self.imgs.mmap_site_castle,
|
||||||
|
SiteKind::Cave => self.imgs.mmap_site_cave,
|
||||||
})
|
})
|
||||||
.middle_of(state.ids.mmap_site_icons_bgs[i])
|
.middle_of(state.ids.mmap_site_icons_bgs[i])
|
||||||
.w_h(20.0, 20.0)
|
.w_h(20.0, 20.0)
|
||||||
|
@ -330,6 +330,7 @@ pub enum Event {
|
|||||||
MapShowTowns(bool),
|
MapShowTowns(bool),
|
||||||
MapShowDungeons(bool),
|
MapShowDungeons(bool),
|
||||||
MapShowCastles(bool),
|
MapShowCastles(bool),
|
||||||
|
MapShowCaves(bool),
|
||||||
AdjustWindowSize([u16; 2]),
|
AdjustWindowSize([u16; 2]),
|
||||||
ChangeFullscreenMode(FullScreenSettings),
|
ChangeFullscreenMode(FullScreenSettings),
|
||||||
ToggleParticlesEnabled(bool),
|
ToggleParticlesEnabled(bool),
|
||||||
@ -2285,6 +2286,9 @@ impl Hud {
|
|||||||
map::Event::MapDrag(map_drag) => {
|
map::Event::MapDrag(map_drag) => {
|
||||||
events.push(Event::MapDrag(map_drag));
|
events.push(Event::MapDrag(map_drag));
|
||||||
},
|
},
|
||||||
|
map::Event::ShowCaves(map_show_caves) => {
|
||||||
|
events.push(Event::MapShowCaves(map_show_caves));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -984,6 +984,10 @@ impl PlayState for SessionState {
|
|||||||
global_state.settings.gameplay.map_show_castles = map_show_castles;
|
global_state.settings.gameplay.map_show_castles = map_show_castles;
|
||||||
global_state.settings.save_to_file_warn();
|
global_state.settings.save_to_file_warn();
|
||||||
},
|
},
|
||||||
|
HudEvent::MapShowCaves(map_show_caves) => {
|
||||||
|
global_state.settings.gameplay.map_show_caves = map_show_caves;
|
||||||
|
global_state.settings.save_to_file_warn();
|
||||||
|
},
|
||||||
HudEvent::ChangeGamma(new_gamma) => {
|
HudEvent::ChangeGamma(new_gamma) => {
|
||||||
global_state.settings.graphics.gamma = new_gamma;
|
global_state.settings.graphics.gamma = new_gamma;
|
||||||
global_state.settings.save_to_file_warn();
|
global_state.settings.save_to_file_warn();
|
||||||
|
@ -522,6 +522,7 @@ pub struct GameplaySettings {
|
|||||||
pub map_show_dungeons: bool,
|
pub map_show_dungeons: bool,
|
||||||
pub map_show_castles: bool,
|
pub map_show_castles: bool,
|
||||||
pub loading_tips: bool,
|
pub loading_tips: bool,
|
||||||
|
pub map_show_caves: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for GameplaySettings {
|
impl Default for GameplaySettings {
|
||||||
@ -558,6 +559,7 @@ impl Default for GameplaySettings {
|
|||||||
map_show_dungeons: true,
|
map_show_dungeons: true,
|
||||||
map_show_castles: true,
|
map_show_castles: true,
|
||||||
loading_tips: true,
|
loading_tips: true,
|
||||||
|
map_show_caves: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ fn main() {
|
|||||||
sample_pos(
|
sample_pos(
|
||||||
config,
|
config,
|
||||||
sampler,
|
sampler,
|
||||||
index,
|
|
||||||
samples,
|
samples,
|
||||||
uniform_idx_as_vec2(map_size_lg, posi),
|
uniform_idx_as_vec2(map_size_lg, posi),
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ use self::{Occupation::*, Stock::*};
|
|||||||
use crate::{
|
use crate::{
|
||||||
config::CONFIG,
|
config::CONFIG,
|
||||||
sim::WorldSim,
|
sim::WorldSim,
|
||||||
site::{Castle, Dungeon, Settlement, Site as WorldSite},
|
site::{namegen::NameGen, Castle, Dungeon, Settlement, Site as WorldSite},
|
||||||
util::{attempt, seed_expan, MapVec, CARDINALS, NEIGHBORS},
|
util::{attempt, seed_expan, MapVec, CARDINALS, NEIGHBORS},
|
||||||
Index,
|
Index,
|
||||||
};
|
};
|
||||||
@ -38,6 +38,11 @@ const fn initial_civ_count(map_size_lg: MapSizeLg) -> u32 {
|
|||||||
(3 << (map_size_lg.vec().x + map_size_lg.vec().y)) >> 16
|
(3 << (map_size_lg.vec().x + map_size_lg.vec().y)) >> 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct CaveInfo {
|
||||||
|
pub location: (Vec2<i32>, Vec2<i32>),
|
||||||
|
pub name: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
|
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Civs {
|
pub struct Civs {
|
||||||
@ -56,6 +61,7 @@ pub struct Civs {
|
|||||||
>,
|
>,
|
||||||
|
|
||||||
pub sites: Store<Site>,
|
pub sites: Store<Site>,
|
||||||
|
pub caves: Store<CaveInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change this to get rid of particularly horrid seeds
|
// Change this to get rid of particularly horrid seeds
|
||||||
@ -231,7 +237,7 @@ impl Civs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move this
|
// TODO: Move this
|
||||||
fn generate_cave(&self, ctx: &mut GenCtx<impl Rng>) {
|
fn generate_cave(&mut self, ctx: &mut GenCtx<impl Rng>) {
|
||||||
let mut pos = ctx
|
let mut pos = ctx
|
||||||
.sim
|
.sim
|
||||||
.get_size()
|
.get_size()
|
||||||
@ -292,6 +298,24 @@ impl Civs {
|
|||||||
chunk.spawn_rate = 0.0;
|
chunk.spawn_rate = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.caves.insert(CaveInfo {
|
||||||
|
location: (
|
||||||
|
path.first().unwrap().0 * TerrainChunkSize::RECT_SIZE.map(|e: u32| e as i32),
|
||||||
|
path.last().unwrap().0 * TerrainChunkSize::RECT_SIZE.map(|e: u32| e as i32),
|
||||||
|
),
|
||||||
|
name: {
|
||||||
|
let name = NameGen::location(&mut ctx.rng).generate();
|
||||||
|
match ctx.rng.gen_range(0, 7) {
|
||||||
|
0 => format!("{} Hole", name),
|
||||||
|
1 => format!("{} Cavern", name),
|
||||||
|
2 => format!("{} Hollow", name),
|
||||||
|
3 => format!("{} Tunnel", name),
|
||||||
|
4 => format!("{} Mouth", name),
|
||||||
|
5 => format!("{} Grotto", name),
|
||||||
|
_ => format!("{} Den", name),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn place(&self, id: Id<Place>) -> &Place { self.places.get(id) }
|
pub fn place(&self, id: Id<Place>) -> &Place { self.places.get(id) }
|
||||||
|
@ -114,6 +114,22 @@ impl World {
|
|||||||
wpos: site.center * TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
wpos: site.center * TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.chain(
|
||||||
|
self.civs()
|
||||||
|
.caves
|
||||||
|
.iter()
|
||||||
|
.map(|(_, info)| {
|
||||||
|
// separate the two locations, combine with name
|
||||||
|
std::iter::once((info.name.clone(), info.location.0))
|
||||||
|
.chain(std::iter::once((info.name.clone(), info.location.1)))
|
||||||
|
})
|
||||||
|
.flatten() // unwrap inner iteration
|
||||||
|
.map(|(name, pos)| world_msg::SiteInfo {
|
||||||
|
name: Some(name),
|
||||||
|
kind: world_msg::SiteKind::Cave,
|
||||||
|
wpos: pos,
|
||||||
|
}),
|
||||||
|
)
|
||||||
.collect(),
|
.collect(),
|
||||||
..self.sim.get_map(index)
|
..self.sim.get_map(index)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
column::ColumnSample,
|
column::ColumnSample,
|
||||||
sim::{RiverKind, WorldSim},
|
sim::{RiverKind, WorldSim},
|
||||||
IndexRef, CONFIG,
|
CONFIG,
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
terrain::{
|
terrain::{
|
||||||
@ -71,7 +71,6 @@ pub fn sample_wpos(config: &MapConfig, sampler: &WorldSim, wpos: Vec2<i32>) -> f
|
|||||||
pub fn sample_pos(
|
pub fn sample_pos(
|
||||||
config: &MapConfig,
|
config: &MapConfig,
|
||||||
sampler: &WorldSim,
|
sampler: &WorldSim,
|
||||||
index: IndexRef,
|
|
||||||
samples: Option<&[Option<ColumnSample>]>,
|
samples: Option<&[Option<ColumnSample>]>,
|
||||||
pos: Vec2<i32>,
|
pos: Vec2<i32>,
|
||||||
) -> MapSample {
|
) -> MapSample {
|
||||||
@ -102,8 +101,6 @@ pub fn sample_pos(
|
|||||||
river_kind,
|
river_kind,
|
||||||
spline_derivative,
|
spline_derivative,
|
||||||
is_path,
|
is_path,
|
||||||
is_cave,
|
|
||||||
_near_site,
|
|
||||||
) = sampler
|
) = sampler
|
||||||
.get(pos)
|
.get(pos)
|
||||||
.map(|sample| {
|
.map(|sample| {
|
||||||
@ -118,13 +115,6 @@ pub fn sample_pos(
|
|||||||
sample.river.river_kind,
|
sample.river.river_kind,
|
||||||
sample.river.spline_derivative,
|
sample.river.spline_derivative,
|
||||||
sample.path.0.is_way(),
|
sample.path.0.is_way(),
|
||||||
sample.cave.0.is_way(),
|
|
||||||
sample.sites.iter().any(|site| {
|
|
||||||
index.sites[*site]
|
|
||||||
.get_origin()
|
|
||||||
.distance_squared(pos * TerrainChunkSize::RECT_SIZE.x as i32)
|
|
||||||
< 64i32.pow(2)
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.unwrap_or((
|
.unwrap_or((
|
||||||
@ -138,8 +128,6 @@ pub fn sample_pos(
|
|||||||
None,
|
None,
|
||||||
Vec2::zero(),
|
Vec2::zero(),
|
||||||
false,
|
false,
|
||||||
false,
|
|
||||||
false,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
let humidity = humidity.min(1.0).max(0.0);
|
let humidity = humidity.min(1.0).max(0.0);
|
||||||
@ -247,12 +235,8 @@ pub fn sample_pos(
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
// TODO: Make principled.
|
// TODO: Make principled.
|
||||||
let rgb = /*if near_site {
|
let rgb = if is_path {
|
||||||
Rgb::new(0x57, 0x39, 0x33)
|
|
||||||
} else*/ if is_path {
|
|
||||||
Rgb::new(0x37, 0x29, 0x23)
|
Rgb::new(0x37, 0x29, 0x23)
|
||||||
} else if is_cave {
|
|
||||||
Rgb::new(0x37, 0x37, 0x37)
|
|
||||||
} else {
|
} else {
|
||||||
rgb
|
rgb
|
||||||
};
|
};
|
||||||
|
@ -1476,7 +1476,7 @@ impl WorldSim {
|
|||||||
map_config.is_shaded = false;
|
map_config.is_shaded = false;
|
||||||
|
|
||||||
map_config.generate(
|
map_config.generate(
|
||||||
|pos| sample_pos(&map_config, self, index, Some(&samples_data), pos),
|
|pos| sample_pos(&map_config, self, Some(&samples_data), pos),
|
||||||
|pos| sample_wpos(&map_config, self, pos),
|
|pos| sample_wpos(&map_config, self, pos),
|
||||||
|pos, (r, g, b, _a)| {
|
|pos, (r, g, b, _a)| {
|
||||||
// We currently ignore alpha and replace it with the height at pos, scaled to
|
// We currently ignore alpha and replace it with the height at pos, scaled to
|
||||||
|
@ -2,7 +2,7 @@ mod block_mask;
|
|||||||
mod castle;
|
mod castle;
|
||||||
mod dungeon;
|
mod dungeon;
|
||||||
pub mod economy;
|
pub mod economy;
|
||||||
mod namegen;
|
pub mod namegen;
|
||||||
mod settlement;
|
mod settlement;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
|
Reference in New Issue
Block a user