diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e0cc2882..319daaddc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enable new giant trees, changed what entities spawn at them - Stealth is now shown as a percentage in Stats Diary UI - Stealth effects from sneaking and armor are evaluated independently. Armor now has effects even when not sneaking +- Zoom-in effect when aiming bow is now optional ### Removed diff --git a/assets/voxygen/i18n/en/hud/settings.ron b/assets/voxygen/i18n/en/hud/settings.ron index fc1369da8f..e7b2266b14 100644 --- a/assets/voxygen/i18n/en/hud/settings.ron +++ b/assets/voxygen/i18n/en/hud/settings.ron @@ -56,6 +56,7 @@ "hud.settings.player_physics_behavior": "Player physics (experimental)", "hud.settings.stop_auto_walk_on_input": "Stop auto walk on movement", "hud.settings.auto_camera": "Auto camera", + "hud.settings.bow_zoom": "Zoom in when charging bow", "hud.settings.reset_gameplay": "Reset to Defaults", "hud.settings.view_distance": "View Distance", diff --git a/voxygen/src/hud/settings_window/gameplay.rs b/voxygen/src/hud/settings_window/gameplay.rs index 010c71739b..68383732f7 100644 --- a/voxygen/src/hud/settings_window/gameplay.rs +++ b/voxygen/src/hud/settings_window/gameplay.rs @@ -50,6 +50,8 @@ widget_ids! { stop_auto_walk_on_input_label, auto_camera_button, auto_camera_label, + bow_zoom_button, + bow_zoom_label, } } @@ -523,6 +525,30 @@ impl<'a> Widget for Gameplay<'a> { .color(TEXT_COLOR) .set(state.ids.auto_camera_label, ui); + // Charging bow zoom toggle + let bow_zoom_toggle = ToggleButton::new( + self.global_state.settings.gameplay.bow_zoom, + self.imgs.checkbox, + self.imgs.checkbox_checked, + ) + .w_h(18.0, 18.0) + .down_from(state.ids.auto_camera_button, 8.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.bow_zoom_button, ui); + + if self.global_state.settings.gameplay.bow_zoom != bow_zoom_toggle { + events.push(ChangeBowZoom(!self.global_state.settings.gameplay.bow_zoom)); + } + + Text::new(self.localized_strings.get("hud.settings.bow_zoom")) + .right_from(state.ids.bow_zoom_button, 10.0) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .graphics_for(state.ids.bow_zoom_button) + .color(TEXT_COLOR) + .set(state.ids.bow_zoom_label, ui); + // Reset the gameplay settings to the default settings if Button::image(self.imgs.button) .w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT) diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 235a52cd23..fe14ed81b9 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -354,17 +354,21 @@ impl PlayState for SessionState { let client = self.client.borrow(); let player_entity = client.entity(); - let mut fov_scaling = 1.0; - if let Some(comp::CharacterState::ChargedRanged(cr)) = client - .state() - .read_storage::() - .get(player_entity) - { - if cr.charge_frac() > 0.5 { - fov_scaling -= 3.0 * cr.charge_frac() / 5.0; + if global_state.settings.gameplay.bow_zoom { + let mut fov_scaling = 1.0; + if let Some(comp::CharacterState::ChargedRanged(cr)) = client + .state() + .read_storage::() + .get(player_entity) + { + if cr.charge_frac() > 0.5 { + fov_scaling -= 3.0 * cr.charge_frac() / 5.0; + } } + camera.set_fixate(fov_scaling); + } else { + camera.set_fixate(1.0); } - camera.set_fixate(fov_scaling); // Compute camera data camera.compute_dependents(&*self.client.borrow().state().terrain()); diff --git a/voxygen/src/session/settings_change.rs b/voxygen/src/session/settings_change.rs index 0af724f2aa..46924ce0a0 100644 --- a/voxygen/src/session/settings_change.rs +++ b/voxygen/src/session/settings_change.rs @@ -63,6 +63,7 @@ pub enum Gameplay { ChangePlayerPhysicsBehavior { server_authoritative: bool }, ChangeStopAutoWalkOnInput(bool), ChangeAutoCamera(bool), + ChangeBowZoom(bool), ResetGameplaySettings, } @@ -318,6 +319,9 @@ impl SettingsChange { Gameplay::ChangeAutoCamera(state) => { settings.gameplay.auto_camera = state; }, + Gameplay::ChangeBowZoom(state) => { + settings.gameplay.bow_zoom = state; + }, Gameplay::ResetGameplaySettings => { // Reset Gameplay Settings settings.gameplay = GameplaySettings::default(); diff --git a/voxygen/src/settings/gameplay.rs b/voxygen/src/settings/gameplay.rs index 488c641f2e..e453f65c1a 100644 --- a/voxygen/src/settings/gameplay.rs +++ b/voxygen/src/settings/gameplay.rs @@ -17,6 +17,7 @@ pub struct GameplaySettings { pub player_physics_behavior: bool, pub stop_auto_walk_on_input: bool, pub auto_camera: bool, + pub bow_zoom: bool, } impl Default for GameplaySettings { @@ -34,6 +35,7 @@ impl Default for GameplaySettings { player_physics_behavior: false, stop_auto_walk_on_input: true, auto_camera: false, + bow_zoom: true, } } }