diff --git a/CHANGELOG.md b/CHANGELOG.md index e8175eb29b..1177557408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nightly linux Aarch64 builds are now produced (distribution via airshipper will follow soon) - Worldgen wildlife density modifier in features.ron - Rivers now make ambient sounds (again) +- Added a setting to see own speech bubbles ### Changed diff --git a/assets/voxygen/i18n/en/hud/settings.ron b/assets/voxygen/i18n/en/hud/settings.ron index 7f8f21ee63..e106f1efb1 100644 --- a/assets/voxygen/i18n/en/hud/settings.ron +++ b/assets/voxygen/i18n/en/hud/settings.ron @@ -30,6 +30,7 @@ "hud.settings.incoming_damage": "Incoming Damage", "hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage", "hud.settings.speech_bubble": "Speech Bubble", + "hud.settings.speech_bubble_self": "Show Own Speech Bubbles", "hud.settings.speech_bubble_dark_mode": "Speech Bubble Dark Mode", "hud.settings.speech_bubble_icon": "Speech Bubble Icon", "hud.settings.energybar_numbers": "Energybar Numbers", @@ -38,7 +39,7 @@ "hud.settings.percentages": "Percentages", "hud.settings.chat": "Chat", "hud.settings.background_opacity": "Background Opacity", - "hud.settings.chat_character_name": "Character Names in chat", + "hud.settings.chat_character_name": "Character Names in Chat", "hud.settings.loading_tips": "Loading Screen Tips", "hud.settings.reset_interface": "Reset to Defaults", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 97e077b6f1..a7bab73efb 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1797,8 +1797,7 @@ impl Hud { .join() .filter(|t| { let health = t.5; - let entity = t.0; - entity != me && !health.map_or(false, |h| h.is_dead) + !health.map_or(false, |h| h.is_dead) }) .filter_map( |( @@ -1821,6 +1820,7 @@ impl Hud { // Use interpolated position if available let pos = interpolated.map_or(pos.0, |i| i.pos); let in_group = client.group_members().contains_key(uid); + let is_me = entity == me; // TODO: once the site2 rework lands and merchants have dedicated stalls or // buildings, they no longer need to be emphasized via the higher overhead // text radius relative to other NPCs @@ -1835,7 +1835,8 @@ impl Hud { || info.selected_entity.map_or(false, |s| s.0 == entity) || health.map_or(true, overhead::should_show_healthbar) || in_group - || is_merchant) + || is_merchant + || !is_me) && dist_sqr < (if in_group { NAMETAG_GROUP_RANGE @@ -1866,7 +1867,10 @@ impl Hud { 0.0 }, }); - let bubble = if dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) { + // Only render bubble if nearby or if its me and setting is on + let bubble = if (dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) && !is_me) + || (is_me && global_state.settings.interface.speech_bubble_self) + { speech_bubbles.get(uid) } else { None diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index d3e3cd8a1e..1c5c05db0f 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -590,11 +590,11 @@ impl<'a> Widget for Overhead<'a> { self.imgs.nothing }; Image::new(icon) - .w_h(16.0, 16.0) - .top_left_with_margin_on(state.ids.speech_bubble_text, -16.0) - // TODO: Figure out whether this should be parented. - // .parent(id) - .set(state.ids.speech_bubble_icon, ui); + .w_h(16.0, 16.0) + .top_left_with_margin_on(state.ids.speech_bubble_text, -16.0) + // TODO: Figure out whether this should be parented. + // .parent(id) + .set(state.ids.speech_bubble_icon, ui); } } } diff --git a/voxygen/src/hud/settings_window/interface.rs b/voxygen/src/hud/settings_window/interface.rs index 0aee62f2f1..ff868cc3f2 100644 --- a/voxygen/src/hud/settings_window/interface.rs +++ b/voxygen/src/hud/settings_window/interface.rs @@ -88,6 +88,8 @@ widget_ids! { sct_batch_inc_radio, // speech_bubble_text, + speech_bubble_self_text, + speech_bubble_self_button, speech_bubble_dark_mode_text, speech_bubble_dark_mode_button, speech_bubble_icon_text, @@ -846,7 +848,7 @@ impl<'a> Widget for Interface<'a> { .set(state.ids.sct_batch_inc_text, ui); } - // Speech bubble dark mode + // Speech bubbles Text::new(self.localized_strings.get("hud.settings.speech_bubble")) .down_from( if self.global_state.settings.interface.sct { @@ -862,12 +864,38 @@ impl<'a> Widget for Interface<'a> { .font_id(self.fonts.cyri.conrod_id) .color(TEXT_COLOR) .set(state.ids.speech_bubble_text, ui); + + // Show own speech bubbles + let speech_bubble_self = ToggleButton::new( + self.global_state.settings.interface.speech_bubble_self, + self.imgs.checkbox, + self.imgs.checkbox_checked, + ) + .down_from(state.ids.speech_bubble_text, 10.0) + .w_h(18.0, 18.0) + .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) + .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) + .set(state.ids.speech_bubble_self_button, ui); + if self.global_state.settings.interface.speech_bubble_self != speech_bubble_self { + events.push(SpeechBubbleSelf(speech_bubble_self)); + } + Text::new( + self.localized_strings + .get("hud.settings.speech_bubble_self"), + ) + .right_from(state.ids.speech_bubble_self_button, 10.0) + .font_size(self.fonts.cyri.scale(15)) + .font_id(self.fonts.cyri.conrod_id) + .color(TEXT_COLOR) + .set(state.ids.speech_bubble_self_text, ui); + + // Speech bubble dark mode let speech_bubble_dark_mode = ToggleButton::new( self.global_state.settings.interface.speech_bubble_dark_mode, self.imgs.checkbox, self.imgs.checkbox_checked, ) - .down_from(state.ids.speech_bubble_text, 10.0) + .down_from(state.ids.speech_bubble_self_button, 10.0) .w_h(18.0, 18.0) .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) diff --git a/voxygen/src/session/settings_change.rs b/voxygen/src/session/settings_change.rs index e2d9e3dbf8..cbe0814e6a 100644 --- a/voxygen/src/session/settings_change.rs +++ b/voxygen/src/session/settings_change.rs @@ -93,6 +93,7 @@ pub enum Interface { Sct(bool), SctPlayerBatch(bool), SctDamageBatch(bool), + SpeechBubbleSelf(bool), SpeechBubbleDarkMode(bool), SpeechBubbleIcon(bool), ToggleHelp(bool), @@ -436,6 +437,9 @@ impl SettingsChange { Interface::SctDamageBatch(sct_damage_batch) => { settings.interface.sct_damage_batch = sct_damage_batch; }, + Interface::SpeechBubbleSelf(sbdm) => { + settings.interface.speech_bubble_self = sbdm; + }, Interface::SpeechBubbleDarkMode(sbdm) => { settings.interface.speech_bubble_dark_mode = sbdm; }, diff --git a/voxygen/src/settings/interface.rs b/voxygen/src/settings/interface.rs index 7618ba0f46..494ea651c8 100644 --- a/voxygen/src/settings/interface.rs +++ b/voxygen/src/settings/interface.rs @@ -16,6 +16,7 @@ pub struct InterfaceSettings { pub sct: bool, pub sct_player_batch: bool, pub sct_damage_batch: bool, + pub speech_bubble_self: bool, pub speech_bubble_dark_mode: bool, pub speech_bubble_icon: bool, pub crosshair_opacity: f32, @@ -54,6 +55,7 @@ impl Default for InterfaceSettings { sct: true, sct_player_batch: false, sct_damage_batch: false, + speech_bubble_self: true, speech_bubble_dark_mode: false, speech_bubble_icon: true, crosshair_opacity: 0.6,