mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add a setting to toggle zooming in when charging bow
This commit is contained in:
parent
d50b960592
commit
a9622fe28e
@ -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
|
- Enable new giant trees, changed what entities spawn at them
|
||||||
- Stealth is now shown as a percentage in Stats Diary UI
|
- 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
|
- 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
|
### Removed
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
"hud.settings.player_physics_behavior": "Player physics (experimental)",
|
"hud.settings.player_physics_behavior": "Player physics (experimental)",
|
||||||
"hud.settings.stop_auto_walk_on_input": "Stop auto walk on movement",
|
"hud.settings.stop_auto_walk_on_input": "Stop auto walk on movement",
|
||||||
"hud.settings.auto_camera": "Auto camera",
|
"hud.settings.auto_camera": "Auto camera",
|
||||||
|
"hud.settings.bow_zoom": "Zoom in when charging bow",
|
||||||
"hud.settings.reset_gameplay": "Reset to Defaults",
|
"hud.settings.reset_gameplay": "Reset to Defaults",
|
||||||
|
|
||||||
"hud.settings.view_distance": "View Distance",
|
"hud.settings.view_distance": "View Distance",
|
||||||
|
@ -50,6 +50,8 @@ widget_ids! {
|
|||||||
stop_auto_walk_on_input_label,
|
stop_auto_walk_on_input_label,
|
||||||
auto_camera_button,
|
auto_camera_button,
|
||||||
auto_camera_label,
|
auto_camera_label,
|
||||||
|
bow_zoom_button,
|
||||||
|
bow_zoom_label,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,6 +525,30 @@ impl<'a> Widget for Gameplay<'a> {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.auto_camera_label, ui);
|
.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
|
// Reset the gameplay settings to the default settings
|
||||||
if Button::image(self.imgs.button)
|
if Button::image(self.imgs.button)
|
||||||
.w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT)
|
.w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT)
|
||||||
|
@ -354,17 +354,21 @@ impl PlayState for SessionState {
|
|||||||
let client = self.client.borrow();
|
let client = self.client.borrow();
|
||||||
let player_entity = client.entity();
|
let player_entity = client.entity();
|
||||||
|
|
||||||
let mut fov_scaling = 1.0;
|
if global_state.settings.gameplay.bow_zoom {
|
||||||
if let Some(comp::CharacterState::ChargedRanged(cr)) = client
|
let mut fov_scaling = 1.0;
|
||||||
.state()
|
if let Some(comp::CharacterState::ChargedRanged(cr)) = client
|
||||||
.read_storage::<comp::CharacterState>()
|
.state()
|
||||||
.get(player_entity)
|
.read_storage::<comp::CharacterState>()
|
||||||
{
|
.get(player_entity)
|
||||||
if cr.charge_frac() > 0.5 {
|
{
|
||||||
fov_scaling -= 3.0 * cr.charge_frac() / 5.0;
|
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
|
// Compute camera data
|
||||||
camera.compute_dependents(&*self.client.borrow().state().terrain());
|
camera.compute_dependents(&*self.client.borrow().state().terrain());
|
||||||
|
@ -63,6 +63,7 @@ pub enum Gameplay {
|
|||||||
ChangePlayerPhysicsBehavior { server_authoritative: bool },
|
ChangePlayerPhysicsBehavior { server_authoritative: bool },
|
||||||
ChangeStopAutoWalkOnInput(bool),
|
ChangeStopAutoWalkOnInput(bool),
|
||||||
ChangeAutoCamera(bool),
|
ChangeAutoCamera(bool),
|
||||||
|
ChangeBowZoom(bool),
|
||||||
|
|
||||||
ResetGameplaySettings,
|
ResetGameplaySettings,
|
||||||
}
|
}
|
||||||
@ -318,6 +319,9 @@ impl SettingsChange {
|
|||||||
Gameplay::ChangeAutoCamera(state) => {
|
Gameplay::ChangeAutoCamera(state) => {
|
||||||
settings.gameplay.auto_camera = state;
|
settings.gameplay.auto_camera = state;
|
||||||
},
|
},
|
||||||
|
Gameplay::ChangeBowZoom(state) => {
|
||||||
|
settings.gameplay.bow_zoom = state;
|
||||||
|
},
|
||||||
Gameplay::ResetGameplaySettings => {
|
Gameplay::ResetGameplaySettings => {
|
||||||
// Reset Gameplay Settings
|
// Reset Gameplay Settings
|
||||||
settings.gameplay = GameplaySettings::default();
|
settings.gameplay = GameplaySettings::default();
|
||||||
|
@ -17,6 +17,7 @@ pub struct GameplaySettings {
|
|||||||
pub player_physics_behavior: bool,
|
pub player_physics_behavior: bool,
|
||||||
pub stop_auto_walk_on_input: bool,
|
pub stop_auto_walk_on_input: bool,
|
||||||
pub auto_camera: bool,
|
pub auto_camera: bool,
|
||||||
|
pub bow_zoom: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for GameplaySettings {
|
impl Default for GameplaySettings {
|
||||||
@ -34,6 +35,7 @@ impl Default for GameplaySettings {
|
|||||||
player_physics_behavior: false,
|
player_physics_behavior: false,
|
||||||
stop_auto_walk_on_input: true,
|
stop_auto_walk_on_input: true,
|
||||||
auto_camera: false,
|
auto_camera: false,
|
||||||
|
bow_zoom: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user