Skip to content

Commit

Permalink
Footsteps without view bobbing (minetest#5645)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
desttinghim authored and Zeno- committed Apr 25, 2017
1 parent a7e131f commit db17225
Show file tree
Hide file tree
Showing 39 changed files with 39 additions and 52 deletions.
5 changes: 1 addition & 4 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,7 @@ cloud_height (Cloud height) int 120
# Values larger than 26 will start to produce sharp cutoffs at cloud area corners.
cloud_radius (Cloud radius) int 12

# Enables view bobbing when walking.
view_bobbing (Enable view bobbing) bool true

# Multiplier for view bobbing.
# Enable view bobbing and amount of view bobbing.
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
view_bobbing_amount (View bobbing factor) float 1.0

Expand Down
7 changes: 1 addition & 6 deletions minetest.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,7 @@
# type: int
# cloud_radius = 12

# Enables view bobbing when walking.
# type: bool
# view_bobbing = true

# Multiplier for view bobbing.
# Enable view bobbing and amount of view bobbing.
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
# type: float
# view_bobbing_amount = 1.0
Expand Down Expand Up @@ -1815,4 +1811,3 @@
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
# type: int
# profiler_print_interval = 0

2 changes: 1 addition & 1 deletion po/be/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Множнік калыхання пры праглядзе.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/ca/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3465,7 +3465,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/cs/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/da/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3663,7 +3663,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/de/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3746,7 +3746,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Faktor für Auf- und Abbewegung (grafischer Effekt).\n"
Expand Down
2 changes: 1 addition & 1 deletion po/eo/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3387,7 +3387,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/es/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/et/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/fr/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3709,7 +3709,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Facteur de mouvement de bras.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/he/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3301,7 +3301,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/hu/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3615,7 +3615,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/id/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3580,7 +3580,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/it/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3720,7 +3720,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Moltiplicatore per l'ondeggiamento visivo.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/ja/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3535,7 +3535,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/jbo/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3348,7 +3348,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/ko/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3507,7 +3507,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"화면 흔들림 멀티플라이어\n"
Expand Down
2 changes: 1 addition & 1 deletion po/ky/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/lt/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/minetest.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/ms/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/nb/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/nl/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3719,7 +3719,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Vermenigvuldigingsfactor van loopbeweging.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/pl/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3674,7 +3674,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/pt/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3509,7 +3509,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/pt_BR/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3711,7 +3711,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Multiplicador para sacudir a exibição.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/ro/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/ru/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3628,7 +3628,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/sr_Cyrl/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3359,7 +3359,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/sw/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3644,7 +3644,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"Mengi kwa ajili ya Mwoneko kando.\n"
Expand Down
2 changes: 1 addition & 1 deletion po/tr/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3477,7 +3477,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/uk/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3350,7 +3350,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/zh_CN/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3421,7 +3421,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion po/zh_TW/minetest.po
Original file line number Diff line number Diff line change
Expand Up @@ -3608,7 +3608,7 @@ msgstr ""

#: src/settings_translation_file.cpp
msgid ""
"Multiplier for view bobbing.\n"
"Enable view bobbing and amount of view bobbing.\n"
"For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."
msgstr ""
"視野晃動的倍數。\n"
Expand Down
9 changes: 3 additions & 6 deletions src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ class Camera
f32 m_cache_view_bobbing_amount;
f32 m_cache_fov;
f32 m_cache_zoom_fov;
bool m_cache_view_bobbing;

std::list<Nametag *> m_nametags;
};
Expand Down
1 change: 0 additions & 1 deletion src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/settings_translation_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit db17225

Please sign in to comment.