From db17225a976e20c6628afe70dd6b230673287b4d Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Tue, 25 Apr 2017 06:11:51 -0500 Subject: Footsteps without view bobbing (#5645) * Remove redundant view_bobbing setting Also fixes bug where disabling view_bobbing disables footstep sounds. * Removes redundant view_bobbing setting Setting view_bobbing amount to 0 is now the only way to turn view_bobbing on and off. Also fixed a bug where footstep sounds would not play when view_bobbing was disabled. --- src/camera.cpp | 9 +++------ src/camera.h | 1 - src/defaultsettings.cpp | 1 - src/settings_translation_file.cpp | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/camera.cpp b/src/camera.cpp index 7e83dadeb..b119bbfbb 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -102,7 +102,6 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control, m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount"); m_cache_fov = g_settings->getFloat("fov"); m_cache_zoom_fov = g_settings->getFloat("zoom_fov"); - m_cache_view_bobbing = g_settings->getBool("view_bobbing"); m_nametags.clear(); } @@ -280,8 +279,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, v3f rel_cam_target = v3f(0,0,1); v3f rel_cam_up = v3f(0,1,0); - if (m_view_bobbing_anim != 0 && m_camera_mode < CAMERA_MODE_THIRD) - { + if (m_cache_view_bobbing_amount != 0.0f && m_view_bobbing_anim != 0.0f && + m_camera_mode < CAMERA_MODE_THIRD) { f32 bobfrac = my_modf(m_view_bobbing_anim * 2); f32 bobdir = (m_view_bobbing_anim < 0.5) ? 1.0 : -1.0; @@ -467,9 +466,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, const bool swimming = (movement_XZ || player->swimming_vertical) && player->in_liquid; const bool climbing = movement_Y && player->is_climbing; if ((walking || swimming || climbing) && - m_cache_view_bobbing && - (!g_settings->getBool("free_move") || !m_client->checkLocalPrivilege("fly"))) - { + (!g_settings->getBool("free_move") || !m_client->checkLocalPrivilege("fly"))) { // Start animation m_view_bobbing_state = 1; m_view_bobbing_speed = MYMIN(speed.getLength(), 70); diff --git a/src/camera.h b/src/camera.h index f57efdf10..e4c1d0b25 100644 --- a/src/camera.h +++ b/src/camera.h @@ -231,7 +231,6 @@ private: f32 m_cache_view_bobbing_amount; f32 m_cache_fov; f32 m_cache_zoom_fov; - bool m_cache_view_bobbing; std::list m_nametags; }; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 573b5e2d8..d45e386cf 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -171,7 +171,6 @@ void set_default_settings(Settings *settings) // Effects settings->setDefault("directional_colored_fog", "true"); - settings->setDefault("view_bobbing", "true"); settings->setDefault("inventory_items_animations", "false"); settings->setDefault("mip_map", "false"); settings->setDefault("anisotropic_filter", "false"); diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp index d34665181..47601135d 100644 --- a/src/settings_translation_file.cpp +++ b/src/settings_translation_file.cpp @@ -242,7 +242,7 @@ fake_function() { gettext("Enable view bobbing"); gettext("Enables view bobbing when walking."); gettext("View bobbing factor"); - gettext("Multiplier for view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); + gettext("Enable view bobbing and amount of view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); gettext("Fall bobbing factor"); gettext("Multiplier for fall bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); gettext("3D mode"); -- cgit v1.2.3