Add toggle for minimap, fix scaling formula, reduce minimap VD for better performance, and add changelog entry.

This commit is contained in:
Avi Weinstock 2021-05-13 20:46:17 -04:00
parent 1214715c21
commit cbe7521259
6 changed files with 49 additions and 4 deletions

View File

@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- /skill_preset command which allows you to apply skill presets
- Added timed bans and ban history.
- Added non-admin moderators with limit privileges and updated the security model to reflect this.
- Added a minimap mode that visualizes terrain within a chunk.
- Chat tabs
- NPC's now hear certain sounds
- Renamed Animal Trainers to Beastmasters and gave them their own set of armor to wear

View File

@ -14,6 +14,7 @@
"hud.map.caves": "Caves",
"hud.map.cave": "Cave",
"hud.map.peaks": "Mountains",
"hud.map.voxel_map": "Voxel map",
"hud.map.trees": "Giant Trees",
"hud.map.tree": "Giant Tree",
"hud.map.town": "Town",

View File

@ -65,6 +65,9 @@ widget_ids! {
show_peaks_img,
show_peaks_box,
show_peaks_text,
show_voxel_map_img,
show_voxel_map_box,
show_voxel_map_text,
show_difficulty_img,
show_difficulty_box,
show_difficulty_text,
@ -200,6 +203,7 @@ impl<'a> Widget for Map<'a> {
let show_caves = self.global_state.settings.interface.map_show_caves;
let show_trees = self.global_state.settings.interface.map_show_trees;
let show_peaks = self.global_state.settings.interface.map_show_peaks;
let show_voxel_map = self.global_state.settings.interface.map_show_voxel_map;
let show_topo_map = self.global_state.settings.interface.map_show_topo_map;
let mut events = Vec::new();
let i18n = &self.localized_strings;
@ -636,6 +640,40 @@ impl<'a> Widget for Map<'a> {
.graphics_for(state.ids.show_peaks_box)
.color(TEXT_COLOR)
.set(state.ids.show_peaks_text, ui);
// Voxel map
Image::new(self.imgs.mmap_poi_peak)
.down_from(state.ids.show_peaks_img, 10.0)
.w_h(20.0, 20.0)
.set(state.ids.show_voxel_map_img, ui);
if Button::image(if show_voxel_map {
self.imgs.checkbox_checked
} else {
self.imgs.checkbox
})
.w_h(18.0, 18.0)
.hover_image(if show_voxel_map {
self.imgs.checkbox_checked_mo
} else {
self.imgs.checkbox_mo
})
.press_image(if show_voxel_map {
self.imgs.checkbox_checked
} else {
self.imgs.checkbox_press
})
.right_from(state.ids.show_voxel_map_img, 10.0)
.set(state.ids.show_voxel_map_box, ui)
.was_clicked()
{
events.push(Event::SettingsChange(MapShowVoxelMap(!show_voxel_map)));
}
Text::new(i18n.get("hud.map.voxel_map"))
.right_from(state.ids.show_voxel_map_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.graphics_for(state.ids.show_voxel_map_box)
.color(TEXT_COLOR)
.set(state.ids.show_voxel_map_text, ui);
// Map icons
if state.ids.mmap_poi_icons.len() < self.client.pois().len() {
state.update(|state| {

View File

@ -52,7 +52,7 @@ pub struct VoxelMinimap {
keyed_jobs: KeyedJobs<Vec2<i32>, MinimapColumn>,
}
const VOXEL_MINIMAP_SIDELENGTH: u32 = 512;
const VOXEL_MINIMAP_SIDELENGTH: u32 = 256;
impl VoxelMinimap {
pub fn new(ui: &mut Ui) -> Self {
let mut composited = RgbaImage::new(VOXEL_MINIMAP_SIDELENGTH, VOXEL_MINIMAP_SIDELENGTH);
@ -394,8 +394,7 @@ impl<'a> Widget for MiniMap<'a> {
let show_minimap = self.global_state.settings.interface.minimap_show;
let is_facing_north = self.global_state.settings.interface.minimap_face_north;
let show_topo_map = self.global_state.settings.interface.map_show_topo_map;
//let show_voxel_map = self.global_state.settings.interface.map_show_voxel_map;
let show_voxel_map = true;
let show_voxel_map = self.global_state.settings.interface.map_show_voxel_map;
let orientation = if is_facing_north {
Vec3::new(0.0, 1.0, 0.0)
} else {
@ -563,7 +562,7 @@ impl<'a> Widget for MiniMap<'a> {
} else {
self.voxel_minimap.image_id.source_north
};
let scaling = (VOXEL_MINIMAP_SIDELENGTH as f64 / 32.0) * max_zoom / zoom;
let scaling = 32.0 * max_zoom / zoom;
let cmod: Vec2<f64> = (player_pos.xy() % 32.0).as_();
let rect_src = position::Rect::from_xy_dim(
[

View File

@ -122,6 +122,7 @@ pub enum Interface {
MapShowCaves(bool),
MapShowTrees(bool),
MapShowPeaks(bool),
MapShowVoxelMap(bool),
ResetInterfaceSettings,
}
@ -511,6 +512,9 @@ impl SettingsChange {
Interface::MapShowPeaks(map_show_peaks) => {
settings.interface.map_show_peaks = map_show_peaks;
},
Interface::MapShowVoxelMap(map_show_voxel_map) => {
settings.interface.map_show_voxel_map = map_show_voxel_map;
},
Interface::ResetInterfaceSettings => {
// Reset Interface Settings
let tmp = settings.interface.intro_show;

View File

@ -34,6 +34,7 @@ pub struct InterfaceSettings {
pub map_show_caves: bool,
pub map_show_trees: bool,
pub map_show_peaks: bool,
pub map_show_voxel_map: bool,
pub minimap_show: bool,
pub minimap_face_north: bool,
pub minimap_zoom: f64,
@ -67,6 +68,7 @@ impl Default for InterfaceSettings {
map_show_caves: true,
map_show_trees: false,
map_show_peaks: false,
map_show_voxel_map: false,
minimap_show: true,
minimap_face_north: false,
minimap_zoom: 10.0,